diff options
Diffstat (limited to 'src/test/ui')
19 files changed, 139 insertions, 160 deletions
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-eval/shift_overflow.rs b/src/test/ui/const-eval/shift_overflow.rs new file mode 100644 index 00000000000..a2c6ed36d30 --- /dev/null +++ b/src/test/ui/const-eval/shift_overflow.rs @@ -0,0 +1,19 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +enum Foo { + // test that we detect overflows for non-u32 discriminants + X = 1 << ((u32::max_value() as u64) + 1), //~ ERROR E0080 + Y = 42, +} + + +fn main() { +} diff --git a/src/test/ui/const-eval/shift_overflow.stderr b/src/test/ui/const-eval/shift_overflow.stderr new file mode 100644 index 00000000000..00a748249ea --- /dev/null +++ b/src/test/ui/const-eval/shift_overflow.stderr @@ -0,0 +1,9 @@ +error[E0080]: could not evaluate enum discriminant + --> $DIR/shift_overflow.rs:13:9 + | +LL | X = 1 << ((u32::max_value() as u64) + 1), //~ ERROR E0080 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempt to shift left with overflow + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0080`. 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!(); | ^^^^^---^ diff --git a/src/test/ui/suggestions/str-array-assignment.stderr b/src/test/ui/suggestions/str-array-assignment.stderr index 12699d8b25f..041bae4a421 100644 --- a/src/test/ui/suggestions/str-array-assignment.stderr +++ b/src/test/ui/suggestions/str-array-assignment.stderr @@ -14,7 +14,10 @@ LL | fn main() { | - expected `()` because of default return type ... LL | let u: &str = if true { s[..2] } else { s }; - | ^^^^^^ expected &str, found str + | ^^^^^^ + | | + | expected &str, found str + | help: consider borrowing here: `&s[..2]` | = note: expected type `&str` found type `str` |
