diff options
Diffstat (limited to 'src/test')
22 files changed, 110 insertions, 194 deletions
diff --git a/src/test/compile-fail/const-err-early.rs b/src/test/compile-fail/const-err-early.rs index 92c6b1fd0b5..39b1b342eac 100644 --- a/src/test/compile-fail/const-err-early.rs +++ b/src/test/compile-fail/const-err-early.rs @@ -11,16 +11,10 @@ #![deny(const_err)] pub const A: i8 = -std::i8::MIN; //~ ERROR const_err -//~^ ERROR this constant cannot be used -//~| ERROR this expression will panic at runtime pub const B: u8 = 200u8 + 200u8; //~ ERROR const_err -//~^ ERROR this constant cannot be used pub const C: u8 = 200u8 * 4; //~ ERROR const_err -//~^ ERROR this constant cannot be used pub const D: u8 = 42u8 - (42u8 + 1); //~ ERROR const_err -//~^ ERROR this constant cannot be used pub const E: u8 = [5u8][1]; //~ ERROR const_err -//~| ERROR this constant cannot be used fn main() { let _a = A; diff --git a/src/test/compile-fail/const-err-multi.rs b/src/test/compile-fail/const-err-multi.rs index 4a5e78b381e..f2ee8a7078c 100644 --- a/src/test/compile-fail/const-err-multi.rs +++ b/src/test/compile-fail/const-err-multi.rs @@ -11,10 +11,7 @@ #![deny(const_err)] pub const A: i8 = -std::i8::MIN; -//~^ ERROR E0080 -//~| ERROR attempt to negate with overflow -//~| ERROR this expression will panic at runtime -//~| ERROR this constant cannot be used +//~^ ERROR this constant cannot be used pub const B: i8 = A; //~^ ERROR const_err //~| ERROR const_err diff --git a/src/test/compile-fail/const-err.rs b/src/test/compile-fail/const-err.rs index f77603b3eba..8683f6a0231 100644 --- a/src/test/compile-fail/const-err.rs +++ b/src/test/compile-fail/const-err.rs @@ -23,9 +23,10 @@ fn black_box<T>(_: T) { // Make sure that the two uses get two errors. const FOO: u8 = [5u8][1]; //~^ ERROR constant evaluation error -//~| ERROR constant evaluation error //~| index out of bounds: the len is 1 but the index is 1 fn main() { black_box((FOO, FOO)); + //~^ ERROR referenced constant has errors + //~| ERROR could not evaluate constant } diff --git a/src/test/compile-fail/const-eval-overflow2.rs b/src/test/compile-fail/const-eval-overflow2.rs index 7b5db7a4f6d..88fc5182775 100644 --- a/src/test/compile-fail/const-eval-overflow2.rs +++ b/src/test/compile-fail/const-eval-overflow2.rs @@ -25,54 +25,46 @@ const VALS_I8: (i8,) = //~^ ERROR this constant cannot be used ( i8::MIN - 1, - //~^ ERROR attempt to subtract with overflow ); const VALS_I16: (i16,) = //~^ ERROR this constant cannot be used ( i16::MIN - 1, - //~^ ERROR attempt to subtract with overflow ); const VALS_I32: (i32,) = //~^ ERROR this constant cannot be used ( i32::MIN - 1, - //~^ ERROR attempt to subtract with overflow ); const VALS_I64: (i64,) = //~^ ERROR this constant cannot be used ( i64::MIN - 1, - //~^ ERROR attempt to subtract with overflow ); const VALS_U8: (u8,) = //~^ ERROR this constant cannot be used ( u8::MIN - 1, - //~^ ERROR attempt to subtract with overflow ); const VALS_U16: (u16,) = ( //~^ ERROR this constant cannot be used u16::MIN - 1, - //~^ ERROR attempt to subtract with overflow ); const VALS_U32: (u32,) = ( //~^ ERROR this constant cannot be used u32::MIN - 1, - //~^ ERROR attempt to subtract with overflow ); const VALS_U64: (u64,) = //~^ ERROR this constant cannot be used ( u64::MIN - 1, - //~^ ERROR attempt to subtract with overflow ); fn main() { diff --git a/src/test/compile-fail/const-eval-overflow2b.rs b/src/test/compile-fail/const-eval-overflow2b.rs index ce4dc72555d..1878daea931 100644 --- a/src/test/compile-fail/const-eval-overflow2b.rs +++ b/src/test/compile-fail/const-eval-overflow2b.rs @@ -25,54 +25,46 @@ const VALS_I8: (i8,) = //~^ ERROR this constant cannot be used ( i8::MAX + 1, - //~^ ERROR attempt to add with overflow ); const VALS_I16: (i16,) = //~^ ERROR this constant cannot be used ( i16::MAX + 1, - //~^ ERROR attempt to add with overflow ); const VALS_I32: (i32,) = //~^ ERROR this constant cannot be used ( i32::MAX + 1, - //~^ ERROR attempt to add with overflow ); const VALS_I64: (i64,) = //~^ ERROR this constant cannot be used ( i64::MAX + 1, - //~^ ERROR attempt to add with overflow ); const VALS_U8: (u8,) = //~^ ERROR this constant cannot be used ( u8::MAX + 1, - //~^ ERROR attempt to add with overflow ); const VALS_U16: (u16,) = ( //~^ ERROR this constant cannot be used u16::MAX + 1, - //~^ ERROR attempt to add with overflow ); const VALS_U32: (u32,) = ( //~^ ERROR this constant cannot be used u32::MAX + 1, - //~^ ERROR attempt to add with overflow ); const VALS_U64: (u64,) = //~^ ERROR this constant cannot be used ( u64::MAX + 1, - //~^ ERROR attempt to add with overflow ); fn main() { diff --git a/src/test/compile-fail/const-eval-overflow2c.rs b/src/test/compile-fail/const-eval-overflow2c.rs index 88eb14a1330..f3d28295bf8 100644 --- a/src/test/compile-fail/const-eval-overflow2c.rs +++ b/src/test/compile-fail/const-eval-overflow2c.rs @@ -25,54 +25,46 @@ const VALS_I8: (i8,) = //~^ ERROR this constant cannot be used ( i8::MIN * 2, - //~^ ERROR attempt to multiply with overflow ); const VALS_I16: (i16,) = //~^ ERROR this constant cannot be used ( i16::MIN * 2, - //~^ ERROR attempt to multiply with overflow ); const VALS_I32: (i32,) = //~^ ERROR this constant cannot be used ( i32::MIN * 2, - //~^ ERROR attempt to multiply with overflow ); const VALS_I64: (i64,) = //~^ ERROR this constant cannot be used ( i64::MIN * 2, - //~^ ERROR attempt to multiply with overflow ); const VALS_U8: (u8,) = //~^ ERROR this constant cannot be used ( u8::MAX * 2, - //~^ ERROR attempt to multiply with overflow ); const VALS_U16: (u16,) = ( //~^ ERROR this constant cannot be used u16::MAX * 2, - //~^ ERROR attempt to multiply with overflow ); const VALS_U32: (u32,) = ( //~^ ERROR this constant cannot be used u32::MAX * 2, - //~^ ERROR attempt to multiply with overflow ); const VALS_U64: (u64,) = //~^ ERROR this constant cannot be used ( u64::MAX * 2, - //~^ ERROR attempt to multiply with overflow ); fn main() { diff --git a/src/test/ui/const-eval/conditional_array_execution.nll.stderr b/src/test/ui/const-eval/conditional_array_execution.nll.stderr index 3580950854d..8bc302a2bef 100644 --- a/src/test/ui/const-eval/conditional_array_execution.nll.stderr +++ b/src/test/ui/const-eval/conditional_array_execution.nll.stderr @@ -1,8 +1,10 @@ -warning: attempt to subtract with overflow - --> $DIR/conditional_array_execution.rs:15:19 +warning: this constant cannot be used + --> $DIR/conditional_array_execution.rs:15:1 | LL | const FOO: u32 = [X - Y, Y - X][(X < Y) as usize]; - | ^^^^^ + | ^^^^^^^^^^^^^^^^^^-----^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | | + | attempt to subtract with overflow | note: lint level defined here --> $DIR/conditional_array_execution.rs:11:9 @@ -10,16 +12,8 @@ note: lint level defined here LL | #![warn(const_err)] | ^^^^^^^^^ -warning: this constant cannot be used - --> $DIR/conditional_array_execution.rs:15:1 - | -LL | const FOO: u32 = [X - Y, Y - X][(X < Y) as usize]; - | ^^^^^^^^^^^^^^^^^^-----^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | attempt to subtract with overflow - -warning: referenced constant - --> $DIR/conditional_array_execution.rs:20:20 +warning: referenced constant has errors + --> $DIR/conditional_array_execution.rs:19:20 | LL | const FOO: u32 = [X - Y, Y - X][(X < Y) as usize]; | ----- attempt to subtract with overflow @@ -28,13 +22,13 @@ LL | println!("{}", FOO); | ^^^ warning: this expression will panic at runtime - --> $DIR/conditional_array_execution.rs:20:20 + --> $DIR/conditional_array_execution.rs:19:20 | LL | println!("{}", FOO); | ^^^ referenced constant has errors -error[E0080]: referenced constant - --> $DIR/conditional_array_execution.rs:20:5 +error[E0080]: referenced constant has errors + --> $DIR/conditional_array_execution.rs:19:5 | LL | const FOO: u32 = [X - Y, Y - X][(X < Y) as usize]; | ----- attempt to subtract with overflow @@ -45,7 +39,7 @@ LL | println!("{}", FOO); = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error[E0080]: erroneous constant used - --> $DIR/conditional_array_execution.rs:20:5 + --> $DIR/conditional_array_execution.rs:19:5 | LL | println!("{}", FOO); | ^^^^^^^^^^^^^^^---^^ @@ -54,8 +48,8 @@ LL | println!("{}", FOO); | = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) -error[E0080]: referenced constant - --> $DIR/conditional_array_execution.rs:20:20 +error[E0080]: referenced constant has errors + --> $DIR/conditional_array_execution.rs:19:20 | LL | const FOO: u32 = [X - Y, Y - X][(X < Y) as usize]; | ----- attempt to subtract with overflow @@ -64,7 +58,7 @@ LL | println!("{}", FOO); | ^^^ error[E0080]: erroneous constant used - --> $DIR/conditional_array_execution.rs:20:20 + --> $DIR/conditional_array_execution.rs:19:20 | LL | println!("{}", FOO); | ^^^ referenced constant has errors diff --git a/src/test/ui/const-eval/conditional_array_execution.rs b/src/test/ui/const-eval/conditional_array_execution.rs index ac555b25afd..99487eb4979 100644 --- a/src/test/ui/const-eval/conditional_array_execution.rs +++ b/src/test/ui/const-eval/conditional_array_execution.rs @@ -13,8 +13,7 @@ const X: u32 = 5; const Y: u32 = 6; const FOO: u32 = [X - Y, Y - X][(X < Y) as usize]; -//~^ WARN attempt to subtract with overflow -//~| WARN this constant cannot be used +//~^ WARN this constant cannot be used fn main() { println!("{}", FOO); diff --git a/src/test/ui/const-eval/conditional_array_execution.stderr b/src/test/ui/const-eval/conditional_array_execution.stderr index 64010c946a7..649da03a5e7 100644 --- a/src/test/ui/const-eval/conditional_array_execution.stderr +++ b/src/test/ui/const-eval/conditional_array_execution.stderr @@ -1,8 +1,10 @@ -warning: attempt to subtract with overflow - --> $DIR/conditional_array_execution.rs:15:19 +warning: this constant cannot be used + --> $DIR/conditional_array_execution.rs:15:1 | LL | const FOO: u32 = [X - Y, Y - X][(X < Y) as usize]; - | ^^^^^ + | ^^^^^^^^^^^^^^^^^^-----^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | | + | attempt to subtract with overflow | note: lint level defined here --> $DIR/conditional_array_execution.rs:11:9 @@ -10,16 +12,8 @@ note: lint level defined here LL | #![warn(const_err)] | ^^^^^^^^^ -warning: this constant cannot be used - --> $DIR/conditional_array_execution.rs:15:1 - | -LL | const FOO: u32 = [X - Y, Y - X][(X < Y) as usize]; - | ^^^^^^^^^^^^^^^^^^-----^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | attempt to subtract with overflow - -warning: referenced constant - --> $DIR/conditional_array_execution.rs:20:20 +warning: referenced constant has errors + --> $DIR/conditional_array_execution.rs:19:20 | LL | const FOO: u32 = [X - Y, Y - X][(X < Y) as usize]; | ----- attempt to subtract with overflow @@ -28,13 +22,13 @@ LL | println!("{}", FOO); | ^^^ warning: this expression will panic at runtime - --> $DIR/conditional_array_execution.rs:20:20 + --> $DIR/conditional_array_execution.rs:19:20 | LL | println!("{}", FOO); | ^^^ referenced constant has errors -error[E0080]: referenced constant - --> $DIR/conditional_array_execution.rs:20:20 +error[E0080]: referenced constant has errors + --> $DIR/conditional_array_execution.rs:19:20 | LL | const FOO: u32 = [X - Y, Y - X][(X < Y) as usize]; | ----- attempt to subtract with overflow @@ -43,7 +37,7 @@ LL | println!("{}", FOO); | ^^^ error[E0080]: erroneous constant used - --> $DIR/conditional_array_execution.rs:20:20 + --> $DIR/conditional_array_execution.rs:19:20 | LL | println!("{}", FOO); | ^^^ referenced constant has errors diff --git a/src/test/ui/const-eval/issue-43197.nll.stderr b/src/test/ui/const-eval/issue-43197.nll.stderr index 3bde12ade90..5819e6a9254 100644 --- a/src/test/ui/const-eval/issue-43197.nll.stderr +++ b/src/test/ui/const-eval/issue-43197.nll.stderr @@ -1,15 +1,3 @@ -warning: attempt to subtract with overflow - --> $DIR/issue-43197.rs:20:20 - | -LL | const X: u32 = 0-1; - | ^^^ - | -note: lint level defined here - --> $DIR/issue-43197.rs:11:9 - | -LL | #![warn(const_err)] - | ^^^^^^^^^ - warning: this constant cannot be used --> $DIR/issue-43197.rs:20:5 | @@ -17,23 +5,23 @@ LL | const X: u32 = 0-1; | ^^^^^^^^^^^^^^^---^ | | | attempt to subtract with overflow - -warning: attempt to subtract with overflow - --> $DIR/issue-43197.rs:23:24 | -LL | const Y: u32 = foo(0-1); - | ^^^ +note: lint level defined here + --> $DIR/issue-43197.rs:11:9 + | +LL | #![warn(const_err)] + | ^^^^^^^^^ warning: this constant cannot be used - --> $DIR/issue-43197.rs:23:5 + --> $DIR/issue-43197.rs:22:5 | LL | const Y: u32 = foo(0-1); | ^^^^^^^^^^^^^^^^^^^---^^ | | | attempt to subtract with overflow -warning: referenced constant - --> $DIR/issue-43197.rs:26:23 +warning: referenced constant has errors + --> $DIR/issue-43197.rs:24:23 | LL | const X: u32 = 0-1; | --- attempt to subtract with overflow @@ -42,28 +30,28 @@ LL | println!("{} {}", X, Y); | ^ warning: this expression will panic at runtime - --> $DIR/issue-43197.rs:26:23 + --> $DIR/issue-43197.rs:24:23 | LL | println!("{} {}", X, Y); | ^ referenced constant has errors -warning: referenced constant - --> $DIR/issue-43197.rs:26:26 +warning: referenced constant has errors + --> $DIR/issue-43197.rs:24:26 | LL | const Y: u32 = foo(0-1); | --- attempt to subtract with overflow -... +LL | //~^ WARN this constant cannot be used LL | println!("{} {}", X, Y); | ^ warning: this expression will panic at runtime - --> $DIR/issue-43197.rs:26:26 + --> $DIR/issue-43197.rs:24:26 | LL | println!("{} {}", X, Y); | ^ referenced constant has errors -error[E0080]: referenced constant - --> $DIR/issue-43197.rs:26:5 +error[E0080]: referenced constant has errors + --> $DIR/issue-43197.rs:24:5 | LL | const X: u32 = 0-1; | --- attempt to subtract with overflow @@ -74,7 +62,7 @@ LL | println!("{} {}", X, Y); = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error[E0080]: erroneous constant used - --> $DIR/issue-43197.rs:26:5 + --> $DIR/issue-43197.rs:24:5 | LL | println!("{} {}", X, Y); | ^^^^^^^^^^^^^^^^^^-^^^^^ @@ -83,23 +71,23 @@ LL | println!("{} {}", X, Y); | = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) -error[E0080]: referenced constant - --> $DIR/issue-43197.rs:26:26 +error[E0080]: referenced constant has errors + --> $DIR/issue-43197.rs:24:26 | LL | const Y: u32 = foo(0-1); | --- attempt to subtract with overflow -... +LL | //~^ WARN this constant cannot be used LL | println!("{} {}", X, Y); | ^ error[E0080]: erroneous constant used - --> $DIR/issue-43197.rs:26:26 + --> $DIR/issue-43197.rs:24:26 | LL | println!("{} {}", X, Y); | ^ referenced constant has errors -error[E0080]: referenced constant - --> $DIR/issue-43197.rs:26:23 +error[E0080]: referenced constant has errors + --> $DIR/issue-43197.rs:24:23 | LL | const X: u32 = 0-1; | --- attempt to subtract with overflow @@ -108,7 +96,7 @@ LL | println!("{} {}", X, Y); | ^ error[E0080]: erroneous constant used - --> $DIR/issue-43197.rs:26:23 + --> $DIR/issue-43197.rs:24:23 | LL | println!("{} {}", X, Y); | ^ referenced constant has errors diff --git a/src/test/ui/const-eval/issue-43197.rs b/src/test/ui/const-eval/issue-43197.rs index 03aa65eb274..9304af7b811 100644 --- a/src/test/ui/const-eval/issue-43197.rs +++ b/src/test/ui/const-eval/issue-43197.rs @@ -18,11 +18,9 @@ const fn foo(x: u32) -> u32 { fn main() { const X: u32 = 0-1; - //~^ WARN attempt to subtract with overflow - //~| WARN this constant cannot be used + //~^ WARN this constant cannot be used const Y: u32 = foo(0-1); - //~^ WARN attempt to subtract with overflow - //~| WARN this constant cannot be used + //~^ WARN this constant cannot be used println!("{} {}", X, Y); //~^ WARN this expression will panic at runtime //~| WARN this expression will panic at runtime diff --git a/src/test/ui/const-eval/issue-43197.stderr b/src/test/ui/const-eval/issue-43197.stderr index 071d8787307..bf864d81ea3 100644 --- a/src/test/ui/const-eval/issue-43197.stderr +++ b/src/test/ui/const-eval/issue-43197.stderr @@ -1,15 +1,3 @@ -warning: attempt to subtract with overflow - --> $DIR/issue-43197.rs:20:20 - | -LL | const X: u32 = 0-1; - | ^^^ - | -note: lint level defined here - --> $DIR/issue-43197.rs:11:9 - | -LL | #![warn(const_err)] - | ^^^^^^^^^ - warning: this constant cannot be used --> $DIR/issue-43197.rs:20:5 | @@ -17,23 +5,23 @@ LL | const X: u32 = 0-1; | ^^^^^^^^^^^^^^^---^ | | | attempt to subtract with overflow - -warning: attempt to subtract with overflow - --> $DIR/issue-43197.rs:23:24 | -LL | const Y: u32 = foo(0-1); - | ^^^ +note: lint level defined here + --> $DIR/issue-43197.rs:11:9 + | +LL | #![warn(const_err)] + | ^^^^^^^^^ warning: this constant cannot be used - --> $DIR/issue-43197.rs:23:5 + --> $DIR/issue-43197.rs:22:5 | LL | const Y: u32 = foo(0-1); | ^^^^^^^^^^^^^^^^^^^---^^ | | | attempt to subtract with overflow -warning: referenced constant - --> $DIR/issue-43197.rs:26:23 +warning: referenced constant has errors + --> $DIR/issue-43197.rs:24:23 | LL | const X: u32 = 0-1; | --- attempt to subtract with overflow @@ -42,43 +30,43 @@ LL | println!("{} {}", X, Y); | ^ warning: this expression will panic at runtime - --> $DIR/issue-43197.rs:26:23 + --> $DIR/issue-43197.rs:24:23 | LL | println!("{} {}", X, Y); | ^ referenced constant has errors -warning: referenced constant - --> $DIR/issue-43197.rs:26:26 +warning: referenced constant has errors + --> $DIR/issue-43197.rs:24:26 | LL | const Y: u32 = foo(0-1); | --- attempt to subtract with overflow -... +LL | //~^ WARN this constant cannot be used LL | println!("{} {}", X, Y); | ^ warning: this expression will panic at runtime - --> $DIR/issue-43197.rs:26:26 + --> $DIR/issue-43197.rs:24:26 | LL | println!("{} {}", X, Y); | ^ referenced constant has errors -error[E0080]: referenced constant - --> $DIR/issue-43197.rs:26:26 +error[E0080]: referenced constant has errors + --> $DIR/issue-43197.rs:24:26 | LL | const Y: u32 = foo(0-1); | --- attempt to subtract with overflow -... +LL | //~^ WARN this constant cannot be used LL | println!("{} {}", X, Y); | ^ error[E0080]: erroneous constant used - --> $DIR/issue-43197.rs:26:26 + --> $DIR/issue-43197.rs:24:26 | LL | println!("{} {}", X, Y); | ^ referenced constant has errors -error[E0080]: referenced constant - --> $DIR/issue-43197.rs:26:23 +error[E0080]: referenced constant has errors + --> $DIR/issue-43197.rs:24:23 | LL | const X: u32 = 0-1; | --- attempt to subtract with overflow @@ -87,7 +75,7 @@ LL | println!("{} {}", X, Y); | ^ error[E0080]: erroneous constant used - --> $DIR/issue-43197.rs:26:23 + --> $DIR/issue-43197.rs:24:23 | LL | println!("{} {}", X, Y); | ^ referenced constant has errors diff --git a/src/test/ui/const-eval/issue-44578.nll.stderr b/src/test/ui/const-eval/issue-44578.nll.stderr index ad4f08966c0..eeb152e00ea 100644 --- a/src/test/ui/const-eval/issue-44578.nll.stderr +++ b/src/test/ui/const-eval/issue-44578.nll.stderr @@ -1,4 +1,4 @@ -error[E0080]: referenced constant +error[E0080]: referenced constant has errors --> $DIR/issue-44578.rs:35:5 | LL | const AMT: usize = [A::AMT][(A::AMT > B::AMT) as usize]; @@ -19,7 +19,7 @@ LL | println!("{}", <Bar<u16, u8> as Foo>::AMT); | = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) -error[E0080]: referenced constant +error[E0080]: referenced constant has errors --> $DIR/issue-44578.rs:35:20 | LL | const AMT: usize = [A::AMT][(A::AMT > B::AMT) as usize]; diff --git a/src/test/ui/const-eval/issue-44578.stderr b/src/test/ui/const-eval/issue-44578.stderr index 28a723a069e..06174f37dca 100644 --- a/src/test/ui/const-eval/issue-44578.stderr +++ b/src/test/ui/const-eval/issue-44578.stderr @@ -1,4 +1,4 @@ -error[E0080]: referenced constant +error[E0080]: referenced constant has errors --> $DIR/issue-44578.rs:35:20 | LL | const AMT: usize = [A::AMT][(A::AMT > B::AMT) as usize]; diff --git a/src/test/ui/const-eval/issue-50814-2.stderr b/src/test/ui/const-eval/issue-50814-2.stderr index 3c59cb0e2bc..1e37e949812 100644 --- a/src/test/ui/const-eval/issue-50814-2.stderr +++ b/src/test/ui/const-eval/issue-50814-2.stderr @@ -1,4 +1,4 @@ -error[E0080]: referenced constant +error[E0080]: referenced constant has errors --> $DIR/issue-50814-2.rs:26:5 | LL | const BAR: usize = [5, 6, 7][T::BOO]; diff --git a/src/test/ui/const-eval/issue-50814.stderr b/src/test/ui/const-eval/issue-50814.stderr index 145279ccc03..16160207c57 100644 --- a/src/test/ui/const-eval/issue-50814.stderr +++ b/src/test/ui/const-eval/issue-50814.stderr @@ -1,4 +1,4 @@ -error[E0080]: referenced constant +error[E0080]: referenced constant has errors --> $DIR/issue-50814.rs:27:5 | LL | const MAX: u8 = A::MAX + B::MAX; diff --git a/src/test/ui/const-eval/pub_const_err.rs b/src/test/ui/const-eval/pub_const_err.rs index ef8fdb33d74..b7cfa949bac 100644 --- a/src/test/ui/const-eval/pub_const_err.rs +++ b/src/test/ui/const-eval/pub_const_err.rs @@ -14,8 +14,7 @@ #![crate_type = "lib"] pub const Z: u32 = 0 - 1; -//~^ WARN attempt to subtract with overflow -//~| WARN this constant cannot be used +//~^ WARN this constant cannot be used pub type Foo = [i32; 0 - 1]; //~^ WARN attempt to subtract with overflow diff --git a/src/test/ui/const-eval/pub_const_err.stderr b/src/test/ui/const-eval/pub_const_err.stderr index 35228941754..fa3a79a5f17 100644 --- a/src/test/ui/const-eval/pub_const_err.stderr +++ b/src/test/ui/const-eval/pub_const_err.stderr @@ -1,8 +1,10 @@ -warning: attempt to subtract with overflow - --> $DIR/pub_const_err.rs:16:20 +warning: this constant cannot be used + --> $DIR/pub_const_err.rs:16:1 | LL | pub const Z: u32 = 0 - 1; - | ^^^^^ + | ^^^^^^^^^^^^^^^^^^^-----^ + | | + | attempt to subtract with overflow | note: lint level defined here --> $DIR/pub_const_err.rs:12:9 @@ -10,22 +12,14 @@ note: lint level defined here LL | #![warn(const_err)] | ^^^^^^^^^ -warning: this constant cannot be used - --> $DIR/pub_const_err.rs:16:1 - | -LL | pub const Z: u32 = 0 - 1; - | ^^^^^^^^^^^^^^^^^^^-----^ - | | - | attempt to subtract with overflow - warning: attempt to subtract with overflow - --> $DIR/pub_const_err.rs:20:22 + --> $DIR/pub_const_err.rs:19:22 | LL | pub type Foo = [i32; 0 - 1]; | ^^^^^ warning: this array length cannot be used - --> $DIR/pub_const_err.rs:20:22 + --> $DIR/pub_const_err.rs:19:22 | LL | pub type Foo = [i32; 0 - 1]; | ^^^^^ attempt to subtract with overflow diff --git a/src/test/ui/const-eval/pub_const_err_bin.rs b/src/test/ui/const-eval/pub_const_err_bin.rs index f65da1d8674..bafa5b2f4da 100644 --- a/src/test/ui/const-eval/pub_const_err_bin.rs +++ b/src/test/ui/const-eval/pub_const_err_bin.rs @@ -12,8 +12,7 @@ #![warn(const_err)] pub const Z: u32 = 0 - 1; -//~^ WARN attempt to subtract with overflow -//~| WARN this constant cannot be used +//~^ WARN this constant cannot be used pub type Foo = [i32; 0 - 1]; //~^ WARN attempt to subtract with overflow diff --git a/src/test/ui/const-eval/pub_const_err_bin.stderr b/src/test/ui/const-eval/pub_const_err_bin.stderr index a6db2176011..73229c60d14 100644 --- a/src/test/ui/const-eval/pub_const_err_bin.stderr +++ b/src/test/ui/const-eval/pub_const_err_bin.stderr @@ -1,8 +1,10 @@ -warning: attempt to subtract with overflow - --> $DIR/pub_const_err_bin.rs:14:20 +warning: this constant cannot be used + --> $DIR/pub_const_err_bin.rs:14:1 | LL | pub const Z: u32 = 0 - 1; - | ^^^^^ + | ^^^^^^^^^^^^^^^^^^^-----^ + | | + | attempt to subtract with overflow | note: lint level defined here --> $DIR/pub_const_err_bin.rs:12:9 @@ -10,22 +12,14 @@ note: lint level defined here LL | #![warn(const_err)] | ^^^^^^^^^ -warning: this constant cannot be used - --> $DIR/pub_const_err_bin.rs:14:1 - | -LL | pub const Z: u32 = 0 - 1; - | ^^^^^^^^^^^^^^^^^^^-----^ - | | - | attempt to subtract with overflow - warning: attempt to subtract with overflow - --> $DIR/pub_const_err_bin.rs:18:22 + --> $DIR/pub_const_err_bin.rs:17:22 | LL | pub type Foo = [i32; 0 - 1]; | ^^^^^ warning: this array length cannot be used - --> $DIR/pub_const_err_bin.rs:18:22 + --> $DIR/pub_const_err_bin.rs:17:22 | LL | pub type Foo = [i32; 0 - 1]; | ^^^^^ attempt to subtract with overflow diff --git a/src/test/ui/const-len-underflow-separate-spans.rs b/src/test/ui/const-len-underflow-separate-spans.rs index 20b88657674..8db1411005e 100644 --- a/src/test/ui/const-len-underflow-separate-spans.rs +++ b/src/test/ui/const-len-underflow-separate-spans.rs @@ -15,11 +15,11 @@ const ONE: usize = 1; const TWO: usize = 2; const LEN: usize = ONE - TWO; -//~^ ERROR E0080 -//~| ERROR attempt to subtract with overflow fn main() { let a: [i8; LEN] = unimplemented!(); //~^ ERROR E0080 //~| ERROR E0080 +//~| ERROR E0080 +//~| ERROR E0080 } diff --git a/src/test/ui/const-len-underflow-separate-spans.stderr b/src/test/ui/const-len-underflow-separate-spans.stderr index 630828ef8f5..cf97a0dc555 100644 --- a/src/test/ui/const-len-underflow-separate-spans.stderr +++ b/src/test/ui/const-len-underflow-separate-spans.stderr @@ -1,19 +1,20 @@ -error: attempt to subtract with overflow - --> $DIR/const-len-underflow-separate-spans.rs:17:20 +error[E0080]: referenced constant has errors + --> $DIR/const-len-underflow-separate-spans.rs:20:17 | LL | const LEN: usize = ONE - TWO; - | ^^^^^^^^^ - | - = note: #[deny(const_err)] on by default + | --------- attempt to subtract with overflow +... +LL | let a: [i8; LEN] = unimplemented!(); + | ^^^ -error[E0080]: constant evaluation error - --> $DIR/const-len-underflow-separate-spans.rs:17:20 +error[E0080]: could not evaluate constant + --> $DIR/const-len-underflow-separate-spans.rs:20:17 | -LL | const LEN: usize = ONE - TWO; - | ^^^^^^^^^ attempt to subtract with overflow +LL | let a: [i8; LEN] = unimplemented!(); + | ^^^ referenced constant has errors -error[E0080]: referenced constant - --> $DIR/const-len-underflow-separate-spans.rs:22:12 +error[E0080]: referenced constant has errors + --> $DIR/const-len-underflow-separate-spans.rs:20:12 | LL | const LEN: usize = ONE - TWO; | --------- attempt to subtract with overflow @@ -22,7 +23,7 @@ LL | let a: [i8; LEN] = unimplemented!(); | ^^^^^^^^^ error[E0080]: could not evaluate constant expression - --> $DIR/const-len-underflow-separate-spans.rs:22:12 + --> $DIR/const-len-underflow-separate-spans.rs:20:12 | LL | let a: [i8; LEN] = unimplemented!(); | ^^^^^---^ |
