Skip to content

Commit 810a3c7

Browse files
committed
don't point at const usage site for resolution-time errors
also share the code that emits the actual error
1 parent 618dbfa commit 810a3c7

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

tests/fail/const-ub-checks.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0080]: evaluation of constant value failed
44
LL | ptr.read();
55
| ^^^^^^^^^^ accessing memory with alignment ALIGN, but alignment ALIGN is required
66

7-
note: erroneous constant used
7+
note: erroneous constant encountered
88
--> $DIR/const-ub-checks.rs:LL:CC
99
|
1010
LL | let _x = UNALIGNED_READ;

tests/fail/erroneous_const.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ LL | const VOID: ! = 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

9-
note: erroneous constant used
9+
note: erroneous constant encountered
1010
--> $DIR/erroneous_const.rs:LL:CC
1111
|
1212
LL | let _ = PrintName::<T>::VOID;

tests/fail/erroneous_const2.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ error[E0080]: evaluation of constant value failed
44
LL | const FOO: u32 = [X - Y, Y - X][(X < Y) as usize];
55
| ^^^^^ attempt to compute `5_u32 - 6_u32`, which would overflow
66

7-
note: erroneous constant used
7+
note: erroneous constant encountered
88
--> $DIR/erroneous_const2.rs:LL:CC
99
|
1010
LL | println!("{}", FOO);
1111
| ^^^
1212

13-
note: erroneous constant used
13+
note: erroneous constant encountered
1414
--> $DIR/erroneous_const2.rs:LL:CC
1515
|
1616
LL | println!("{}", FOO);

0 commit comments

Comments
 (0)