Closed
Description
Consider this code:
struct S<T>(T);
const fn oopsie() -> ! {
panic!();
}
impl<T> S<T> {
const C1: i32 = panic!();
const C2: i32 = oopsie();
}
fn main() {
S::<i32>::C1; // or C2
}
If we use C1
, we get the following:
error[E0080]: evaluation of `S::<i32>::C1` failed
--> src/main.rs:8:21
|
8 | const C1: i32 = panic!();
| ^^^^^^^^ evaluation panicked: explicit panic
But if we use C2
, we get:
error[E0080]: evaluation of `oopsie` failed
--> src/main.rs:9:21
|
9 | const C2: i32 = oopsie();
| ^^^^^^^^ evaluation panicked: explicit panic
|
note: inside `oopsie`
--> src/main.rs:4:5
|
4 | panic!();
| ^^^^^^^^ the failure occurred here
Note that it says "evaluation of oopsie
failed"; I would have expected "evaluation of S::<i32>::C2
failed". That's where the span points at, too.
Cc @oli-obk