// This matches calls to the foreign item `panic_impl`.
// The implementation is provided by the function with the `#[panic_handler]` attribute.
"panic_impl" => {
- this.check_panic_supported()?;
let panic_impl_id = tcx.lang_items().panic_impl().unwrap();
let panic_impl_instance = ty::Instance::mono(tcx, panic_impl_id);
return Ok(Some(&*this.load_mir(panic_impl_instance.def, None)?));
return this.emulate_foreign_item(instance.def_id(), args, ret, unwind);
}
- // Better error message for panics on Windows.
- let def_id = instance.def_id();
- if Some(def_id) == this.tcx.lang_items().begin_panic_fn() ||
- Some(def_id) == this.tcx.lang_items().panic_impl()
- {
- this.check_panic_supported()?;
- }
-
// Otherwise, load the MIR.
Ok(Some(&*this.load_mir(instance.def, None)?))
}
impl<'mir, 'tcx: 'mir> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {}
pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx> {
- /// Check if panicking is supported on this target, and give a good error otherwise.
- fn check_panic_supported(&self) -> InterpResult<'tcx> {
- match self.eval_context_ref().tcx.sess.target.target.target_os.as_str() {
- "linux" | "macos" => Ok(()),
- _ => throw_unsup_format!("panicking is not supported on this target"),
- }
- }
-
/// Handles the special `miri_start_panic` intrinsic, which is called
/// by libpanic_unwind to delegate the actual unwinding process to Miri.
fn handle_miri_start_panic(
// error-pattern: the evaluated program aborted
-// ignore-windows (panics dont work on Windows)
#![feature(unwind_attributes)]
#[unwind(aborts)]
// error-pattern: the evaluated program aborted
-// ignore-windows (panics dont work on Windows)
struct Foo;
impl Drop for Foo {
+++ /dev/null
-// ignore-linux
-// ignore-macos
-
-// Test that panics on Windows give a reasonable error message.
-
-// error-pattern: panicking is not supported on this target
-fn main() {
- core::panic!("this is {}", "Windows");
-}
+++ /dev/null
-// ignore-linux
-// ignore-macos
-
-// Test that panics on Windows give a reasonable error message.
-
-// error-pattern: panicking is not supported on this target
-fn main() {
- std::panic!("this is Windows");
-}
+++ /dev/null
-// ignore-linux
-// ignore-macos
-
-// Test that panics on Windows give a reasonable error message.
-
-// error-pattern: panicking is not supported on this target
-#[allow(unconditional_panic)]
-fn main() {
- let _val = 1/0;
-}
-// ignore-windows: Unwind panicking does not currently work on Windows
// normalize-stderr-test "[^ ]*libcore/[a-z/]+.rs[0-9:]*" -> "$$LOC"
#![feature(never_type)]
#![allow(unconditional_panic)]
+
use std::panic::{catch_unwind, AssertUnwindSafe};
use std::cell::Cell;
-// ignore-windows: Unwind panicking does not currently work on Windows
#![allow(unconditional_panic)]
fn main() {
-thread 'main' panicked at 'attempt to divide by zero', $DIR/div-by-zero-2.rs:5:14
+thread 'main' panicked at 'attempt to divide by zero', $DIR/div-by-zero-2.rs:4:14
-// ignore-windows: Unwind panicking does not currently work on Windows
#![allow(arithmetic_overflow)]
fn main() {
-thread 'main' panicked at 'attempt to shift left with overflow', $DIR/overflowing-lsh-neg.rs:5:14
+thread 'main' panicked at 'attempt to shift left with overflow', $DIR/overflowing-lsh-neg.rs:4:14
-// ignore-windows: Unwind panicking does not currently work on Windows
#![allow(arithmetic_overflow)]
fn main() {
-thread 'main' panicked at 'attempt to shift right with overflow', $DIR/overflowing-rsh-1.rs:5:14
+thread 'main' panicked at 'attempt to shift right with overflow', $DIR/overflowing-rsh-1.rs:4:14
-// ignore-windows: Unwind panicking does not currently work on Windows
#![allow(arithmetic_overflow)]
fn main() {
-thread 'main' panicked at 'attempt to shift right with overflow', $DIR/overflowing-rsh-2.rs:6:14
+thread 'main' panicked at 'attempt to shift right with overflow', $DIR/overflowing-rsh-2.rs:5:14
-// ignore-windows: Unwind panicking does not currently work on Windows
fn main() {
std::panic!("panicking from libstd");
}
-thread 'main' panicked at 'panicking from libstd', $DIR/panic1.rs:3:5
+thread 'main' panicked at 'panicking from libstd', $DIR/panic1.rs:2:5
-// ignore-windows: Unwind panicking does not currently work on Windows
fn main() {
std::panic!("{}-panicking from libstd", 42);
}
-thread 'main' panicked at '42-panicking from libstd', $DIR/panic2.rs:3:5
+thread 'main' panicked at '42-panicking from libstd', $DIR/panic2.rs:2:5
-// ignore-windows: Unwind panicking does not currently work on Windows
fn main() {
core::panic!("panicking from libcore");
}
-thread 'main' panicked at 'panicking from libcore', $DIR/panic3.rs:3:5
+thread 'main' panicked at 'panicking from libcore', $DIR/panic3.rs:2:5
-// ignore-windows: Unwind panicking does not currently work on Windows
fn main() {
core::panic!("{}-panicking from libcore", 42);
}
-thread 'main' panicked at '42-panicking from libcore', $DIR/panic4.rs:3:5
+thread 'main' panicked at '42-panicking from libcore', $DIR/panic4.rs:2:5
-// ignore-windows: Unwind panicking does not currently work on Windows
#![feature(option_expect_none, option_unwrap_none)]
//! Test that panic locations for `#[track_caller]` functions in std have the correct
//! location reported.
-// ignore-windows: Unwind panicking does not currently work on Windows
fn main() {
#[cfg(target_pointer_width="64")]
let bad = unsafe {
-thread 'main' panicked at 'index out of bounds: the len is 0 but the index is 0', $DIR/transmute_fat2.rs:12:5
+thread 'main' panicked at 'index out of bounds: the len is 0 but the index is 0', $DIR/transmute_fat2.rs:11:5