Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit c674f26

Browse files
committed
Auto merge of rust-lang#2312 - RalfJung:misc, r=RalfJung
put call to stacked borrows end_call in a more sensible place This looks like a refactoring accident.
2 parents c9925ff + dcdf4fb commit c674f26

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ in your program, and cannot run all programs:
6565
not support networking. System API support varies between targets; if you run
6666
on Windows it is a good idea to use `--target x86_64-unknown-linux-gnu` to get
6767
better support.
68-
* Weak memory emulation may produce weak behaivours unobservable by compiled
69-
programs running on real hardware when `SeqCst` fences are used, and it cannot
70-
produce all behaviors possibly observable on real hardware.
68+
* Weak memory emulation may [produce weak behaivours](https://github.com/rust-lang/miri/issues/2301)
69+
unobservable by compiled programs running on real hardware when `SeqCst` fences are used, and it
70+
cannot produce all behaviors possibly observable on real hardware.
7171

7272
[rust]: https://www.rust-lang.org/
7373
[mir]: https://github.com/rust-lang/rfcs/blob/master/text/1211-mir.md
@@ -192,8 +192,9 @@ randomness that is used to determine allocation base addresses. The following
192192
snippet calls Miri in a loop with different values for the seed:
193193

194194
```
195-
for seed in $({ echo obase=16; seq 0 255; } | bc); do
196-
MIRIFLAGS=-Zmiri-seed=$seed cargo miri test || { echo "Last seed: $seed"; break; };
195+
for SEED in $({ echo obase=16; seq 0 255; } | bc); do
196+
echo "Trying seed: $SEED"
197+
MIRIFLAGS=-Zmiri-seed=$SEED cargo miri test || { echo "Failing seed: $SEED"; break; };
197198
done
198199
```
199200

src/machine.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -930,7 +930,10 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for Evaluator<'mir, 'tcx> {
930930
unwinding: bool,
931931
) -> InterpResult<'tcx, StackPopJump> {
932932
let timing = frame.extra.timing.take();
933-
let res = ecx.handle_stack_pop(frame.extra, unwinding);
933+
if let Some(stacked_borrows) = &ecx.machine.stacked_borrows {
934+
stacked_borrows.borrow_mut().end_call(frame.extra.call_id);
935+
}
936+
let res = ecx.handle_stack_pop_unwind(frame.extra, unwinding);
934937
if let Some(profiler) = ecx.machine.profiler.as_ref() {
935938
profiler.finish_recording_interval_event(timing.unwrap());
936939
}

src/shims/panic.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -115,17 +115,13 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
115115
Ok(())
116116
}
117117

118-
fn handle_stack_pop(
118+
fn handle_stack_pop_unwind(
119119
&mut self,
120120
mut extra: FrameData<'tcx>,
121121
unwinding: bool,
122122
) -> InterpResult<'tcx, StackPopJump> {
123123
let this = self.eval_context_mut();
124-
125-
trace!("handle_stack_pop(extra = {:?}, unwinding = {})", extra, unwinding);
126-
if let Some(stacked_borrows) = &this.machine.stacked_borrows {
127-
stacked_borrows.borrow_mut().end_call(extra.call_id);
128-
}
124+
trace!("handle_stack_pop_unwind(extra = {:?}, unwinding = {})", extra, unwinding);
129125

130126
// We only care about `catch_panic` if we're unwinding - if we're doing a normal
131127
// return, then we don't need to do anything special.

0 commit comments

Comments
 (0)