Skip to content

Commit 0f1713f

Browse files
committed
whitelist platforms where panicking should work
1 parent 0ff05c4 commit 0f1713f

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/shims/foreign_items.rs

+6
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,12 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
132132
// This matches calls to the foreign item `panic_impl`.
133133
// The implementation is provided by the function with the `#[panic_handler]` attribute.
134134
"panic_impl" => {
135+
// Make sure panicking actually works on this platform.
136+
match this.tcx.sess.target.target.target_os.as_str() {
137+
"linux" | "macos" => {},
138+
_ => throw_unsup_format!("panicking is not supported on this platform"),
139+
}
140+
135141
let panic_impl_id = this.tcx.lang_items().panic_impl().unwrap();
136142
let panic_impl_instance = ty::Instance::mono(*this.tcx, panic_impl_id);
137143
return Ok(Some(&*this.load_mir(panic_impl_instance.def, None)?));

0 commit comments

Comments
 (0)