diff --git a/library/core/src/ub_checks.rs b/library/core/src/ub_checks.rs index 514ff93c9820e..f96bcd92085e8 100644 --- a/library/core/src/ub_checks.rs +++ b/library/core/src/ub_checks.rs @@ -70,7 +70,7 @@ macro_rules! assert_unsafe_precondition { let msg = concat!("unsafe precondition(s) violated: ", $message, "\n\nThis indicates a bug in the program. \ This Undefined Behavior check is optional, and cannot be relied on for safety."); - ::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::new_const(&[msg]), false); + ::core::panicking::panic_nounwind(msg); } } diff --git a/tests/ui/consts/const-eval/ub-slice-get-unchecked.stderr b/tests/ui/consts/const-eval/ub-slice-get-unchecked.stderr index 88ea310f19c68..5cd3c0d8b539e 100644 --- a/tests/ui/consts/const-eval/ub-slice-get-unchecked.stderr +++ b/tests/ui/consts/const-eval/ub-slice-get-unchecked.stderr @@ -4,7 +4,10 @@ error[E0080]: evaluation panicked: unsafe precondition(s) violated: slice::get_u --> $DIR/ub-slice-get-unchecked.rs:7:27 | LL | const B: &[()] = unsafe { A.get_unchecked(3..1) }; - | ^^^^^^^^^^^^^^^^^^^^^ evaluation of `B` failed here + | ^^^^^^^^^^^^^^^^^^^^^ evaluation of `B` failed inside this call + | +note: inside `core::panicking::panic_nounwind` + --> $SRC_DIR/core/src/panicking.rs:LL:COL error: aborting due to 1 previous error