mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-27 18:56:24 +00:00

Previously, we included a redundant prefix on the panic message and a postfix of the location of the panic. The prefix didn't carry any additional information beyond "something failed", and the location of the panic is redundant with the diagnostic's span, which gets printed out even if its code is not shown. ``` error[E0080]: evaluation of constant value failed --> $DIR/assert-type-intrinsics.rs:11:9 | LL | MaybeUninit::<!>::uninit().assume_init(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation panicked: aborted execution: attempted to instantiate uninhabited type `!` ``` ``` error[E0080]: evaluation of `Fail::<i32>::C` failed --> $DIR/collect-in-dead-closure.rs:9:19 | LL | const C: () = panic!(); | ^^^^^^^^ evaluation panicked: 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) ``` ``` error[E0080]: evaluation of constant value failed --> $DIR/uninhabited.rs:41:9 | LL | assert!(false); | ^^^^^^^^^^^^^^ evaluation panicked: assertion failed: false | = note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info) ``` --- When the primary span for a const error is the same as the first frame in the const error report, skip it. ``` error[E0080]: evaluation of constant value failed --> $DIR/issue-88434-removal-index-should-be-less.rs:3:24 | LL | const _CONST: &[u8] = &f(&[], |_| {}); | ^^^^^^^^^^^^^^ evaluation panicked: 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 | LL | panic!() | ^^^^^^^^ the failure occurred here = 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) ``` instead of ``` error[E0080]: evaluation of constant value failed --> $DIR/issue-88434-removal-index-should-be-less.rs:10:5 | LL | 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 | LL | panic!() | ^^^^^^^^ note: inside `_CONST` --> $DIR/issue-88434-removal-index-should-be-less.rs:3:24 | LL | const _CONST: &[u8] = &f(&[], |_| {}); | ^^^^^^^^^^^^^^ = 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) ``` --- Revert order of constant evaluation errors Point at the code the user wrote first and std functions last. ``` error[E0080]: evaluation of constant value failed --> $DIR/const-errs-dont-conflict-103369.rs:5:25 | LL | impl ConstGenericTrait<{my_fn(1)}> for () {} | ^^^^^^^^ evaluation panicked: Some error occurred | note: called from `my_fn` --> $DIR/const-errs-dont-conflict-103369.rs:10:5 | LL | panic!("Some error occurred"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = 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) ``` instead of ``` error[E0080]: evaluation of constant value failed --> $DIR/const-errs-dont-conflict-103369.rs:10:5 | LL | panic!("Some error occurred"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Some error occurred | note: called from `<() as ConstGenericTrait<{my_fn(1)}>>::{constant#0}` --> $DIR/const-errs-dont-conflict-103369.rs:5:25 | LL | impl ConstGenericTrait<{my_fn(1)}> for () {} | ^^^^^^^^ = 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) ```
97 lines
4.5 KiB
Plaintext
97 lines
4.5 KiB
Plaintext
error[E0080]: evaluation of constant value failed
|
|
--> $DIR/offset_from_ub.rs:18:27
|
|
|
|
|
LL | let offset = unsafe { ptr_offset_from(field_ptr, base_ptr) };
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `ptr_offset_from` called on two different pointers that are not both derived from the same allocation
|
|
|
|
error[E0080]: evaluation of constant value failed
|
|
--> $DIR/offset_from_ub.rs:24:14
|
|
|
|
|
LL | unsafe { (42 as *const u8).offset_from(&5u8) as usize }
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `ptr_offset_from` called on two different pointers that are not both derived from the same allocation
|
|
|
|
|
note: inside `std::ptr::const_ptr::<impl *const u8>::offset_from`
|
|
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
|
|
|
|
error[E0080]: evaluation of constant value failed
|
|
--> $DIR/offset_from_ub.rs:31:14
|
|
|
|
|
LL | unsafe { ptr_offset_from(field_ptr, base_ptr as *const u16) }
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ exact_div: 1_isize cannot be divided by 2_isize without remainder
|
|
|
|
error[E0080]: evaluation of constant value failed
|
|
--> $DIR/offset_from_ub.rs:38:14
|
|
|
|
|
LL | unsafe { ptr_offset_from(ptr2, ptr1) }
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `ptr_offset_from` called on two different pointers that are not both derived from the same allocation
|
|
|
|
error[E0080]: evaluation of constant value failed
|
|
--> $DIR/offset_from_ub.rs:47:14
|
|
|
|
|
LL | unsafe { ptr_offset_from(end_ptr, start_ptr) }
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `ptr_offset_from` called on two different pointers where the memory range between them is not in-bounds of an allocation
|
|
|
|
error[E0080]: evaluation of constant value failed
|
|
--> $DIR/offset_from_ub.rs:56:14
|
|
|
|
|
LL | unsafe { ptr_offset_from(start_ptr, end_ptr) }
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `ptr_offset_from` called on two different pointers where the memory range between them is not in-bounds of an allocation
|
|
|
|
error[E0080]: evaluation of constant value failed
|
|
--> $DIR/offset_from_ub.rs:65:14
|
|
|
|
|
LL | unsafe { ptr_offset_from_unsigned(field_ptr, base_ptr) }
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `ptr_offset_from_unsigned` called on two different pointers that are not both derived from the same allocation
|
|
|
|
error[E0080]: evaluation of constant value failed
|
|
--> $DIR/offset_from_ub.rs:72:14
|
|
|
|
|
LL | unsafe { ptr_offset_from(ptr2, ptr1) }
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `ptr_offset_from` called when first pointer is too far ahead of second
|
|
|
|
error[E0080]: evaluation of constant value failed
|
|
--> $DIR/offset_from_ub.rs:78:14
|
|
|
|
|
LL | unsafe { ptr_offset_from(ptr1, ptr2) }
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `ptr_offset_from` called when first pointer is too far before second
|
|
|
|
error[E0080]: evaluation of constant value failed
|
|
--> $DIR/offset_from_ub.rs:86:14
|
|
|
|
|
LL | unsafe { ptr_offset_from(ptr1, ptr2) }
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `ptr_offset_from` called when first pointer is too far before second
|
|
|
|
error[E0080]: evaluation of constant value failed
|
|
--> $DIR/offset_from_ub.rs:93:14
|
|
|
|
|
LL | unsafe { ptr_offset_from_unsigned(p, p.add(2) ) }
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `ptr_offset_from_unsigned` called when first pointer has smaller offset than second: 0 < 8
|
|
|
|
error[E0080]: evaluation of constant value failed
|
|
--> $DIR/offset_from_ub.rs:100:14
|
|
|
|
|
LL | unsafe { ptr_offset_from_unsigned(ptr2, ptr1) }
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `ptr_offset_from_unsigned` called when first pointer is too far ahead of second
|
|
|
|
error[E0080]: evaluation of constant value failed
|
|
--> $DIR/offset_from_ub.rs:109:14
|
|
|
|
|
LL | unsafe { ptr2.offset_from(ptr1) }
|
|
| ^^^^^^^^^^^^^^^^^^^^^^ `ptr_offset_from` called on two different pointers that are not both derived from the same allocation
|
|
|
|
|
note: inside `std::ptr::const_ptr::<impl *const u8>::offset_from`
|
|
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
|
|
|
|
error[E0080]: evaluation of constant value failed
|
|
--> $DIR/offset_from_ub.rs:115:14
|
|
|
|
|
LL | unsafe { ptr1.offset_from(ptr2.wrapping_offset(1)) }
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `ptr_offset_from` called when first pointer is too far before second
|
|
|
|
|
note: inside `std::ptr::const_ptr::<impl *const u8>::offset_from`
|
|
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
|
|
|
|
error: aborting due to 14 previous errors
|
|
|
|
For more information about this error, try `rustc --explain E0080`.
|