Skip to content

Commit 640d372

Browse files
committed
Don't use fmt::Arguments implementation details in assert_unsafe_precondition.
1 parent 90b6588 commit 640d372

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

library/core/src/ub_checks.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ macro_rules! assert_unsafe_precondition {
7070
let msg = concat!("unsafe precondition(s) violated: ", $message,
7171
"\n\nThis indicates a bug in the program. \
7272
This Undefined Behavior check is optional, and cannot be relied on for safety.");
73-
::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::new_const(&[msg]), false);
73+
::core::panicking::panic_nounwind(msg);
7474
}
7575
}
7676

tests/ui/consts/const-eval/ub-slice-get-unchecked.stderr

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ error[E0080]: evaluation panicked: unsafe precondition(s) violated: slice::get_u
44
--> $DIR/ub-slice-get-unchecked.rs:7:27
55
|
66
LL | const B: &[()] = unsafe { A.get_unchecked(3..1) };
7-
| ^^^^^^^^^^^^^^^^^^^^^ evaluation of `B` failed here
7+
| ^^^^^^^^^^^^^^^^^^^^^ evaluation of `B` failed inside this call
8+
|
9+
note: inside `core::panicking::panic_nounwind`
10+
--> $SRC_DIR/core/src/panicking.rs:LL:COL
811

912
error: aborting due to 1 previous error
1013

0 commit comments

Comments
 (0)