about summary refs log tree commit diff
path: root/compiler/rustc_const_eval/src/interpret/stack.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-09-15 15:05:29 +0000
committerbors <bors@rust-lang.org>2024-09-15 15:05:29 +0000
commit8c2c9a9ef527edb453bcee638d34beb0e7b4616b (patch)
tree3c3c1a494707c103924d81deee7cf9e400901093 /compiler/rustc_const_eval/src/interpret/stack.rs
parentdde7d6649e421d8b2f074fd3ddd0d712d3448e65 (diff)
parent96195a5e240bac2061a828c8016ad73a3b9f2d37 (diff)
downloadrust-8c2c9a9ef527edb453bcee638d34beb0e7b4616b.tar.gz
rust-8c2c9a9ef527edb453bcee638d34beb0e7b4616b.zip
Auto merge of #130401 - matthiaskrgr:rollup-fri2j58, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #129439 (Implement feature `string_from_utf8_lossy_owned` for lossy conversion from `Vec<u8>` to `String` methods)
 - #129828 (miri: treat non-memory local variables properly for data race detection)
 - #130110 (make dist vendoring configurable)
 - #130293 (Fix lint levels not getting overridden by attrs on `Stmt` nodes)
 - #130342 (interpret, miri: fix dealing with overflow during slice indexing and allocation)

Failed merges:

 - #130394 (const: don't ICE when encountering a mutable ref to immutable memory)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_const_eval/src/interpret/stack.rs')
-rw-r--r--compiler/rustc_const_eval/src/interpret/stack.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler/rustc_const_eval/src/interpret/stack.rs b/compiler/rustc_const_eval/src/interpret/stack.rs
index b6e83715e39..db418c82f66 100644
--- a/compiler/rustc_const_eval/src/interpret/stack.rs
+++ b/compiler/rustc_const_eval/src/interpret/stack.rs
@@ -534,8 +534,11 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
             let dest_place = self.allocate_dyn(layout, MemoryKind::Stack, meta)?;
             Operand::Indirect(*dest_place.mplace())
         } else {
-            assert!(!meta.has_meta()); // we're dropping the metadata
             // Just make this an efficient immediate.
+            assert!(!meta.has_meta()); // we're dropping the metadata
+            // Make sure the machine knows this "write" is happening. (This is important so that
+            // races involving local variable allocation can be detected by Miri.)
+            M::after_local_write(self, local, /*storage_live*/ true)?;
             // Note that not calling `layout_of` here does have one real consequence:
             // if the type is too big, we'll only notice this when the local is actually initialized,
             // which is a bit too late -- we should ideally notice this already here, when the memory