Skip to content

Commit

Permalink
Remove panic: prefix in label from builtin macros
Browse files Browse the repository at this point in the history
  • Loading branch information
estebank committed Feb 21, 2025
1 parent ec01ff0 commit 5017674
Show file tree
Hide file tree
Showing 51 changed files with 76 additions and 66 deletions.
12 changes: 11 additions & 1 deletion compiler/rustc_const_eval/src/const_eval/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,17 @@ impl MachineStopType for ConstEvalErrKind {
match self {
ConstAccessesMutGlobal => const_eval_const_accesses_mut_global,
ModifiedGlobal => const_eval_modified_global,
Panic { .. } => const_eval_panic,
Panic { msg, .. } => {
let msg = msg.as_str();
match msg {
"explicit panic"
| "not implemented"
| "not yet implemented"
| "internal error: entered unreachable code" => msg.to_string().into(),
_ if msg.starts_with("assertion failed: ") => msg.to_string().into(),
_ => const_eval_panic,
}
}
RecursiveStatic => const_eval_recursive_static,
AssertFailure(x) => x.diagnostic_message(),
WriteThroughImmutablePointer => const_eval_write_through_immutable_pointer,
Expand Down
2 changes: 1 addition & 1 deletion src/tools/miri/tests/fail/erroneous_const.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0080]: evaluation of `PrintName::<i32>::VOID` failed
--> tests/fail/erroneous_const.rs:LL:CC
|
LL | const VOID: ! = panic!();
| ^^^^^^^^ panic: explicit panic
| ^^^^^^^^ explicit panic
|
= 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)

Expand Down
2 changes: 1 addition & 1 deletion tests/ui/borrowck/issue-81899.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0080]: evaluation of constant value failed
--> $DIR/issue-81899.rs:4:24
|
LL | const _CONST: &[u8] = &f(&[], |_| {});
| ^^^^^^^^^^^^^^ panic: explicit panic
| ^^^^^^^^^^^^^^ explicit panic
|
note: inside `f::<{closure@$DIR/issue-81899.rs:4:31: 4:34}>`
--> $DIR/issue-81899.rs:11:5
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/borrowck/issue-88434-minimal-example.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0080]: evaluation of constant value failed
--> $DIR/issue-88434-minimal-example.rs:3:22
|
LL | const _CONST: &() = &f(&|_| {});
| ^^^^^^^^^^ panic: explicit panic
| ^^^^^^^^^^ explicit panic
|
note: inside `f::<{closure@$DIR/issue-88434-minimal-example.rs:3:25: 3:28}>`
--> $DIR/issue-88434-minimal-example.rs:10:5
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0080]: evaluation of constant value failed
--> $DIR/issue-88434-removal-index-should-be-less.rs:3:24
|
LL | const _CONST: &[u8] = &f(&[], |_| {});
| ^^^^^^^^^^^^^^ panic: explicit panic
| ^^^^^^^^^^^^^^ explicit panic
|
note: inside `f::<{closure@$DIR/issue-88434-removal-index-should-be-less.rs:3:31: 3:34}>`
--> $DIR/issue-88434-removal-index-should-be-less.rs:10:5
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/const-ptr/forbidden_slices.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ error[E0080]: could not evaluate static initializer
--> $DIR/forbidden_slices.rs:50:33
|
LL | pub static R1: &[()] = unsafe { from_ptr_range(ptr::null()..ptr::null()) }; // errors inside libcore
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ panic: assertion failed: 0 < pointee_size && pointee_size <= isize::MAX as usize
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ assertion failed: 0 < pointee_size && pointee_size <= isize::MAX as usize
|
note: inside `from_ptr_range::<'_, ()>`
--> $SRC_DIR/core/src/slice/raw.rs:LL:COL
Expand Down
12 changes: 6 additions & 6 deletions tests/ui/consts/const-eval/const_panic.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,23 @@ error[E0080]: evaluation of constant value failed
--> $DIR/const_panic.rs:9:16
|
LL | const Z2: () = std::panic!();
| ^^^^^^^^^^^^^ panic: explicit panic
| ^^^^^^^^^^^^^ explicit panic
|
= note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `std::panic` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0080]: evaluation of constant value failed
--> $DIR/const_panic.rs:12:15
|
LL | const Y: () = std::unreachable!();
| ^^^^^^^^^^^^^^^^^^^ panic: internal error: entered unreachable code
| ^^^^^^^^^^^^^^^^^^^ internal error: entered unreachable code
|
= note: this error originates in the macro `$crate::panic::unreachable_2015` which comes from the expansion of the macro `std::unreachable` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0080]: evaluation of constant value failed
--> $DIR/const_panic.rs:15:15
|
LL | const X: () = std::unimplemented!();
| ^^^^^^^^^^^^^^^^^^^^^ panic: not implemented
| ^^^^^^^^^^^^^^^^^^^^^ not implemented
|
= note: this error originates in the macro `std::unimplemented` (in Nightly builds, run with -Z macro-backtrace for more info)

Expand Down Expand Up @@ -58,23 +58,23 @@ error[E0080]: evaluation of constant value failed
--> $DIR/const_panic.rs:27:21
|
LL | const Z2_CORE: () = core::panic!();
| ^^^^^^^^^^^^^^ panic: explicit panic
| ^^^^^^^^^^^^^^ explicit panic
|
= note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `core::panic` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0080]: evaluation of constant value failed
--> $DIR/const_panic.rs:30:20
|
LL | const Y_CORE: () = core::unreachable!();
| ^^^^^^^^^^^^^^^^^^^^ panic: internal error: entered unreachable code
| ^^^^^^^^^^^^^^^^^^^^ internal error: entered unreachable code
|
= note: this error originates in the macro `$crate::panic::unreachable_2015` which comes from the expansion of the macro `core::unreachable` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0080]: evaluation of constant value failed
--> $DIR/const_panic.rs:33:20
|
LL | const X_CORE: () = core::unimplemented!();
| ^^^^^^^^^^^^^^^^^^^^^^ panic: not implemented
| ^^^^^^^^^^^^^^^^^^^^^^ not implemented
|
= note: this error originates in the macro `core::unimplemented` (in Nightly builds, run with -Z macro-backtrace for more info)

Expand Down
12 changes: 6 additions & 6 deletions tests/ui/consts/const-eval/const_panic_2021.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,23 @@ error[E0080]: evaluation of constant value failed
--> $DIR/const_panic_2021.rs:9:15
|
LL | const B: () = std::panic!();
| ^^^^^^^^^^^^^ panic: explicit panic
| ^^^^^^^^^^^^^ explicit panic
|
= note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `std::panic` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0080]: evaluation of constant value failed
--> $DIR/const_panic_2021.rs:12:15
|
LL | const C: () = std::unreachable!();
| ^^^^^^^^^^^^^^^^^^^ panic: internal error: entered unreachable code
| ^^^^^^^^^^^^^^^^^^^ internal error: entered unreachable code
|
= note: this error originates in the macro `$crate::panic::unreachable_2021` which comes from the expansion of the macro `std::unreachable` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0080]: evaluation of constant value failed
--> $DIR/const_panic_2021.rs:15:15
|
LL | const D: () = std::unimplemented!();
| ^^^^^^^^^^^^^^^^^^^^^ panic: not implemented
| ^^^^^^^^^^^^^^^^^^^^^ not implemented
|
= note: this error originates in the macro `std::unimplemented` (in Nightly builds, run with -Z macro-backtrace for more info)

Expand All @@ -50,23 +50,23 @@ error[E0080]: evaluation of constant value failed
--> $DIR/const_panic_2021.rs:24:20
|
LL | const B_CORE: () = core::panic!();
| ^^^^^^^^^^^^^^ panic: explicit panic
| ^^^^^^^^^^^^^^ explicit panic
|
= note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `core::panic` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0080]: evaluation of constant value failed
--> $DIR/const_panic_2021.rs:27:20
|
LL | const C_CORE: () = core::unreachable!();
| ^^^^^^^^^^^^^^^^^^^^ panic: internal error: entered unreachable code
| ^^^^^^^^^^^^^^^^^^^^ internal error: entered unreachable code
|
= note: this error originates in the macro `$crate::panic::unreachable_2021` which comes from the expansion of the macro `core::unreachable` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0080]: evaluation of constant value failed
--> $DIR/const_panic_2021.rs:30:20
|
LL | const D_CORE: () = core::unimplemented!();
| ^^^^^^^^^^^^^^^^^^^^^^ panic: not implemented
| ^^^^^^^^^^^^^^^^^^^^^^ not implemented
|
= note: this error originates in the macro `core::unimplemented` (in Nightly builds, run with -Z macro-backtrace for more info)

Expand Down
4 changes: 2 additions & 2 deletions tests/ui/consts/const-eval/const_panic_libcore_bin.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ error[E0080]: evaluation of constant value failed
--> $DIR/const_panic_libcore_bin.rs:11:15
|
LL | const Y: () = unreachable!();
| ^^^^^^^^^^^^^^ panic: internal error: entered unreachable code
| ^^^^^^^^^^^^^^ internal error: entered unreachable code
|
= note: this error originates in the macro `$crate::panic::unreachable_2015` which comes from the expansion of the macro `unreachable` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0080]: evaluation of constant value failed
--> $DIR/const_panic_libcore_bin.rs:14:15
|
LL | const X: () = unimplemented!();
| ^^^^^^^^^^^^^^^^ panic: not implemented
| ^^^^^^^^^^^^^^^^ not implemented
|
= note: this error originates in the macro `unimplemented` (in Nightly builds, run with -Z macro-backtrace for more info)

Expand Down
2 changes: 1 addition & 1 deletion tests/ui/consts/const-eval/panic-assoc-never-type.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0080]: evaluation of constant value failed
--> $DIR/panic-assoc-never-type.rs:9:21
|
LL | const VOID: ! = panic!();
| ^^^^^^^^ panic: explicit panic
| ^^^^^^^^ explicit panic
|
= note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)

Expand Down
2 changes: 1 addition & 1 deletion tests/ui/consts/const-eval/panic-never-type.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0080]: evaluation of constant value failed
--> $DIR/panic-never-type.rs:4:17
|
LL | const VOID: ! = panic!();
| ^^^^^^^^ panic: explicit panic
| ^^^^^^^^ explicit panic
|
= note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)

Expand Down
2 changes: 1 addition & 1 deletion tests/ui/consts/const-eval/unwind-abort.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0080]: evaluation of constant value failed
--> $DIR/unwind-abort.rs:5:15
|
LL | const _: () = foo();
| ^^^^^ panic: explicit panic
| ^^^^^ explicit panic
|
note: inside `foo`
--> $DIR/unwind-abort.rs:2:5
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/consts/control-flow/assert.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0080]: evaluation of constant value failed
--> $DIR/assert.rs:5:15
|
LL | const _: () = assert!(false);
| ^^^^^^^^^^^^^^ panic: assertion failed: false
| ^^^^^^^^^^^^^^ assertion failed: false
|
= note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info)

Expand Down
2 changes: 1 addition & 1 deletion tests/ui/consts/issue-66693-panic-in-array-len.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ error[E0080]: evaluation of constant value failed
--> $DIR/issue-66693-panic-in-array-len.rs:10:21
|
LL | let _ = [false; panic!()];
| ^^^^^^^^ panic: explicit panic
| ^^^^^^^^ explicit panic
|
= note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)

Expand Down
2 changes: 1 addition & 1 deletion tests/ui/consts/issue-66693.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ error[E0080]: evaluation of constant value failed
--> $DIR/issue-66693.rs:16:15
|
LL | const _: () = panic!();
| ^^^^^^^^ panic: explicit panic
| ^^^^^^^^ explicit panic
|
= note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0080]: evaluation of `Fail::<i32>::C` failed
--> $DIR/collect-in-called-fn.rs:10:19
|
LL | const C: () = panic!();
| ^^^^^^^^ panic: explicit panic
| ^^^^^^^^ explicit panic
|
= note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0080]: evaluation of `Fail::<i32>::C` failed
--> $DIR/collect-in-called-fn.rs:10:19
|
LL | const C: () = panic!();
| ^^^^^^^^ panic: explicit panic
| ^^^^^^^^ explicit panic
|
= note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0080]: evaluation of `Fail::<i32>::C` failed
--> $DIR/collect-in-dead-closure.rs:9:19
|
LL | const C: () = panic!();
| ^^^^^^^^ panic: explicit panic
| ^^^^^^^^ explicit panic
|
= note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0080]: evaluation of `Fail::<i32>::C` failed
--> $DIR/collect-in-dead-closure.rs:9:19
|
LL | const C: () = panic!();
| ^^^^^^^^ panic: explicit panic
| ^^^^^^^^ explicit panic
|
= note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0080]: evaluation of `Fail::<i32>::C` failed
--> $DIR/collect-in-dead-drop.rs:9:19
|
LL | const C: () = panic!();
| ^^^^^^^^ panic: explicit panic
| ^^^^^^^^ explicit panic
|
= note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0080]: evaluation of `Fail::<i32>::C` failed
--> $DIR/collect-in-dead-drop.rs:9:19
|
LL | const C: () = panic!();
| ^^^^^^^^ panic: explicit panic
| ^^^^^^^^ explicit panic
|
= note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0080]: evaluation of `Fail::<i32>::C` failed
--> $DIR/collect-in-dead-fn-behind-assoc-type.rs:10:19
|
LL | const C: () = panic!();
| ^^^^^^^^ panic: explicit panic
| ^^^^^^^^ explicit panic
|
= note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0080]: evaluation of `Fail::<i32>::C` failed
--> $DIR/collect-in-dead-fn-behind-assoc-type.rs:10:19
|
LL | const C: () = panic!();
| ^^^^^^^^ panic: explicit panic
| ^^^^^^^^ explicit panic
|
= note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0080]: evaluation of `Fail::<i32>::C` failed
--> $DIR/collect-in-dead-fn-behind-generic.rs:9:19
|
LL | const C: () = panic!();
| ^^^^^^^^ panic: explicit panic
| ^^^^^^^^ explicit panic
|
= note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0080]: evaluation of `Fail::<i32>::C` failed
--> $DIR/collect-in-dead-fn-behind-generic.rs:9:19
|
LL | const C: () = panic!();
| ^^^^^^^^ panic: explicit panic
| ^^^^^^^^ explicit panic
|
= note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0080]: evaluation of `m::Fail::<i32>::C` failed
--> $DIR/collect-in-dead-fn-behind-opaque-type.rs:11:23
|
LL | const C: () = panic!();
| ^^^^^^^^ panic: explicit panic
| ^^^^^^^^ explicit panic
|
= note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0080]: evaluation of `m::Fail::<i32>::C` failed
--> $DIR/collect-in-dead-fn-behind-opaque-type.rs:11:23
|
LL | const C: () = panic!();
| ^^^^^^^^ panic: explicit panic
| ^^^^^^^^ explicit panic
|
= note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0080]: evaluation of `Fail::<i32>::C` failed
--> $DIR/collect-in-dead-fn.rs:9:19
|
LL | const C: () = panic!();
| ^^^^^^^^ panic: explicit panic
| ^^^^^^^^ explicit panic
|
= note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0080]: evaluation of `Fail::<i32>::C` failed
--> $DIR/collect-in-dead-fn.rs:9:19
|
LL | const C: () = panic!();
| ^^^^^^^^ panic: explicit panic
| ^^^^^^^^ explicit panic
|
= note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0080]: evaluation of `Late::<i32>::FAIL` failed
--> $DIR/collect-in-dead-fnptr-in-const.rs:9:22
|
LL | const FAIL: () = panic!();
| ^^^^^^^^ panic: explicit panic
| ^^^^^^^^ explicit panic
|
= note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0080]: evaluation of `Late::<i32>::FAIL` failed
--> $DIR/collect-in-dead-fnptr-in-const.rs:9:22
|
LL | const FAIL: () = panic!();
| ^^^^^^^^ panic: explicit panic
| ^^^^^^^^ explicit panic
|
= note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0080]: evaluation of `Fail::<i32>::C` failed
--> $DIR/collect-in-dead-fnptr.rs:9:19
|
LL | const C: () = panic!();
| ^^^^^^^^ panic: explicit panic
| ^^^^^^^^ explicit panic
|
= note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)

Expand Down
Loading

0 comments on commit 5017674

Please sign in to comment.