diff --git a/src/test/ui/consts/const-eval/issue-50814.rs b/src/test/ui/consts/const-eval/issue-50814.rs index 5a587701f78..e3f0fb90c8f 100644 --- a/src/test/ui/consts/const-eval/issue-50814.rs +++ b/src/test/ui/consts/const-eval/issue-50814.rs @@ -9,16 +9,18 @@ impl Unsigned for U8 { const MAX: u8 = 0xff; } -struct Sum(A,B); +struct Sum(A, B); -impl Unsigned for Sum { +impl Unsigned for Sum { const MAX: u8 = A::MAX + B::MAX; //~^ ERROR evaluation of ` as Unsigned>::MAX` failed + //~| ERROR evaluation of ` as Unsigned>::MAX` failed } fn foo(_: T) -> &'static u8 { - &Sum::::MAX - //~^ ERROR E0080 + &Sum::::MAX + //~^ ERROR evaluation of `foo::` failed [E0080] + //~| ERROR evaluation of `foo::` failed [E0080] } fn main() { diff --git a/src/test/ui/consts/const-eval/issue-50814.stderr b/src/test/ui/consts/const-eval/issue-50814.stderr index 46dd2b89fa2..07f3033c44f 100644 --- a/src/test/ui/consts/const-eval/issue-50814.stderr +++ b/src/test/ui/consts/const-eval/issue-50814.stderr @@ -4,18 +4,30 @@ error[E0080]: evaluation of ` as Unsigned>::MAX` failed LL | const MAX: u8 = A::MAX + B::MAX; | ^^^^^^^^^^^^^^^ attempt to compute `u8::MAX + u8::MAX`, which would overflow +error[E0080]: evaluation of `foo::` failed + --> $DIR/issue-50814.rs:21:6 + | +LL | &Sum::::MAX + | ^^^^^^^^^^^^^^^^^^ referenced constant has errors + +error[E0080]: evaluation of ` as Unsigned>::MAX` failed + --> $DIR/issue-50814.rs:15:21 + | +LL | const MAX: u8 = A::MAX + B::MAX; + | ^^^^^^^^^^^^^^^ attempt to compute `u8::MAX + u8::MAX`, which would overflow + error[E0080]: evaluation of `foo::` failed - --> $DIR/issue-50814.rs:20:6 + --> $DIR/issue-50814.rs:21:6 | -LL | &Sum::::MAX - | ^^^^^^^^^^^^^^^^^ referenced constant has errors +LL | &Sum::::MAX + | ^^^^^^^^^^^^^^^^^^ referenced constant has errors note: the above error was encountered while instantiating `fn foo::` - --> $DIR/issue-50814.rs:25:5 + --> $DIR/issue-50814.rs:27:5 | LL | foo(0); | ^^^^^^ -error: aborting due to 2 previous errors +error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0080`.