Skip to content

Commit e54619b

Browse files
committed
with this, we support panics on Windows
1 parent 8e92969 commit e54619b

28 files changed

+10
-67
lines changed

src/shims/foreign_items.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,6 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
129129
// This matches calls to the foreign item `panic_impl`.
130130
// The implementation is provided by the function with the `#[panic_handler]` attribute.
131131
"panic_impl" => {
132-
this.check_panic_supported()?;
133132
let panic_impl_id = tcx.lang_items().panic_impl().unwrap();
134133
let panic_impl_instance = ty::Instance::mono(tcx, panic_impl_id);
135134
return Ok(Some(&*this.load_mir(panic_impl_instance.def, None)?));

src/shims/mod.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,6 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
5252
return this.emulate_foreign_item(instance.def_id(), args, ret, unwind);
5353
}
5454

55-
// Better error message for panics on Windows.
56-
let def_id = instance.def_id();
57-
if Some(def_id) == this.tcx.lang_items().begin_panic_fn() ||
58-
Some(def_id) == this.tcx.lang_items().panic_impl()
59-
{
60-
this.check_panic_supported()?;
61-
}
62-
6355
// Otherwise, load the MIR.
6456
Ok(Some(&*this.load_mir(instance.def, None)?))
6557
}

src/shims/panic.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,6 @@ pub struct CatchUnwindData<'tcx> {
3434

3535
impl<'mir, 'tcx: 'mir> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {}
3636
pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx> {
37-
/// Check if panicking is supported on this target, and give a good error otherwise.
38-
fn check_panic_supported(&self) -> InterpResult<'tcx> {
39-
match self.eval_context_ref().tcx.sess.target.target.target_os.as_str() {
40-
"linux" | "macos" => Ok(()),
41-
_ => throw_unsup_format!("panicking is not supported on this target"),
42-
}
43-
}
44-
4537
/// Handles the special `miri_start_panic` intrinsic, which is called
4638
/// by libpanic_unwind to delegate the actual unwinding process to Miri.
4739
fn handle_miri_start_panic(

tests/compile-fail/abort-terminator.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// error-pattern: the evaluated program aborted
2-
// ignore-windows (panics dont work on Windows)
32
#![feature(unwind_attributes)]
43

54
#[unwind(aborts)]

tests/compile-fail/panic/double_panic.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// error-pattern: the evaluated program aborted
2-
// ignore-windows (panics dont work on Windows)
32

43
struct Foo;
54
impl Drop for Foo {

tests/compile-fail/panic/windows1.rs

Lines changed: 0 additions & 9 deletions
This file was deleted.

tests/compile-fail/panic/windows2.rs

Lines changed: 0 additions & 9 deletions
This file was deleted.

tests/compile-fail/panic/windows3.rs

Lines changed: 0 additions & 10 deletions
This file was deleted.

tests/run-pass/panic/catch_panic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
// ignore-windows: Unwind panicking does not currently work on Windows
21
// normalize-stderr-test "[^ ]*libcore/[a-z/]+.rs[0-9:]*" -> "$$LOC"
32
#![feature(never_type)]
43
#![allow(unconditional_panic)]
4+
55
use std::panic::{catch_unwind, AssertUnwindSafe};
66
use std::cell::Cell;
77

tests/run-pass/panic/div-by-zero-2.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// ignore-windows: Unwind panicking does not currently work on Windows
21
#![allow(unconditional_panic)]
32

43
fn main() {

0 commit comments

Comments
 (0)