Skip to content

Commit 6d8627e

Browse files
committedFeb 28, 2025
Remove panic: prefix in label from builtin macros
1 parent c79f0ec commit 6d8627e

File tree

51 files changed

+76
-66
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+76
-66
lines changed
 

‎compiler/rustc_const_eval/src/const_eval/error.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,17 @@ impl MachineStopType for ConstEvalErrKind {
3434
match self {
3535
ConstAccessesMutGlobal => const_eval_const_accesses_mut_global,
3636
ModifiedGlobal => const_eval_modified_global,
37-
Panic { .. } => const_eval_panic,
37+
Panic { msg, .. } => {
38+
let msg = msg.as_str();
39+
match msg {
40+
"explicit panic"
41+
| "not implemented"
42+
| "not yet implemented"
43+
| "internal error: entered unreachable code" => msg.to_string().into(),
44+
_ if msg.starts_with("assertion failed: ") => msg.to_string().into(),
45+
_ => const_eval_panic,
46+
}
47+
}
3848
RecursiveStatic => const_eval_recursive_static,
3949
AssertFailure(x) => x.diagnostic_message(),
4050
WriteThroughImmutablePointer => const_eval_write_through_immutable_pointer,

‎src/tools/miri/tests/fail/erroneous_const.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0080]: evaluation of `PrintName::<i32>::VOID` failed
22
--> tests/fail/erroneous_const.rs:LL:CC
33
|
44
LL | const VOID: ! = panic!();
5-
| ^^^^^^^^ panic: explicit panic
5+
| ^^^^^^^^ explicit panic
66
|
77
= note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
88

0 commit comments

Comments
 (0)