Skip to content

Commit 1765587

Browse files
committed
Only track (trivially) freeze types
1 parent b5063ab commit 1765587

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

compiler/rustc_middle/src/ty/util.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -849,7 +849,7 @@ impl<'tcx> Ty<'tcx> {
849849
///
850850
/// Returning true means the type is known to be `Freeze`. Returning
851851
/// `false` means nothing -- could be `Freeze`, might not be.
852-
fn is_trivially_freeze(self) -> bool {
852+
pub fn is_trivially_freeze(self) -> bool {
853853
match self.kind() {
854854
ty::Int(_)
855855
| ty::Uint(_)

compiler/rustc_mir_dataflow/src/value_analysis.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,11 @@ impl Map {
674674
return Err(());
675675
}
676676

677-
// FIXME: Check that the place is `Freeze`.
677+
if !ty.is_trivially_freeze() {
678+
// Due to the way we deal with shared references, only `Freeze` types may be tracked.
679+
// We are a little bit to restrictive here by only allowing trivially `Freeze` types.
680+
return Err(());
681+
}
678682

679683
let place = self.make_place(local, projection)?;
680684

0 commit comments

Comments
 (0)