@@ -917,6 +917,7 @@ fn op_to_prop_const<'tcx>(
917
917
918
918
// Do not try interning a value that contains provenance.
919
919
// Due to https://github.com/rust-lang/rust/issues/79738, doing so could lead to bugs.
920
+ // FIXME: remove this hack once that issue is fixed.
920
921
let alloc_ref = ecx.get_ptr_alloc(mplace.ptr(), size).ok()??;
921
922
if alloc_ref.has_provenance() {
922
923
return None;
@@ -928,6 +929,8 @@ fn op_to_prop_const<'tcx>(
928
929
if matches!(ecx.tcx.global_alloc(alloc_id), GlobalAlloc::Memory(_)) {
929
930
// `alloc_id` may point to a static. Codegen will choke on an `Indirect` with anything
930
931
// by `GlobalAlloc::Memory`, so do fall through to copying if needed.
932
+ // FIXME: find a way to treat this more uniformly
933
+ // (probably by fixing codegen)
931
934
return Some(ConstValue::Indirect { alloc_id, offset });
932
935
}
933
936
}
@@ -939,7 +942,7 @@ fn op_to_prop_const<'tcx>(
939
942
940
943
// Check that we do not leak a pointer.
941
944
// Those pointers may lose part of their identity in codegen.
942
- // See https://github.com/rust-lang/rust/issues/79738.
945
+ // FIXME: remove this hack once https://github.com/rust-lang/rust/issues/79738 is fixed .
943
946
if ecx.tcx.global_alloc(alloc_id).unwrap_memory().inner().provenance().ptrs().is_empty() {
944
947
return Some(value);
945
948
}
@@ -969,7 +972,7 @@ impl<'tcx> VnState<'_, 'tcx> {
969
972
970
973
// Check that we do not leak a pointer.
971
974
// Those pointers may lose part of their identity in codegen.
972
- // See https://github.com/rust-lang/rust/issues/79738.
975
+ // FIXME: remove this hack once https://github.com/rust-lang/rust/issues/79738 is fixed .
973
976
assert!(!value.may_have_provenance(self.tcx, op.layout.size));
974
977
975
978
let const_ = Const::Val(value, op.layout.ty);
0 commit comments