From 1044099c196ced6108234fe2450fcd2f7f969fa7 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Wed, 28 Oct 2020 10:48:33 +0100 Subject: [PATCH] disable debug assertions in the standard library --- cargo-miri/bin.rs | 2 ++ tests/run-pass/panic/catch_panic.rs | 1 - tests/run-pass/panic/catch_panic.stderr | 2 -- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/cargo-miri/bin.rs b/cargo-miri/bin.rs index a13e689cad20..6eff5f795e7c 100644 --- a/cargo-miri/bin.rs +++ b/cargo-miri/bin.rs @@ -353,6 +353,8 @@ path = "lib.rs" // to the sysroot either. command.env_remove("RUSTC_WRAPPER"); command.env_remove("RUSTFLAGS"); + // Disable debug assertions in the standard library -- Miri is already slow enough. + command.env("RUSTFLAGS", "-Cdebug-assertions=off"); // Finally run it! if command.status().expect("failed to run xargo").success().not() { show_error(format!("failed to run xargo")); diff --git a/tests/run-pass/panic/catch_panic.rs b/tests/run-pass/panic/catch_panic.rs index 3afff1d36d36..941f79c7ad90 100644 --- a/tests/run-pass/panic/catch_panic.rs +++ b/tests/run-pass/panic/catch_panic.rs @@ -78,7 +78,6 @@ fn main() { // Assertion and debug assertion test(None, |_old_val| { assert!(false); loop {} }); test(None, |_old_val| { debug_assert!(false); loop {} }); - test(None, |_old_val| { unsafe { std::char::from_u32_unchecked(0xFD10000); } loop {} }); // trigger debug-assertion in libstd eprintln!("Success!"); // Make sure we get this in stderr } diff --git a/tests/run-pass/panic/catch_panic.stderr b/tests/run-pass/panic/catch_panic.stderr index c4c04fece901..696dbc1f8181 100644 --- a/tests/run-pass/panic/catch_panic.stderr +++ b/tests/run-pass/panic/catch_panic.stderr @@ -23,6 +23,4 @@ thread 'main' panicked at 'assertion failed: false', $DIR/catch_panic.rs:LL:29 Caught panic message (&str): assertion failed: false thread 'main' panicked at 'assertion failed: false', $DIR/catch_panic.rs:LL:29 Caught panic message (&str): assertion failed: false -thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', $LOC -Caught panic message (&str): called `Option::unwrap()` on a `None` value Success!