Skip to content

Commit 510580a

Browse files
committed
Fix tests, move handle_unsupported to helpers
1 parent 291f8de commit 510580a

File tree

7 files changed

+18
-31
lines changed

7 files changed

+18
-31
lines changed

src/helpers.rs

+17
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,23 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
628628
}
629629
Ok(())
630630
}
631+
632+
/// Handler that should be called when unsupported functionality is encountered.
633+
/// This function will either panic within the context of the emulated application
634+
/// or return an error in the Miri process context
635+
///
636+
/// Return value of `Ok(bool)` indicates whether execution should continue.
637+
fn handle_unsupported<S: AsRef<str>>(&mut self, error_msg: S) -> InterpResult<'tcx, ()> {
638+
let this = self.eval_context_mut();
639+
if this.machine.panic_on_unsupported {
640+
// message is slightly different here to make automated analysis easier
641+
let error_msg = format!("unsupported Miri functionality: {}", error_msg.as_ref());
642+
this.start_panic(error_msg.as_ref(), StackPopUnwind::Skip)?;
643+
return Ok(());
644+
} else {
645+
throw_unsup_format!("{}", error_msg.as_ref());
646+
}
647+
}
631648
}
632649

633650
/// Check that the number of args is what we expect.

src/shims/panic.rs

-16
Original file line numberDiff line numberDiff line change
@@ -160,22 +160,6 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
160160
Ok(StackPopJump::Normal)
161161
}
162162
}
163-
164-
/// Handler that should be called when unsupported functionality is encountered.
165-
/// This function will either panic within the context of the emulated application
166-
/// or return an error in the Miri process context
167-
///
168-
/// Return value of `Ok(bool)` indicates whether execution should continue.
169-
fn handle_unsupported<S: AsRef<str>>(&mut self, error_msg: S) -> InterpResult<'tcx, ()> {
170-
if self.eval_context_ref().machine.panic_on_unsupported {
171-
// message is slightly different here to make automated analysis easier
172-
let error_msg = format!("unsupported Miri functionality: {}", error_msg.as_ref());
173-
self.start_panic(error_msg.as_ref(), StackPopUnwind::Skip)?;
174-
return Ok(());
175-
} else {
176-
throw_unsup_format!("{}", error_msg.as_ref());
177-
}
178-
}
179163

180164
/// Start a panic in the interpreter with the given message as payload.
181165
fn start_panic(&mut self, msg: &str, unwind: StackPopUnwind) -> InterpResult<'tcx> {

tests/compile-fail/concurrency/thread-spawn.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
use std::thread;
55

6-
// error-pattern: Miri does not support concurrency on Windows
6+
// error-pattern: can't create threads on Windows
77

88
fn main() {
99
thread::spawn(|| {});

tests/run-pass/concurrency/thread-spawn.rs

-12
This file was deleted.

tests/run-pass/concurrency/thread-spawn.stderr

-2
This file was deleted.

0 commit comments

Comments
 (0)