diff options
| author | Oliver Scherer <github35764891676564198441@oli-obk.de> | 2018-11-27 10:56:36 +0100 |
|---|---|---|
| committer | Oliver Scherer <github35764891676564198441@oli-obk.de> | 2018-12-04 10:06:05 +0100 |
| commit | 61efc3b71b28e5adde5a7e0b71e519e3d5001917 (patch) | |
| tree | 03e027d834a1d5dd5d32abbec9bb1dfbdeb7d5b3 /src/test | |
| parent | 2664aadaa2119ae3917af8af75369f037e73a40f (diff) | |
| download | rust-61efc3b71b28e5adde5a7e0b71e519e3d5001917.tar.gz rust-61efc3b71b28e5adde5a7e0b71e519e3d5001917.zip | |
Update tests
Diffstat (limited to 'src/test')
154 files changed, 387 insertions, 252 deletions
diff --git a/src/test/ui/associated-types/associated-types-overridden-binding-2.rs b/src/test/ui/associated-types/associated-types-overridden-binding-2.rs index 8d91561b7d6..3153ba47aa9 100644 --- a/src/test/ui/associated-types/associated-types-overridden-binding-2.rs +++ b/src/test/ui/associated-types/associated-types-overridden-binding-2.rs @@ -14,4 +14,5 @@ trait I32Iterator = Iterator<Item = i32>; fn main() { let _: &I32Iterator<Item = u32> = &vec![42].into_iter(); + //~^ ERROR type mismatch } diff --git a/src/test/ui/associated-types/associated-types-overridden-binding.rs b/src/test/ui/associated-types/associated-types-overridden-binding.rs index ed2211ecffd..1e0514edd66 100644 --- a/src/test/ui/associated-types/associated-types-overridden-binding.rs +++ b/src/test/ui/associated-types/associated-types-overridden-binding.rs @@ -11,7 +11,7 @@ #![feature(trait_alias)] trait Foo: Iterator<Item = i32> {} -trait Bar: Foo<Item = u32> {} +trait Bar: Foo<Item = u32> {} //~ ERROR type annotations required trait I32Iterator = Iterator<Item = i32>; trait U32Iterator = I32Iterator<Item = u32>; diff --git a/src/test/ui/associated-types/associated-types-overridden-binding.stderr b/src/test/ui/associated-types/associated-types-overridden-binding.stderr index 216aa097db9..c3e6eb86056 100644 --- a/src/test/ui/associated-types/associated-types-overridden-binding.stderr +++ b/src/test/ui/associated-types/associated-types-overridden-binding.stderr @@ -1,7 +1,7 @@ error[E0284]: type annotations required: cannot resolve `<Self as std::iter::Iterator>::Item == i32` --> $DIR/associated-types-overridden-binding.rs:14:1 | -LL | trait Bar: Foo<Item = u32> {} +LL | trait Bar: Foo<Item = u32> {} //~ ERROR type annotations required | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: required by `Foo` diff --git a/src/test/ui/await-keyword/2015-edition-warning.fixed b/src/test/ui/await-keyword/2015-edition-warning.fixed index c2c40cd11a6..c58496c91f5 100644 --- a/src/test/ui/await-keyword/2015-edition-warning.fixed +++ b/src/test/ui/await-keyword/2015-edition-warning.fixed @@ -5,11 +5,23 @@ mod outer_mod { pub mod r#await { +//~^ ERROR `await` is a keyword +//~| WARN was previously accepted pub struct r#await; +//~^ ERROR `await` is a keyword +//~| WARN was previously accepted } } use outer_mod::r#await::r#await; +//~^ ERROR `await` is a keyword +//~| ERROR `await` is a keyword +//~| WARN was previously accepted +//~| WARN was previously accepted fn main() { match r#await { r#await => {} } +//~^ ERROR `await` is a keyword +//~| ERROR `await` is a keyword +//~| WARN was previously accepted +//~| WARN was previously accepted } diff --git a/src/test/ui/await-keyword/2015-edition-warning.rs b/src/test/ui/await-keyword/2015-edition-warning.rs index 95539ab29dc..a7543a14325 100644 --- a/src/test/ui/await-keyword/2015-edition-warning.rs +++ b/src/test/ui/await-keyword/2015-edition-warning.rs @@ -5,11 +5,23 @@ mod outer_mod { pub mod await { +//~^ ERROR `await` is a keyword +//~| WARN was previously accepted pub struct await; +//~^ ERROR `await` is a keyword +//~| WARN was previously accepted } } use outer_mod::await::await; +//~^ ERROR `await` is a keyword +//~| ERROR `await` is a keyword +//~| WARN was previously accepted +//~| WARN was previously accepted fn main() { match await { await => {} } +//~^ ERROR `await` is a keyword +//~| ERROR `await` is a keyword +//~| WARN was previously accepted +//~| WARN was previously accepted } diff --git a/src/test/ui/await-keyword/2015-edition-warning.stderr b/src/test/ui/await-keyword/2015-edition-warning.stderr index 073e9d7e6d0..d9ae1b9a167 100644 --- a/src/test/ui/await-keyword/2015-edition-warning.stderr +++ b/src/test/ui/await-keyword/2015-edition-warning.stderr @@ -13,7 +13,7 @@ LL | #![deny(keyword_idents)] = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> error: `await` is a keyword in the 2018 edition - --> $DIR/2015-edition-warning.rs:8:20 + --> $DIR/2015-edition-warning.rs:10:20 | LL | pub struct await; | ^^^^^ help: you can use a raw identifier to stay compatible: `r#await` @@ -22,7 +22,7 @@ LL | pub struct await; = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> error: `await` is a keyword in the 2018 edition - --> $DIR/2015-edition-warning.rs:11:16 + --> $DIR/2015-edition-warning.rs:15:16 | LL | use outer_mod::await::await; | ^^^^^ help: you can use a raw identifier to stay compatible: `r#await` @@ -31,7 +31,7 @@ LL | use outer_mod::await::await; = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> error: `await` is a keyword in the 2018 edition - --> $DIR/2015-edition-warning.rs:11:23 + --> $DIR/2015-edition-warning.rs:15:23 | LL | use outer_mod::await::await; | ^^^^^ help: you can use a raw identifier to stay compatible: `r#await` @@ -40,7 +40,7 @@ LL | use outer_mod::await::await; = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> error: `await` is a keyword in the 2018 edition - --> $DIR/2015-edition-warning.rs:14:11 + --> $DIR/2015-edition-warning.rs:22:11 | LL | match await { await => {} } | ^^^^^ help: you can use a raw identifier to stay compatible: `r#await` @@ -49,7 +49,7 @@ LL | match await { await => {} } = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> error: `await` is a keyword in the 2018 edition - --> $DIR/2015-edition-warning.rs:14:19 + --> $DIR/2015-edition-warning.rs:22:19 | LL | match await { await => {} } | ^^^^^ help: you can use a raw identifier to stay compatible: `r#await` diff --git a/src/test/ui/await-keyword/2018-edition-error.rs b/src/test/ui/await-keyword/2018-edition-error.rs index a9e2e3f79ee..7ba3382ddf1 100644 --- a/src/test/ui/await-keyword/2018-edition-error.rs +++ b/src/test/ui/await-keyword/2018-edition-error.rs @@ -2,12 +2,14 @@ #![allow(non_camel_case_types)] mod outer_mod { - pub mod await { - pub struct await; + pub mod await { //~ ERROR `await` is a keyword + pub struct await; //~ ERROR `await` is a keyword } } -use self::outer_mod::await::await; +use self::outer_mod::await::await; //~ ERROR `await` is a keyword + //~^ ERROR `await` is a keyword fn main() { - match await { await => () } + match await { await => () } //~ ERROR `await` is a keyword + //~^ ERROR `await` is a keyword } diff --git a/src/test/ui/await-keyword/2018-edition-error.stderr b/src/test/ui/await-keyword/2018-edition-error.stderr index d5727b8db37..9ddb27916d1 100644 --- a/src/test/ui/await-keyword/2018-edition-error.stderr +++ b/src/test/ui/await-keyword/2018-edition-error.stderr @@ -1,37 +1,37 @@ error[E0721]: `await` is a keyword in the 2018 edition --> $DIR/2018-edition-error.rs:5:13 | -LL | pub mod await { +LL | pub mod await { //~ ERROR `await` is a keyword | ^^^^^ help: you can use a raw identifier to stay compatible: `r#await` error[E0721]: `await` is a keyword in the 2018 edition --> $DIR/2018-edition-error.rs:6:20 | -LL | pub struct await; +LL | pub struct await; //~ ERROR `await` is a keyword | ^^^^^ help: you can use a raw identifier to stay compatible: `r#await` error[E0721]: `await` is a keyword in the 2018 edition --> $DIR/2018-edition-error.rs:9:22 | -LL | use self::outer_mod::await::await; +LL | use self::outer_mod::await::await; //~ ERROR `await` is a keyword | ^^^^^ help: you can use a raw identifier to stay compatible: `r#await` error[E0721]: `await` is a keyword in the 2018 edition --> $DIR/2018-edition-error.rs:9:29 | -LL | use self::outer_mod::await::await; +LL | use self::outer_mod::await::await; //~ ERROR `await` is a keyword | ^^^^^ help: you can use a raw identifier to stay compatible: `r#await` error[E0721]: `await` is a keyword in the 2018 edition - --> $DIR/2018-edition-error.rs:12:11 + --> $DIR/2018-edition-error.rs:13:11 | -LL | match await { await => () } +LL | match await { await => () } //~ ERROR `await` is a keyword | ^^^^^ help: you can use a raw identifier to stay compatible: `r#await` error[E0721]: `await` is a keyword in the 2018 edition - --> $DIR/2018-edition-error.rs:12:19 + --> $DIR/2018-edition-error.rs:13:19 | -LL | match await { await => () } +LL | match await { await => () } //~ ERROR `await` is a keyword | ^^^^^ help: you can use a raw identifier to stay compatible: `r#await` error: aborting due to 6 previous errors diff --git a/src/test/ui/await-keyword/post_expansion_error.rs b/src/test/ui/await-keyword/post_expansion_error.rs index 580ca3b3a4f..96dd48052de 100644 --- a/src/test/ui/await-keyword/post_expansion_error.rs +++ b/src/test/ui/await-keyword/post_expansion_error.rs @@ -6,4 +6,5 @@ macro_rules! r#await { fn main() { await!() + //~^ ERROR `await` is a keyword } diff --git a/src/test/ui/borrowck/issue-54499-field-mutation-of-moved-out-with-mut.ast.stderr b/src/test/ui/borrowck/issue-54499-field-mutation-of-moved-out-with-mut.ast.stderr index e3b5341d2bc..4f845d87aa2 100644 --- a/src/test/ui/borrowck/issue-54499-field-mutation-of-moved-out-with-mut.ast.stderr +++ b/src/test/ui/borrowck/issue-54499-field-mutation-of-moved-out-with-mut.ast.stderr @@ -1,5 +1,5 @@ error[E0382]: use of moved value: `t.0` - --> $DIR/issue-54499-field-mutation-of-moved-out-with-mut.rs:25:31 + --> $DIR/issue-54499-field-mutation-of-moved-out-with-mut.rs:26:31 | LL | drop(t); | - value moved here @@ -10,7 +10,7 @@ LL | println!("{:?} {:?}", t.0, t.1); = note: move occurs because `t` has type `(S, i32)`, which does not implement the `Copy` trait error[E0382]: use of moved value: `t.1` - --> $DIR/issue-54499-field-mutation-of-moved-out-with-mut.rs:25:36 + --> $DIR/issue-54499-field-mutation-of-moved-out-with-mut.rs:26:36 | LL | drop(t); | - value moved here @@ -21,7 +21,7 @@ LL | println!("{:?} {:?}", t.0, t.1); = note: move occurs because `t` has type `(S, i32)`, which does not implement the `Copy` trait error[E0382]: use of moved value: `u.0` - --> $DIR/issue-54499-field-mutation-of-moved-out-with-mut.rs:33:31 + --> $DIR/issue-54499-field-mutation-of-moved-out-with-mut.rs:37:31 | LL | drop(u); | - value moved here @@ -32,7 +32,7 @@ LL | println!("{:?} {:?}", u.0, u.1); = note: move occurs because `u` has type `Tpair`, which does not implement the `Copy` trait error[E0382]: use of moved value: `u.1` - --> $DIR/issue-54499-field-mutation-of-moved-out-with-mut.rs:33:36 + --> $DIR/issue-54499-field-mutation-of-moved-out-with-mut.rs:37:36 | LL | drop(u); | - value moved here @@ -43,7 +43,7 @@ LL | println!("{:?} {:?}", u.0, u.1); = note: move occurs because `u` has type `Tpair`, which does not implement the `Copy` trait error[E0382]: use of moved value: `v.x` - --> $DIR/issue-54499-field-mutation-of-moved-out-with-mut.rs:41:31 + --> $DIR/issue-54499-field-mutation-of-moved-out-with-mut.rs:48:31 | LL | drop(v); | - value moved here @@ -54,7 +54,7 @@ LL | println!("{:?} {:?}", v.x, v.y); = note: move occurs because `v` has type `Spair`, which does not implement the `Copy` trait error[E0382]: use of moved value: `v.y` - --> $DIR/issue-54499-field-mutation-of-moved-out-with-mut.rs:41:36 + --> $DIR/issue-54499-field-mutation-of-moved-out-with-mut.rs:48:36 | LL | drop(v); | - value moved here diff --git a/src/test/ui/borrowck/issue-54499-field-mutation-of-moved-out-with-mut.nll.stderr b/src/test/ui/borrowck/issue-54499-field-mutation-of-moved-out-with-mut.nll.stderr index 001ed59059c..7861087ad02 100644 --- a/src/test/ui/borrowck/issue-54499-field-mutation-of-moved-out-with-mut.nll.stderr +++ b/src/test/ui/borrowck/issue-54499-field-mutation-of-moved-out-with-mut.nll.stderr @@ -9,7 +9,7 @@ LL | t.0 = S(1); = note: move occurs because `t` has type `(S, i32)`, which does not implement the `Copy` trait error[E0382]: assign to part of moved value: `u` - --> $DIR/issue-54499-field-mutation-of-moved-out-with-mut.rs:31:9 + --> $DIR/issue-54499-field-mutation-of-moved-out-with-mut.rs:34:9 | LL | drop(u); | - value moved here @@ -19,7 +19,7 @@ LL | u.0 = S(1); = note: move occurs because `u` has type `Tpair`, which does not implement the `Copy` trait error[E0382]: assign to part of moved value: `v` - --> $DIR/issue-54499-field-mutation-of-moved-out-with-mut.rs:39:9 + --> $DIR/issue-54499-field-mutation-of-moved-out-with-mut.rs:45:9 | LL | drop(v); | - value moved here diff --git a/src/test/ui/borrowck/issue-54499-field-mutation-of-moved-out-with-mut.rs b/src/test/ui/borrowck/issue-54499-field-mutation-of-moved-out-with-mut.rs index b6339c4a3c7..358a5dd1cbd 100644 --- a/src/test/ui/borrowck/issue-54499-field-mutation-of-moved-out-with-mut.rs +++ b/src/test/ui/borrowck/issue-54499-field-mutation-of-moved-out-with-mut.rs @@ -21,23 +21,32 @@ fn main() { let mut t: Tuple = (S(0), 0); drop(t); t.0 = S(1); + //[nll]~^ ERROR assign to part of moved value t.1 = 2; println!("{:?} {:?}", t.0, t.1); + //[ast]~^ ERROR use of moved value + //[ast]~^^ ERROR use of moved value } { let mut u: Tpair = Tpair(S(0), 0); drop(u); u.0 = S(1); + //[nll]~^ ERROR assign to part of moved value u.1 = 2; println!("{:?} {:?}", u.0, u.1); + //[ast]~^ ERROR use of moved value + //[ast]~^^ ERROR use of moved value } { let mut v: Spair = Spair { x: S(0), y: 0 }; drop(v); v.x = S(1); + //[nll]~^ ERROR assign to part of moved value v.y = 2; println!("{:?} {:?}", v.x, v.y); + //[ast]~^ ERROR use of moved value + //[ast]~^^ ERROR use of moved value } } diff --git a/src/test/ui/borrowck/issue-54597-reject-move-out-of-borrow-via-pat.rs b/src/test/ui/borrowck/issue-54597-reject-move-out-of-borrow-via-pat.rs index 0749900986d..ad4accbbeee 100644 --- a/src/test/ui/borrowck/issue-54597-reject-move-out-of-borrow-via-pat.rs +++ b/src/test/ui/borrowck/issue-54597-reject-move-out-of-borrow-via-pat.rs @@ -13,7 +13,7 @@ impl Value { fn foo(val: Value) { let _reviewers_original: Vec<Value> = match val.as_array() { Some(array) => { - *array + *array //~ ERROR cannot move out of borrowed content } None => vec![] }; diff --git a/src/test/ui/borrowck/issue-54597-reject-move-out-of-borrow-via-pat.stderr b/src/test/ui/borrowck/issue-54597-reject-move-out-of-borrow-via-pat.stderr index 6a12016b2a5..d1d7d13088b 100644 --- a/src/test/ui/borrowck/issue-54597-reject-move-out-of-borrow-via-pat.stderr +++ b/src/test/ui/borrowck/issue-54597-reject-move-out-of-borrow-via-pat.stderr @@ -1,7 +1,7 @@ error[E0507]: cannot move out of borrowed content --> $DIR/issue-54597-reject-move-out-of-borrow-via-pat.rs:16:13 | -LL | *array +LL | *array //~ ERROR cannot move out of borrowed content | ^^^^^^ | | | cannot move out of borrowed content diff --git a/src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.ast.stderr b/src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.ast.stderr index 3180823f643..f3e9ce364d9 100644 --- a/src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.ast.stderr +++ b/src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.ast.stderr @@ -9,7 +9,7 @@ LL | x | error[E0595]: closure cannot assign to immutable argument `x` - --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:29:22 + --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:32:22 | LL | let mut c1 = |z: &'static mut isize| { | ^^^^^^^^^^^^^^^^^^^^^^^ cannot borrow mutably @@ -19,7 +19,7 @@ LL | x | error[E0595]: closure cannot assign to immutable argument `x` - --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:40:9 + --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:46:9 | LL | pub fn capture_assign_whole(x: (i32,)) { | - help: make this binding mutable: `mut x` @@ -27,7 +27,7 @@ LL | || { x = (1,); }; | ^^ cannot borrow mutably error[E0595]: closure cannot assign to immutable argument `x` - --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:43:9 + --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:52:9 | LL | pub fn capture_assign_part(x: (i32,)) { | - help: make this binding mutable: `mut x` @@ -35,7 +35,7 @@ LL | || { x.0 = 1; }; | ^^ cannot borrow mutably error[E0595]: closure cannot assign to immutable argument `x` - --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:46:9 + --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:58:9 | LL | pub fn capture_reborrow_whole(x: (i32,)) { | - help: make this binding mutable: `mut x` @@ -43,7 +43,7 @@ LL | || { &mut x; }; | ^^ cannot borrow mutably error[E0595]: closure cannot assign to immutable argument `x` - --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:49:9 + --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:64:9 | LL | pub fn capture_reborrow_part(x: (i32,)) { | - help: make this binding mutable: `mut x` diff --git a/src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.migrate.stderr b/src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.migrate.stderr index 0ccddf0a67d..434f318ad14 100644 --- a/src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.migrate.stderr +++ b/src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.migrate.stderr @@ -8,7 +8,7 @@ LL | let mut c1 = |y: &'static mut isize| x = y; | ^^^^^ cannot assign error[E0594]: cannot assign to `x`, as it is not declared as mutable - --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:30:50 + --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:34:50 | LL | pub fn ee(x: &'static mut isize) { | - help: consider changing this to be mutable: `mut x` @@ -17,7 +17,7 @@ LL | let mut c2 = |y: &'static mut isize| x = y; | ^^^^^ cannot assign error[E0594]: cannot assign to `x`, as it is not declared as mutable - --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:40:14 + --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:46:14 | LL | pub fn capture_assign_whole(x: (i32,)) { | - help: consider changing this to be mutable: `mut x` @@ -25,7 +25,7 @@ LL | || { x = (1,); }; | ^^^^^^^^ cannot assign error[E0594]: cannot assign to `x.0`, as `x` is not declared as mutable - --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:43:14 + --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:52:14 | LL | pub fn capture_assign_part(x: (i32,)) { | - help: consider changing this to be mutable: `mut x` @@ -33,7 +33,7 @@ LL | || { x.0 = 1; }; | ^^^^^^^ cannot assign error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable - --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:46:14 + --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:58:14 | LL | pub fn capture_reborrow_whole(x: (i32,)) { | - help: consider changing this to be mutable: `mut x` @@ -41,7 +41,7 @@ LL | || { &mut x; }; | ^^^^^^ cannot borrow as mutable error[E0596]: cannot borrow `x.0` as mutable, as `x` is not declared as mutable - --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:49:14 + --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:64:14 | LL | pub fn capture_reborrow_part(x: (i32,)) { | - help: consider changing this to be mutable: `mut x` diff --git a/src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.nll.stderr b/src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.nll.stderr index 0ccddf0a67d..434f318ad14 100644 --- a/src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.nll.stderr +++ b/src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.nll.stderr @@ -8,7 +8,7 @@ LL | let mut c1 = |y: &'static mut isize| x = y; | ^^^^^ cannot assign error[E0594]: cannot assign to `x`, as it is not declared as mutable - --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:30:50 + --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:34:50 | LL | pub fn ee(x: &'static mut isize) { | - help: consider changing this to be mutable: `mut x` @@ -17,7 +17,7 @@ LL | let mut c2 = |y: &'static mut isize| x = y; | ^^^^^ cannot assign error[E0594]: cannot assign to `x`, as it is not declared as mutable - --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:40:14 + --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:46:14 | LL | pub fn capture_assign_whole(x: (i32,)) { | - help: consider changing this to be mutable: `mut x` @@ -25,7 +25,7 @@ LL | || { x = (1,); }; | ^^^^^^^^ cannot assign error[E0594]: cannot assign to `x.0`, as `x` is not declared as mutable - --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:43:14 + --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:52:14 | LL | pub fn capture_assign_part(x: (i32,)) { | - help: consider changing this to be mutable: `mut x` @@ -33,7 +33,7 @@ LL | || { x.0 = 1; }; | ^^^^^^^ cannot assign error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable - --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:46:14 + --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:58:14 | LL | pub fn capture_reborrow_whole(x: (i32,)) { | - help: consider changing this to be mutable: `mut x` @@ -41,7 +41,7 @@ LL | || { &mut x; }; | ^^^^^^ cannot borrow as mutable error[E0596]: cannot borrow `x.0` as mutable, as `x` is not declared as mutable - --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:49:14 + --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:64:14 | LL | pub fn capture_reborrow_part(x: (i32,)) { | - help: consider changing this to be mutable: `mut x` diff --git a/src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.rs b/src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.rs index 25ad66a5d9b..2bd71ec25f8 100644 --- a/src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.rs +++ b/src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.rs @@ -19,6 +19,9 @@ mod borrowck_closures_unique { pub fn e(x: &'static mut isize) { static mut Y: isize = 3; let mut c1 = |y: &'static mut isize| x = y; + //[migrate]~^ ERROR is not declared as mutable + //[nll]~^^ ERROR is not declared as mutable + //[ast]~^^^ closure cannot assign to immutable unsafe { c1(&mut Y); } } } @@ -27,7 +30,10 @@ mod borrowck_closures_unique_grandparent { pub fn ee(x: &'static mut isize) { static mut Z: isize = 3; let mut c1 = |z: &'static mut isize| { + //[ast]~^ closure cannot assign to immutable let mut c2 = |y: &'static mut isize| x = y; + //[migrate]~^ ERROR is not declared as mutable + //[nll]~^^ ERROR is not declared as mutable c2(z); }; unsafe { c1(&mut Z); } @@ -38,15 +44,27 @@ mod borrowck_closures_unique_grandparent { mod mutability_errors { pub fn capture_assign_whole(x: (i32,)) { || { x = (1,); }; + //[ast]~^ ERROR immutable argument + //[migrate]~^^ ERROR is not declared as mutable + //[nll]~^^^ ERROR is not declared as mutable } pub fn capture_assign_part(x: (i32,)) { || { x.0 = 1; }; + //[ast]~^ ERROR immutable argument + //[migrate]~^^ ERROR is not declared as mutable + //[nll]~^^^ ERROR is not declared as mutable } pub fn capture_reborrow_whole(x: (i32,)) { || { &mut x; }; + //[ast]~^ ERROR immutable argument + //[migrate]~^^ ERROR is not declared as mutable + //[nll]~^^^ ERROR is not declared as mutable } pub fn capture_reborrow_part(x: (i32,)) { || { &mut x.0; }; + //[ast]~^ ERROR immutable argument + //[migrate]~^^ ERROR is not declared as mutable + //[nll]~^^^ ERROR is not declared as mutable } } diff --git a/src/test/ui/consts/const-eval/promoted_const_fn_fail_deny_const_err.rs b/src/test/ui/consts/const-eval/promoted_const_fn_fail_deny_const_err.rs index dca8f3c4745..7e2a72f2370 100644 --- a/src/test/ui/consts/const-eval/promoted_const_fn_fail_deny_const_err.rs +++ b/src/test/ui/consts/const-eval/promoted_const_fn_fail_deny_const_err.rs @@ -29,6 +29,7 @@ fn main() { // This will compile, but then hard-abort at runtime. // FIXME(oli-obk): this should instead panic (not hard-abort) at runtime. let x: &'static u8 = &(bar() + 1); + //~^ ERROR does not live long enough let y = *x; unreachable!(); } diff --git a/src/test/ui/consts/const-int-unchecked.rs b/src/test/ui/consts/const-int-unchecked.rs index cbf855633fd..6d4b50c1dde 100644 --- a/src/test/ui/consts/const-int-unchecked.rs +++ b/src/test/ui/consts/const-int-unchecked.rs @@ -13,9 +13,9 @@ use std::intrinsics; const SHR: u8 = unsafe { intrinsics::unchecked_shr(5_u8, 8) }; -//^~ ERROR: Overflowing shift by 8 in unchecked_shr +//~^ ERROR any use of this value will cause an error const SHL: u8 = unsafe { intrinsics::unchecked_shl(5_u8, 8) }; -//^~ ERROR: Overflowing shift by 8 in unchecked_shl +//~^ ERROR any use of this value will cause an error fn main() { } diff --git a/src/test/ui/custom_test_frameworks/mismatch.rs b/src/test/ui/custom_test_frameworks/mismatch.rs index 28753f1649a..ca5a6f7f3d2 100644 --- a/src/test/ui/custom_test_frameworks/mismatch.rs +++ b/src/test/ui/custom_test_frameworks/mismatch.rs @@ -17,3 +17,4 @@ extern crate example_runner; #[test] fn wrong_kind(){} +//~^ ERROR trait bound `test::TestDescAndFn: example_runner::Testable` is not satisfied diff --git a/src/test/ui/error-codes/E0161.ast.stderr b/src/test/ui/error-codes/E0161.ast.stderr index 62e8676e631..903019590ef 100644 --- a/src/test/ui/error-codes/E0161.ast.stderr +++ b/src/test/ui/error-codes/E0161.ast.stderr @@ -1,7 +1,7 @@ error[E0161]: cannot move a value of type [i32]: the size of [i32] cannot be statically determined --> $DIR/E0161.rs:32:9 | -LL | box *x; //~ ERROR E0161 +LL | box *x; | ^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0161.astul.stderr b/src/test/ui/error-codes/E0161.astul.stderr index 79080fb4eae..bfeab0c6e6b 100644 --- a/src/test/ui/error-codes/E0161.astul.stderr +++ b/src/test/ui/error-codes/E0161.astul.stderr @@ -1,7 +1,7 @@ error[E0161]: cannot move a value of type [i32]: the size of [i32] cannot be statically determined --> $DIR/E0161.rs:32:5 | -LL | box *x; //~ ERROR E0161 +LL | box *x; | ^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0161.edition.stderr b/src/test/ui/error-codes/E0161.edition.stderr index 62e8676e631..903019590ef 100644 --- a/src/test/ui/error-codes/E0161.edition.stderr +++ b/src/test/ui/error-codes/E0161.edition.stderr @@ -1,7 +1,7 @@ error[E0161]: cannot move a value of type [i32]: the size of [i32] cannot be statically determined --> $DIR/E0161.rs:32:9 | -LL | box *x; //~ ERROR E0161 +LL | box *x; | ^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0161.editionul.stderr b/src/test/ui/error-codes/E0161.editionul.stderr index 79080fb4eae..bfeab0c6e6b 100644 --- a/src/test/ui/error-codes/E0161.editionul.stderr +++ b/src/test/ui/error-codes/E0161.editionul.stderr @@ -1,7 +1,7 @@ error[E0161]: cannot move a value of type [i32]: the size of [i32] cannot be statically determined --> $DIR/E0161.rs:32:5 | -LL | box *x; //~ ERROR E0161 +LL | box *x; | ^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0161.nll.stderr b/src/test/ui/error-codes/E0161.nll.stderr index 62e8676e631..903019590ef 100644 --- a/src/test/ui/error-codes/E0161.nll.stderr +++ b/src/test/ui/error-codes/E0161.nll.stderr @@ -1,7 +1,7 @@ error[E0161]: cannot move a value of type [i32]: the size of [i32] cannot be statically determined --> $DIR/E0161.rs:32:9 | -LL | box *x; //~ ERROR E0161 +LL | box *x; | ^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0161.nllul.stderr b/src/test/ui/error-codes/E0161.nllul.stderr index 79080fb4eae..bfeab0c6e6b 100644 --- a/src/test/ui/error-codes/E0161.nllul.stderr +++ b/src/test/ui/error-codes/E0161.nllul.stderr @@ -1,7 +1,7 @@ error[E0161]: cannot move a value of type [i32]: the size of [i32] cannot be statically determined --> $DIR/E0161.rs:32:5 | -LL | box *x; //~ ERROR E0161 +LL | box *x; | ^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0161.rs b/src/test/ui/error-codes/E0161.rs index edc5a84a843..26742ff9400 100644 --- a/src/test/ui/error-codes/E0161.rs +++ b/src/test/ui/error-codes/E0161.rs @@ -29,7 +29,15 @@ #![feature(box_syntax)] fn foo(x: Box<[i32]>) { - box *x; //~ ERROR E0161 + box *x; + //[ast]~^ ERROR E0161 + //[nll]~^^ ERROR E0161 + //[zflags]~^^^ ERROR E0161 + //[edition]~^^^^ ERROR E0161 + //[astul]~^^^^^ ERROR E0161 + //[nllul]~^^^^^^ ERROR E0161 + //[zflagsul]~^^^^^^^ ERROR E0161 + //[editionul]~^^^^^^^^ ERROR E0161 } fn main() {} diff --git a/src/test/ui/error-codes/E0161.zflags.stderr b/src/test/ui/error-codes/E0161.zflags.stderr index 62e8676e631..903019590ef 100644 --- a/src/test/ui/error-codes/E0161.zflags.stderr +++ b/src/test/ui/error-codes/E0161.zflags.stderr @@ -1,7 +1,7 @@ error[E0161]: cannot move a value of type [i32]: the size of [i32] cannot be statically determined --> $DIR/E0161.rs:32:9 | -LL | box *x; //~ ERROR E0161 +LL | box *x; | ^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0161.zflagsul.stderr b/src/test/ui/error-codes/E0161.zflagsul.stderr index 79080fb4eae..bfeab0c6e6b 100644 --- a/src/test/ui/error-codes/E0161.zflagsul.stderr +++ b/src/test/ui/error-codes/E0161.zflagsul.stderr @@ -1,7 +1,7 @@ error[E0161]: cannot move a value of type [i32]: the size of [i32] cannot be statically determined --> $DIR/E0161.rs:32:5 | -LL | box *x; //~ ERROR E0161 +LL | box *x; | ^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0718.rs b/src/test/ui/error-codes/E0718.rs index ce74e35ac6b..73678195492 100644 --- a/src/test/ui/error-codes/E0718.rs +++ b/src/test/ui/error-codes/E0718.rs @@ -11,7 +11,7 @@ #![feature(lang_items)] // Arc is expected to be a struct, so this will error. -#[lang = "arc"] +#[lang = "arc"] //~ ERROR language item must be applied to a struct static X: u32 = 42; fn main() {} diff --git a/src/test/ui/error-codes/E0718.stderr b/src/test/ui/error-codes/E0718.stderr index 8ce721d30a1..8544b07618b 100644 --- a/src/test/ui/error-codes/E0718.stderr +++ b/src/test/ui/error-codes/E0718.stderr @@ -1,7 +1,7 @@ error[E0718]: `arc` language item must be applied to a struct --> $DIR/E0718.rs:14:1 | -LL | #[lang = "arc"] +LL | #[lang = "arc"] //~ ERROR language item must be applied to a struct | ^^^^^^^^^^^^^^^ attribute should be applied to a struct, not a static item error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0719.rs b/src/test/ui/error-codes/E0719.rs index c7bfa85093f..895f9e04d88 100644 --- a/src/test/ui/error-codes/E0719.rs +++ b/src/test/ui/error-codes/E0719.rs @@ -9,10 +9,12 @@ // except according to those terms. trait Foo: Iterator<Item = i32, Item = i32> {} +//~^ ERROR is already specified type Unit = (); fn test() -> Box<Iterator<Item = (), Item = Unit>> { +//~^ ERROR is already specified Box::new(None.into_iter()) } diff --git a/src/test/ui/error-codes/E0719.stderr b/src/test/ui/error-codes/E0719.stderr index 3a908fceced..0666e1ede3c 100644 --- a/src/test/ui/error-codes/E0719.stderr +++ b/src/test/ui/error-codes/E0719.stderr @@ -7,7 +7,7 @@ LL | trait Foo: Iterator<Item = i32, Item = i32> {} | `Item` bound here first error[E0719]: the value of the associated type `Item` (from the trait `std::iter::Iterator`) is already specified - --> $DIR/E0719.rs:15:38 + --> $DIR/E0719.rs:16:38 | LL | fn test() -> Box<Iterator<Item = (), Item = Unit>> { | --------- ^^^^^^^^^^^ re-bound here diff --git a/src/test/ui/feature-gates/feature-gate-impl_trait_in_bindings.rs b/src/test/ui/feature-gates/feature-gate-impl_trait_in_bindings.rs index 9c76719e26c..34f23152c2d 100644 --- a/src/test/ui/feature-gates/feature-gate-impl_trait_in_bindings.rs +++ b/src/test/ui/feature-gates/feature-gate-impl_trait_in_bindings.rs @@ -9,9 +9,13 @@ // except according to those terms. const FOO: impl Copy = 42; +//~^ ERROR `impl Trait` not allowed static BAR: impl Copy = 42; +//~^ ERROR `impl Trait` not allowed fn main() { let foo = impl Copy = 42; +//~^ ERROR expected expression, found keyword `impl` + let foo: impl Copy = 42; } diff --git a/src/test/ui/feature-gates/feature-gate-impl_trait_in_bindings.stderr b/src/test/ui/feature-gates/feature-gate-impl_trait_in_bindings.stderr index 82bc6194483..4582e3697e2 100644 --- a/src/test/ui/feature-gates/feature-gate-impl_trait_in_bindings.stderr +++ b/src/test/ui/feature-gates/feature-gate-impl_trait_in_bindings.stderr @@ -1,5 +1,5 @@ error: expected expression, found keyword `impl` - --> $DIR/feature-gate-impl_trait_in_bindings.rs:16:15 + --> $DIR/feature-gate-impl_trait_in_bindings.rs:18:15 | LL | let foo = impl Copy = 42; | ^^^^ expected expression @@ -13,7 +13,7 @@ LL | const FOO: impl Copy = 42; = help: add #![feature(impl_trait_in_bindings)] to the crate attributes to enable error[E0562]: `impl Trait` not allowed outside of function and inherent method return types - --> $DIR/feature-gate-impl_trait_in_bindings.rs:13:13 + --> $DIR/feature-gate-impl_trait_in_bindings.rs:14:13 | LL | static BAR: impl Copy = 42; | ^^^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-linker-flavor.rs b/src/test/ui/feature-gates/feature-gate-linker-flavor.rs index 711159647b7..56ede0104a5 100644 --- a/src/test/ui/feature-gates/feature-gate-linker-flavor.rs +++ b/src/test/ui/feature-gates/feature-gate-linker-flavor.rs @@ -14,6 +14,7 @@ // book #[used] +//~^ ERROR attribute must be applied to a `static` variable fn foo() {} fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-trait-alias.rs b/src/test/ui/feature-gates/feature-gate-trait-alias.rs index a2a183f80f9..52e01c24ace 100644 --- a/src/test/ui/feature-gates/feature-gate-trait-alias.rs +++ b/src/test/ui/feature-gates/feature-gate-trait-alias.rs @@ -9,5 +9,6 @@ // except according to those terms. trait Foo = Default; +//~^ ERROR trait aliases are experimental fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-underscore_const_names.rs b/src/test/ui/feature-gates/feature-gate-underscore_const_names.rs index b283e286514..fec0868c540 100644 --- a/src/test/ui/feature-gates/feature-gate-underscore_const_names.rs +++ b/src/test/ui/feature-gates/feature-gate-underscore_const_names.rs @@ -15,6 +15,7 @@ struct Str {} impl Trt for Str {} const _ : () = { +//~^ ERROR is unstable use std::marker::PhantomData; struct ImplementsTrait<T: Trt>(PhantomData<T>); let _ = ImplementsTrait::<Str>(PhantomData); diff --git a/src/test/ui/feature-gates/feature-gate-underscore_const_names.stderr b/src/test/ui/feature-gates/feature-gate-underscore_const_names.stderr index ab90ef8f11f..694d2c1e73c 100644 --- a/src/test/ui/feature-gates/feature-gate-underscore_const_names.stderr +++ b/src/test/ui/feature-gates/feature-gate-underscore_const_names.stderr @@ -2,6 +2,7 @@ error[E0658]: naming constants with `_` is unstable (see issue #54912) --> $DIR/feature-gate-underscore_const_names.rs:17:1 | LL | / const _ : () = { +LL | | //~^ ERROR is unstable LL | | use std::marker::PhantomData; LL | | struct ImplementsTrait<T: Trt>(PhantomData<T>); LL | | let _ = ImplementsTrait::<Str>(PhantomData); diff --git a/src/test/ui/generator/generator-region-requirements.rs b/src/test/ui/generator/generator-region-requirements.rs index 59e7841309c..2cda483b6a1 100644 --- a/src/test/ui/generator/generator-region-requirements.rs +++ b/src/test/ui/generator/generator-region-requirements.rs @@ -13,6 +13,8 @@ fn dangle(x: &mut i32) -> &'static mut i32 { loop { match unsafe { g.resume() } { GeneratorState::Complete(c) => return c, +//[nll]~^ ERROR explicit lifetime required +//[ast]~^^ ERROR explicit lifetime required GeneratorState::Yielded(_) => (), } } diff --git a/src/test/ui/impl-trait/bindings-opaque.rs b/src/test/ui/impl-trait/bindings-opaque.rs index 88b7a52af7f..84a0f788b1e 100644 --- a/src/test/ui/impl-trait/bindings-opaque.rs +++ b/src/test/ui/impl-trait/bindings-opaque.rs @@ -18,6 +18,9 @@ fn main() { let foo: impl Copy = 42; let _ = FOO.count_ones(); +//~^ ERROR no method let _ = BAR.count_ones(); +//~^ ERROR no method let _ = foo.count_ones(); +//~^ ERROR no method } diff --git a/src/test/ui/impl-trait/bindings-opaque.stderr b/src/test/ui/impl-trait/bindings-opaque.stderr index 00358ee502e..1f79149c561 100644 --- a/src/test/ui/impl-trait/bindings-opaque.stderr +++ b/src/test/ui/impl-trait/bindings-opaque.stderr @@ -5,13 +5,13 @@ LL | let _ = FOO.count_ones(); | ^^^^^^^^^^ error[E0599]: no method named `count_ones` found for type `impl std::marker::Copy` in the current scope - --> $DIR/bindings-opaque.rs:21:17 + --> $DIR/bindings-opaque.rs:22:17 | LL | let _ = BAR.count_ones(); | ^^^^^^^^^^ error[E0599]: no method named `count_ones` found for type `impl std::marker::Copy` in the current scope - --> $DIR/bindings-opaque.rs:22:17 + --> $DIR/bindings-opaque.rs:24:17 | LL | let _ = foo.count_ones(); | ^^^^^^^^^^ diff --git a/src/test/ui/impl-trait/bindings.rs b/src/test/ui/impl-trait/bindings.rs index 571571aa751..0cca12f8a67 100644 --- a/src/test/ui/impl-trait/bindings.rs +++ b/src/test/ui/impl-trait/bindings.rs @@ -12,23 +12,27 @@ fn a<T: Clone>(x: T) { const foo: impl Clone = x; +//~^ ERROR can't capture dynamic environment in a fn item } fn b<T: Clone>(x: T) { let _ = move || { const foo: impl Clone = x; +//~^ ERROR can't capture dynamic environment in a fn item }; } trait Foo<T: Clone> { fn a(x: T) { const foo: impl Clone = x; +//~^ ERROR can't capture dynamic environment in a fn item } } impl<T: Clone> Foo<T> for i32 { fn a(x: T) { const foo: impl Clone = x; +//~^ ERROR can't capture dynamic environment in a fn item } } diff --git a/src/test/ui/impl-trait/bindings.stderr b/src/test/ui/impl-trait/bindings.stderr index 70a736d2fd1..91be86f7af3 100644 --- a/src/test/ui/impl-trait/bindings.stderr +++ b/src/test/ui/impl-trait/bindings.stderr @@ -7,7 +7,7 @@ LL | const foo: impl Clone = x; = help: use the `|| { ... }` closure form instead error[E0434]: can't capture dynamic environment in a fn item - --> $DIR/bindings.rs:19:33 + --> $DIR/bindings.rs:20:33 | LL | const foo: impl Clone = x; | ^ @@ -15,7 +15,7 @@ LL | const foo: impl Clone = x; = help: use the `|| { ... }` closure form instead error[E0434]: can't capture dynamic environment in a fn item - --> $DIR/bindings.rs:25:33 + --> $DIR/bindings.rs:27:33 | LL | const foo: impl Clone = x; | ^ @@ -23,7 +23,7 @@ LL | const foo: impl Clone = x; = help: use the `|| { ... }` closure form instead error[E0434]: can't capture dynamic environment in a fn item - --> $DIR/bindings.rs:31:33 + --> $DIR/bindings.rs:34:33 | LL | const foo: impl Clone = x; | ^ diff --git a/src/test/ui/issues/issue-17905-2.rs b/src/test/ui/issues/issue-17905-2.rs index 7b4a40e26b1..fb9e9e17c82 100644 --- a/src/test/ui/issues/issue-17905-2.rs +++ b/src/test/ui/issues/issue-17905-2.rs @@ -16,6 +16,8 @@ impl Pair< isize > { fn say(self: &Pair<&str, isize>) { +//~^ ERROR mismatched method receiver +//~| ERROR mismatched method receiver println!("{:?}", self); } } diff --git a/src/test/ui/issues/issue-17905-2.stderr b/src/test/ui/issues/issue-17905-2.stderr index f6f23be2ab8..cf8b5190599 100644 --- a/src/test/ui/issues/issue-17905-2.stderr +++ b/src/test/ui/issues/issue-17905-2.stderr @@ -10,6 +10,8 @@ note: the anonymous lifetime #2 defined on the method body at 18:5... --> $DIR/issue-17905-2.rs:18:5 | LL | / fn say(self: &Pair<&str, isize>) { +LL | | //~^ ERROR mismatched method receiver +LL | | //~| ERROR mismatched method receiver LL | | println!("{:?}", self); LL | | } | |_____^ @@ -36,6 +38,8 @@ note: ...does not necessarily outlive the anonymous lifetime #2 defined on the m --> $DIR/issue-17905-2.rs:18:5 | LL | / fn say(self: &Pair<&str, isize>) { +LL | | //~^ ERROR mismatched method receiver +LL | | //~| ERROR mismatched method receiver LL | | println!("{:?}", self); LL | | } | |_____^ diff --git a/src/test/ui/issues/issue-22872.rs b/src/test/ui/issues/issue-22872.rs index 7a83b098e78..a6130d21b5d 100644 --- a/src/test/ui/issues/issue-22872.rs +++ b/src/test/ui/issues/issue-22872.rs @@ -18,6 +18,8 @@ pub trait Process<'a> { fn push_process<P>(process: P) where P: Process<'static> { let _: Box<for<'b> Wrap<'b>> = Box::new(Wrapper(process)); +//~^ ERROR is not an iterator +//~| ERROR is not satisfied } fn main() {} diff --git a/src/test/ui/issues/issue-34229.rs b/src/test/ui/issues/issue-34229.rs index bcdfcc767fb..13e627a492f 100644 --- a/src/test/ui/issues/issue-34229.rs +++ b/src/test/ui/issues/issue-34229.rs @@ -1,4 +1,5 @@ #[derive(PartialEq)] struct Comparable; #[derive(PartialEq, PartialOrd)] struct Nope(Comparable); +//~^ ERROR can't compare `Comparable` fn main() {} diff --git a/src/test/ui/issues/issue-39175.rs b/src/test/ui/issues/issue-39175.rs index efe59c31263..ca912b211c4 100644 --- a/src/test/ui/issues/issue-39175.rs +++ b/src/test/ui/issues/issue-39175.rs @@ -22,4 +22,5 @@ use std::process::Command; fn main() { Command::new("echo").arg("hello").exec(); +//~^ ERROR no method named `exec` } diff --git a/src/test/ui/issues/issue-45829/import-self.rs b/src/test/ui/issues/issue-45829/import-self.rs index eb5fb458d82..c4da18a3c9d 100644 --- a/src/test/ui/issues/issue-45829/import-self.rs +++ b/src/test/ui/issues/issue-45829/import-self.rs @@ -14,12 +14,16 @@ mod foo { } use foo::{self}; +//~^ ERROR is defined multiple times use foo as self; +//~^ ERROR expected identifier use foo::self; +//~^ ERROR `self` imports are only allowed within a { } list use foo::A; use foo::{self as A}; +//~^ ERROR is defined multiple times fn main() {} diff --git a/src/test/ui/issues/issue-45829/import-self.stderr b/src/test/ui/issues/issue-45829/import-self.stderr index 55e51952a88..4e8b70824b9 100644 --- a/src/test/ui/issues/issue-45829/import-self.stderr +++ b/src/test/ui/issues/issue-45829/import-self.stderr @@ -1,11 +1,11 @@ error: expected identifier, found keyword `self` - --> $DIR/import-self.rs:18:12 + --> $DIR/import-self.rs:19:12 | LL | use foo as self; | ^^^^ expected identifier, found keyword error[E0429]: `self` imports are only allowed within a { } list - --> $DIR/import-self.rs:20:5 + --> $DIR/import-self.rs:22:5 | LL | use foo::self; | ^^^^^^^^^ @@ -26,7 +26,7 @@ LL | use foo::{self as other_foo}; | ^^^^^^^^^^^^^^^^^ error[E0252]: the name `A` is defined multiple times - --> $DIR/import-self.rs:23:11 + --> $DIR/import-self.rs:26:11 | LL | use foo::A; | ------ previous import of the type `A` here diff --git a/src/test/ui/issues/issue-45829/import-twice.rs b/src/test/ui/issues/issue-45829/import-twice.rs index 785932e5ef4..0ba6ef34b49 100644 --- a/src/test/ui/issues/issue-45829/import-twice.rs +++ b/src/test/ui/issues/issue-45829/import-twice.rs @@ -14,5 +14,6 @@ mod foo { } use foo::{A, A}; +//~^ ERROR is defined multiple times fn main() {} diff --git a/src/test/ui/issues/issue-45829/issue-45829.rs b/src/test/ui/issues/issue-45829/issue-45829.rs index eca46484699..5135151bd64 100644 --- a/src/test/ui/issues/issue-45829/issue-45829.rs +++ b/src/test/ui/issues/issue-45829/issue-45829.rs @@ -14,5 +14,6 @@ mod foo { } use foo::{A, B as A}; +//~^ ERROR is defined multiple times fn main() {} diff --git a/src/test/ui/issues/issue-45829/rename-extern-vs-use.rs b/src/test/ui/issues/issue-45829/rename-extern-vs-use.rs index 6befee331d5..e6040e539c1 100644 --- a/src/test/ui/issues/issue-45829/rename-extern-vs-use.rs +++ b/src/test/ui/issues/issue-45829/rename-extern-vs-use.rs @@ -16,5 +16,6 @@ mod foo { use foo::bar; extern crate issue_45829_b as bar; +//~^ ERROR the name `bar` is defined multiple times fn main() {} diff --git a/src/test/ui/issues/issue-45829/rename-extern-with-tab.rs b/src/test/ui/issues/issue-45829/rename-extern-with-tab.rs index 61c7e915fe8..08cbbd6e545 100644 --- a/src/test/ui/issues/issue-45829/rename-extern-with-tab.rs +++ b/src/test/ui/issues/issue-45829/rename-extern-with-tab.rs @@ -13,5 +13,6 @@ extern crate issue_45829_a; extern crate issue_45829_b as issue_45829_a; +//~^ ERROR is defined multiple times fn main() {} diff --git a/src/test/ui/issues/issue-45829/rename-extern.rs b/src/test/ui/issues/issue-45829/rename-extern.rs index 41e3e8bbe14..d4c323da70f 100644 --- a/src/test/ui/issues/issue-45829/rename-extern.rs +++ b/src/test/ui/issues/issue-45829/rename-extern.rs @@ -13,5 +13,6 @@ extern crate issue_45829_a; extern crate issue_45829_b as issue_45829_a; +//~^ ERROR is defined multiple times fn main() {} diff --git a/src/test/ui/issues/issue-45829/rename-use-vs-extern.rs b/src/test/ui/issues/issue-45829/rename-use-vs-extern.rs index 9a2ec7a5273..5e131f0a0d0 100644 --- a/src/test/ui/issues/issue-45829/rename-use-vs-extern.rs +++ b/src/test/ui/issues/issue-45829/rename-use-vs-extern.rs @@ -12,5 +12,6 @@ extern crate issue_45829_b; use std as issue_45829_b; +//~^ ERROR is defined multiple times fn main() {} diff --git a/src/test/ui/issues/issue-45829/rename-use-with-tabs.rs b/src/test/ui/issues/issue-45829/rename-use-with-tabs.rs index c1e4d908906..84bf8ed8356 100644 --- a/src/test/ui/issues/issue-45829/rename-use-with-tabs.rs +++ b/src/test/ui/issues/issue-45829/rename-use-with-tabs.rs @@ -17,5 +17,6 @@ mod foo { } use foo::{A, bar::B as A}; +//~^ ERROR is defined multiple times fn main() {} diff --git a/src/test/ui/issues/issue-45829/rename-with-path.rs b/src/test/ui/issues/issue-45829/rename-with-path.rs index dbe8733735e..5be9c84f283 100644 --- a/src/test/ui/issues/issue-45829/rename-with-path.rs +++ b/src/test/ui/issues/issue-45829/rename-with-path.rs @@ -9,5 +9,6 @@ // except according to those terms. use std::{collections::HashMap as A, sync::Arc as A}; +//~^ ERROR is defined multiple times fn main() {} diff --git a/src/test/ui/issues/issue-45829/rename.rs b/src/test/ui/issues/issue-45829/rename.rs index 7c6d87b1d20..8e146d83066 100644 --- a/src/test/ui/issues/issue-45829/rename.rs +++ b/src/test/ui/issues/issue-45829/rename.rs @@ -10,6 +10,7 @@ use core; use std as core; +//~^ ERROR is defined multiple times fn main() { 1 + 1; diff --git a/src/test/ui/issues/issue-51602.rs b/src/test/ui/issues/issue-51602.rs index a3edecb94f7..7826ce6c0f3 100644 --- a/src/test/ui/issues/issue-51602.rs +++ b/src/test/ui/issues/issue-51602.rs @@ -10,6 +10,7 @@ fn main(){ if i in 1..10 { +//~^ ERROR expected `{`, found keyword `in` break; } } diff --git a/src/test/ui/issues/issue-52717.rs b/src/test/ui/issues/issue-52717.rs index d40e2bd3d53..52397aa8b48 100644 --- a/src/test/ui/issues/issue-52717.rs +++ b/src/test/ui/issues/issue-52717.rs @@ -17,5 +17,6 @@ fn main() { let x = A::A { foo: 3 }; match x { A::A { fob } => { println!("{}", fob); } +//~^ ERROR does not have a field named `fob` } } diff --git a/src/test/ui/issues/issue-53565.rs b/src/test/ui/issues/issue-53565.rs index 2bf38296f26..987c940b320 100644 --- a/src/test/ui/issues/issue-53565.rs +++ b/src/test/ui/issues/issue-53565.rs @@ -8,7 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. use std::time::{foo, bar, buzz}; +//~^ ERROR unresolved imports use std::time::{abc, def}; +//~^ ERROR unresolved imports fn main(){ - println!("Hello World!"); + println!("Hello World!"); } diff --git a/src/test/ui/issues/issue-53565.stderr b/src/test/ui/issues/issue-53565.stderr index 945f5efe4a8..b18d694a5e0 100644 --- a/src/test/ui/issues/issue-53565.stderr +++ b/src/test/ui/issues/issue-53565.stderr @@ -8,7 +8,7 @@ LL | use std::time::{foo, bar, buzz}; | no `foo` in `time` error[E0432]: unresolved imports `std::time::abc`, `std::time::def` - --> $DIR/issue-53565.rs:11:17 + --> $DIR/issue-53565.rs:12:17 | LL | use std::time::{abc, def}; | ^^^ ^^^ no `def` in `time` diff --git a/src/test/ui/issues/issue-53692.rs b/src/test/ui/issues/issue-53692.rs index 0b6cc36fa52..fb7662095d0 100644 --- a/src/test/ui/issues/issue-53692.rs +++ b/src/test/ui/issues/issue-53692.rs @@ -11,12 +11,14 @@ fn main() { let items = vec![1, 2, 3]; let ref_items: &[i32] = &items; let items_clone: Vec<i32> = ref_items.clone(); +//~^ ERROR mismatched types // in that case no suggestion will be triggered let items_clone_2:Vec<i32> = items.clone(); let s = "hi"; let string: String = s.clone(); +//~^ ERROR mismatched types // in that case no suggestion will be triggered let s2 = "hi"; diff --git a/src/test/ui/issues/issue-53692.stderr b/src/test/ui/issues/issue-53692.stderr index 9cd8a536155..ff4660dc702 100644 --- a/src/test/ui/issues/issue-53692.stderr +++ b/src/test/ui/issues/issue-53692.stderr @@ -11,7 +11,7 @@ LL | let items_clone: Vec<i32> = ref_items.clone(); found type `&[i32]` error[E0308]: mismatched types - --> $DIR/issue-53692.rs:19:30 + --> $DIR/issue-53692.rs:20:30 | LL | let string: String = s.clone(); | ^^^^^^^^^ diff --git a/src/test/ui/issues/issue-53840.rs b/src/test/ui/issues/issue-53840.rs index ece3caf78e2..e178007cd6b 100644 --- a/src/test/ui/issues/issue-53840.rs +++ b/src/test/ui/issues/issue-53840.rs @@ -20,8 +20,10 @@ fn main() { let bar = Bar { a: "1".to_string(), b: "2".to_string() }; match E::Foo("".into(), "".into(), "".into()) { E::Foo(a, b, ref c) => {} +//~^ ERROR cannot bind by-move and by-ref in the same pattern } match bar { Bar {a, ref b} => {} +//~^ ERROR cannot bind by-move and by-ref in the same pattern } } diff --git a/src/test/ui/issues/issue-53840.stderr b/src/test/ui/issues/issue-53840.stderr index 961e4c0ff62..599abe95bb6 100644 --- a/src/test/ui/issues/issue-53840.stderr +++ b/src/test/ui/issues/issue-53840.stderr @@ -8,7 +8,7 @@ LL | E::Foo(a, b, ref c) => {} | by-move pattern here error[E0009]: cannot bind by-move and by-ref in the same pattern - --> $DIR/issue-53840.rs:25:14 + --> $DIR/issue-53840.rs:26:14 | LL | Bar {a, ref b} => {} | ^ ----- both by-ref and by-move used diff --git a/src/test/ui/issues/issue-54348.rs b/src/test/ui/issues/issue-54348.rs index b980290391d..68d83805477 100644 --- a/src/test/ui/issues/issue-54348.rs +++ b/src/test/ui/issues/issue-54348.rs @@ -1,5 +1,5 @@ fn main() { [1][0u64 as usize]; - [1][1.5 as usize]; // ERROR index out of bounds - [1][1u64 as usize]; // ERROR index out of bounds + [1][1.5 as usize]; //~ ERROR index out of bounds + [1][1u64 as usize]; //~ ERROR index out of bounds } diff --git a/src/test/ui/issues/issue-54348.stderr b/src/test/ui/issues/issue-54348.stderr index a9f1b494258..d4ee94aa411 100644 --- a/src/test/ui/issues/issue-54348.stderr +++ b/src/test/ui/issues/issue-54348.stderr @@ -1,7 +1,7 @@ error: index out of bounds: the len is 1 but the index is 1 --> $DIR/issue-54348.rs:3:5 | -LL | [1][1.5 as usize]; // ERROR index out of bounds +LL | [1][1.5 as usize]; //~ ERROR index out of bounds | ^^^^^^^^^^^^^^^^^ | = note: #[deny(const_err)] on by default @@ -9,7 +9,7 @@ LL | [1][1.5 as usize]; // ERROR index out of bounds error: index out of bounds: the len is 1 but the index is 1 --> $DIR/issue-54348.rs:4:5 | -LL | [1][1u64 as usize]; // ERROR index out of bounds +LL | [1][1u64 as usize]; //~ ERROR index out of bounds | ^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-55796.rs b/src/test/ui/issues/issue-55796.rs index b48d4a9c022..a172f6a7bfa 100644 --- a/src/test/ui/issues/issue-55796.rs +++ b/src/test/ui/issues/issue-55796.rs @@ -14,9 +14,11 @@ pub trait Graph<'a> { fn out_neighbors(&'a self, u: &Self::Node) -> Box<Iterator<Item = Self::Node>> { Box::new(self.out_edges(u).map(|e| e.target())) +//~^ ERROR cannot infer } fn in_neighbors(&'a self, u: &Self::Node) -> Box<Iterator<Item = Self::Node>> { Box::new(self.in_edges(u).map(|e| e.target())) +//~^ ERROR cannot infer } } diff --git a/src/test/ui/issues/issue-55796.stderr b/src/test/ui/issues/issue-55796.stderr index 60ce8293a5c..f8ca0727efb 100644 --- a/src/test/ui/issues/issue-55796.stderr +++ b/src/test/ui/issues/issue-55796.stderr @@ -24,7 +24,7 @@ LL | Box::new(self.out_edges(u).map(|e| e.target())) found std::boxed::Box<dyn std::iter::Iterator<Item=<Self as Graph<'a>>::Node>> error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements - --> $DIR/issue-55796.rs:20:9 + --> $DIR/issue-55796.rs:21:9 | LL | Box::new(self.in_edges(u).map(|e| e.target())) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -34,8 +34,8 @@ note: first, the lifetime cannot outlive the lifetime 'a as defined on the trait | LL | pub trait Graph<'a> { | ^^ -note: ...so that the type `std::iter::Map<<Self as Graph<'a>>::EdgesIter, [closure@$DIR/issue-55796.rs:20:39: 20:53]>` will meet its required lifetime bounds - --> $DIR/issue-55796.rs:20:9 +note: ...so that the type `std::iter::Map<<Self as Graph<'a>>::EdgesIter, [closure@$DIR/issue-55796.rs:21:39: 21:53]>` will meet its required lifetime bounds + --> $DIR/issue-55796.rs:21:9 | LL | Box::new(self.in_edges(u).map(|e| e.target())) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/iterators/array-of-ranges.rs b/src/test/ui/iterators/array-of-ranges.rs index a7d6e80bae5..d2dfc7ec327 100644 --- a/src/test/ui/iterators/array-of-ranges.rs +++ b/src/test/ui/iterators/array-of-ranges.rs @@ -1,14 +1,23 @@ fn main() { for _ in [0..1] {} +//~^ ERROR is not an iterator for _ in [0..=1] {} +//~^ ERROR is not an iterator for _ in [0..] {} +//~^ ERROR is not an iterator for _ in [..1] {} +//~^ ERROR is not an iterator for _ in [..=1] {} +//~^ ERROR is not an iterator let start = 0; let end = 0; for _ in [start..end] {} +//~^ ERROR is not an iterator let array_of_range = [start..end]; for _ in array_of_range {} +//~^ ERROR is not an iterator for _ in [0..1, 2..3] {} +//~^ ERROR is not an iterator for _ in [0..=1] {} +//~^ ERROR is not an iterator } diff --git a/src/test/ui/iterators/array-of-ranges.stderr b/src/test/ui/iterators/array-of-ranges.stderr index fbe7e0ee748..495659720c3 100644 --- a/src/test/ui/iterators/array-of-ranges.stderr +++ b/src/test/ui/iterators/array-of-ranges.stderr @@ -9,7 +9,7 @@ LL | for _ in [0..1] {} = note: required by `std::iter::IntoIterator::into_iter` error[E0277]: `[std::ops::RangeInclusive<{integer}>; 1]` is not an iterator - --> $DIR/array-of-ranges.rs:3:14 + --> $DIR/array-of-ranges.rs:4:14 | LL | for _ in [0..=1] {} | ^^^^^^^ if you meant to iterate between two values, remove the square brackets @@ -19,7 +19,7 @@ LL | for _ in [0..=1] {} = note: required by `std::iter::IntoIterator::into_iter` error[E0277]: `[std::ops::RangeFrom<{integer}>; 1]` is not an iterator - --> $DIR/array-of-ranges.rs:4:14 + --> $DIR/array-of-ranges.rs:6:14 | LL | for _ in [0..] {} | ^^^^^ if you meant to iterate from a value onwards, remove the square brackets @@ -29,7 +29,7 @@ LL | for _ in [0..] {} = note: required by `std::iter::IntoIterator::into_iter` error[E0277]: `[std::ops::RangeTo<{integer}>; 1]` is not an iterator - --> $DIR/array-of-ranges.rs:5:14 + --> $DIR/array-of-ranges.rs:8:14 | LL | for _ in [..1] {} | ^^^^^ if you meant to iterate until a value, remove the square brackets and add a starting value @@ -39,7 +39,7 @@ LL | for _ in [..1] {} = note: required by `std::iter::IntoIterator::into_iter` error[E0277]: `[std::ops::RangeToInclusive<{integer}>; 1]` is not an iterator - --> $DIR/array-of-ranges.rs:6:14 + --> $DIR/array-of-ranges.rs:10:14 | LL | for _ in [..=1] {} | ^^^^^^ if you meant to iterate until a value (including it), remove the square brackets and add a starting value @@ -49,7 +49,7 @@ LL | for _ in [..=1] {} = note: required by `std::iter::IntoIterator::into_iter` error[E0277]: `[std::ops::Range<{integer}>; 1]` is not an iterator - --> $DIR/array-of-ranges.rs:9:14 + --> $DIR/array-of-ranges.rs:14:14 | LL | for _ in [start..end] {} | ^^^^^^^^^^^^ if you meant to iterate between two values, remove the square brackets @@ -59,7 +59,7 @@ LL | for _ in [start..end] {} = note: required by `std::iter::IntoIterator::into_iter` error[E0277]: `[std::ops::Range<{integer}>; 1]` is not an iterator - --> $DIR/array-of-ranges.rs:11:14 + --> $DIR/array-of-ranges.rs:17:14 | LL | for _ in array_of_range {} | ^^^^^^^^^^^^^^ if you meant to iterate between two values, remove the square brackets @@ -69,7 +69,7 @@ LL | for _ in array_of_range {} = note: required by `std::iter::IntoIterator::into_iter` error[E0277]: `[std::ops::Range<{integer}>; 2]` is not an iterator - --> $DIR/array-of-ranges.rs:12:14 + --> $DIR/array-of-ranges.rs:19:14 | LL | for _ in [0..1, 2..3] {} | ^^^^^^^^^^^^ borrow the array with `&` or call `.iter()` on it to iterate over it @@ -79,7 +79,7 @@ LL | for _ in [0..1, 2..3] {} = note: required by `std::iter::IntoIterator::into_iter` error[E0277]: `[std::ops::RangeInclusive<{integer}>; 1]` is not an iterator - --> $DIR/array-of-ranges.rs:13:14 + --> $DIR/array-of-ranges.rs:21:14 | LL | for _ in [0..=1] {} | ^^^^^^^ if you meant to iterate between two values, remove the square brackets diff --git a/src/test/ui/iterators/array.rs b/src/test/ui/iterators/array.rs index f54bb812743..33c84f6fa35 100644 --- a/src/test/ui/iterators/array.rs +++ b/src/test/ui/iterators/array.rs @@ -1,6 +1,9 @@ fn main() { for _ in [1, 2] {} +//~^ ERROR is not an iterator let x = [1, 2]; for _ in x {} +//~^ ERROR is not an iterator for _ in [1.0, 2.0] {} +//~^ ERROR is not an iterator } diff --git a/src/test/ui/iterators/array.stderr b/src/test/ui/iterators/array.stderr index fd74cd7a727..582c812a8d6 100644 --- a/src/test/ui/iterators/array.stderr +++ b/src/test/ui/iterators/array.stderr @@ -9,7 +9,7 @@ LL | for _ in [1, 2] {} = note: required by `std::iter::IntoIterator::into_iter` error[E0277]: `[{integer}; 2]` is not an iterator - --> $DIR/array.rs:4:14 + --> $DIR/array.rs:5:14 | LL | for _ in x {} | ^ borrow the array with `&` or call `.iter()` on it to iterate over it @@ -19,7 +19,7 @@ LL | for _ in x {} = note: required by `std::iter::IntoIterator::into_iter` error[E0277]: `[{float}; 2]` is not an iterator - --> $DIR/array.rs:5:14 + --> $DIR/array.rs:7:14 | LL | for _ in [1.0, 2.0] {} | ^^^^^^^^^^ borrow the array with `&` or call `.iter()` on it to iterate over it diff --git a/src/test/ui/iterators/bound.rs b/src/test/ui/iterators/bound.rs index 78285b8161c..bdd99ef8d17 100644 --- a/src/test/ui/iterators/bound.rs +++ b/src/test/ui/iterators/bound.rs @@ -1,3 +1,4 @@ struct S<I: Iterator>(I); struct T(S<u8>); +//~^ ERROR is not an iterator fn main() {} diff --git a/src/test/ui/lifetimes/lifetime-elision-return-type-trait.rs b/src/test/ui/lifetimes/lifetime-elision-return-type-trait.rs index eb959bfbcb5..1c288a7e44f 100644 --- a/src/test/ui/lifetimes/lifetime-elision-return-type-trait.rs +++ b/src/test/ui/lifetimes/lifetime-elision-return-type-trait.rs @@ -6,6 +6,7 @@ trait Future { use std::error::Error; fn foo() -> impl Future<Item=(), Error=Box<Error>> { +//~^ ERROR missing lifetime Ok(()) } diff --git a/src/test/ui/macros/macro-in-expression-context-2.rs b/src/test/ui/macros/macro-in-expression-context-2.rs index cf8572aefa2..766f3135863 100644 --- a/src/test/ui/macros/macro-in-expression-context-2.rs +++ b/src/test/ui/macros/macro-in-expression-context-2.rs @@ -3,5 +3,6 @@ macro_rules! empty { () => () } fn main() { match 42 { _ => { empty!() } +//~^ ERROR expected expression, found `<eof>` }; } diff --git a/src/test/ui/mismatched_types/numeric-literal-cast.rs b/src/test/ui/mismatched_types/numeric-literal-cast.rs index 516b2e8dd30..9b5f73296c5 100644 --- a/src/test/ui/mismatched_types/numeric-literal-cast.rs +++ b/src/test/ui/mismatched_types/numeric-literal-cast.rs @@ -14,7 +14,10 @@ fn foo2(_: i32) {} fn main() { foo(1u8); +//~^ ERROR mismatched types foo1(2f32); +//~^ ERROR mismatched types foo2(3i16); +//~^ ERROR mismatched types } diff --git a/src/test/ui/mismatched_types/numeric-literal-cast.stderr b/src/test/ui/mismatched_types/numeric-literal-cast.stderr index e2fe1a0914d..3aabbf530f2 100644 --- a/src/test/ui/mismatched_types/numeric-literal-cast.stderr +++ b/src/test/ui/mismatched_types/numeric-literal-cast.stderr @@ -9,7 +9,7 @@ LL | foo(1u16); | ^^^^ error[E0308]: mismatched types - --> $DIR/numeric-literal-cast.rs:17:10 + --> $DIR/numeric-literal-cast.rs:18:10 | LL | foo1(2f32); | ^^^^ expected f64, found f32 @@ -19,7 +19,7 @@ LL | foo1(2f64); | ^^^^ error[E0308]: mismatched types - --> $DIR/numeric-literal-cast.rs:18:10 + --> $DIR/numeric-literal-cast.rs:20:10 | LL | foo2(3i16); | ^^^^ expected i32, found i16 diff --git a/src/test/ui/nll/issue-52086.rs b/src/test/ui/nll/issue-52086.rs index 248f4ba0660..679567816c5 100644 --- a/src/test/ui/nll/issue-52086.rs +++ b/src/test/ui/nll/issue-52086.rs @@ -18,7 +18,9 @@ struct Bar { field: Vec<i32> } fn main() { let x = Rc::new(Bar { field: vec![] }); drop(x.field); +//~^ ERROR cannot move out of an `Rc` let y = Arc::new(Bar { field: vec![] }); drop(y.field); +//~^ ERROR cannot move out of an `Arc` } diff --git a/src/test/ui/nll/issue-52086.stderr b/src/test/ui/nll/issue-52086.stderr index 1455c49ea16..1834b9bea9a 100644 --- a/src/test/ui/nll/issue-52086.stderr +++ b/src/test/ui/nll/issue-52086.stderr @@ -5,7 +5,7 @@ LL | drop(x.field); | ^^^^^^^ cannot move out of an `Rc` error[E0507]: cannot move out of an `Arc` - --> $DIR/issue-52086.rs:23:10 + --> $DIR/issue-52086.rs:24:10 | LL | drop(y.field); | ^^^^^^^ cannot move out of an `Arc` diff --git a/src/test/ui/nll/issue-52534-1.rs b/src/test/ui/nll/issue-52534-1.rs index cd6c10335cc..07f9cf74d20 100644 --- a/src/test/ui/nll/issue-52534-1.rs +++ b/src/test/ui/nll/issue-52534-1.rs @@ -17,37 +17,45 @@ impl Test { fn bar(&self, x: &u32) -> &u32 { let x = 22; &x +//~^ ERROR cannot return reference to local variable } } fn foo(x: &u32) -> &u32 { let x = 22; &x +//~^ ERROR cannot return reference to local variable } fn baz(x: &u32) -> &&u32 { let x = 22; &&x +//~^ ERROR cannot return value referencing local variable +//~| ERROR cannot return reference to temporary value } fn foobazbar<'a>(x: u32, y: &'a u32) -> &'a u32 { let x = 22; &x +//~^ ERROR cannot return reference to local variable } fn foobar<'a>(x: &'a u32) -> &'a u32 { let x = 22; &x +//~^ ERROR cannot return reference to local variable } fn foobaz<'a, 'b>(x: &'a u32, y: &'b u32) -> &'a u32 { let x = 22; &x +//~^ ERROR cannot return reference to local variable } fn foobarbaz<'a, 'b>(x: &'a u32, y: &'b u32, z: &'a u32) -> &'a u32 { let x = 22; &x +//~^ ERROR cannot return reference to local variable } fn main() { } diff --git a/src/test/ui/nll/issue-52534-1.stderr b/src/test/ui/nll/issue-52534-1.stderr index 44a3ef3bb5d..e6556cd5134 100644 --- a/src/test/ui/nll/issue-52534-1.stderr +++ b/src/test/ui/nll/issue-52534-1.stderr @@ -5,13 +5,13 @@ LL | &x | ^^ returns a reference to data owned by the current function error[E0515]: cannot return reference to local variable `x` - --> $DIR/issue-52534-1.rs:25:5 + --> $DIR/issue-52534-1.rs:26:5 | LL | &x | ^^ returns a reference to data owned by the current function error[E0515]: cannot return value referencing local variable `x` - --> $DIR/issue-52534-1.rs:30:5 + --> $DIR/issue-52534-1.rs:32:5 | LL | &&x | ^-- @@ -20,7 +20,7 @@ LL | &&x | returns a value referencing data owned by the current function error[E0515]: cannot return reference to temporary value - --> $DIR/issue-52534-1.rs:30:5 + --> $DIR/issue-52534-1.rs:32:5 | LL | &&x | ^-- @@ -29,25 +29,25 @@ LL | &&x | returns a reference to data owned by the current function error[E0515]: cannot return reference to local variable `x` - --> $DIR/issue-52534-1.rs:35:5 + --> $DIR/issue-52534-1.rs:39:5 | LL | &x | ^^ returns a reference to data owned by the current function error[E0515]: cannot return reference to local variable `x` - --> $DIR/issue-52534-1.rs:40:5 + --> $DIR/issue-52534-1.rs:45:5 | LL | &x | ^^ returns a reference to data owned by the current function error[E0515]: cannot return reference to local variable `x` - --> $DIR/issue-52534-1.rs:45:5 + --> $DIR/issue-52534-1.rs:51:5 | LL | &x | ^^ returns a reference to data owned by the current function error[E0515]: cannot return reference to local variable `x` - --> $DIR/issue-52534-1.rs:50:5 + --> $DIR/issue-52534-1.rs:57:5 | LL | &x | ^^ returns a reference to data owned by the current function diff --git a/src/test/ui/nll/issue-52534-2.rs b/src/test/ui/nll/issue-52534-2.rs index 4eac6feac0d..91f9302721e 100644 --- a/src/test/ui/nll/issue-52534-2.rs +++ b/src/test/ui/nll/issue-52534-2.rs @@ -17,6 +17,7 @@ fn foo(x: &u32) -> &u32 { { let x = 32; y = &x +//~^ ERROR does not live long enough } println!("{}", y); diff --git a/src/test/ui/nll/issue-52534-2.stderr b/src/test/ui/nll/issue-52534-2.stderr index 51cd7c7bf3b..8bc463fede1 100644 --- a/src/test/ui/nll/issue-52534-2.stderr +++ b/src/test/ui/nll/issue-52534-2.stderr @@ -3,6 +3,7 @@ error[E0597]: `x` does not live long enough | LL | y = &x | ^^^^^^ borrowed value does not live long enough +LL | //~^ ERROR does not live long enough LL | } | - `x` dropped here while still borrowed LL | diff --git a/src/test/ui/nll/issue-52534.rs b/src/test/ui/nll/issue-52534.rs index 273c9b3c802..bf395a5b3dd 100644 --- a/src/test/ui/nll/issue-52534.rs +++ b/src/test/ui/nll/issue-52534.rs @@ -20,11 +20,13 @@ fn baz(_: impl FnOnce(&u32, u32) -> &u32) { fn bar() { let x = 22; foo(|a| &x) +//~^ ERROR does not live long enough } fn foobar() { let y = 22; baz(|first, second| &y) +//~^ ERROR does not live long enough } fn main() { } diff --git a/src/test/ui/nll/issue-52534.stderr b/src/test/ui/nll/issue-52534.stderr index 00d72546ebc..7c3006b0e58 100644 --- a/src/test/ui/nll/issue-52534.stderr +++ b/src/test/ui/nll/issue-52534.stderr @@ -5,6 +5,7 @@ LL | foo(|a| &x) | - ^ `x` would have to be valid for `'0`... | | | has type `&'0 u32` +LL | //~^ ERROR does not live long enough LL | } | - ...but `x` will be dropped here, when the function `bar` returns | @@ -12,12 +13,13 @@ LL | } = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch04-02-references-and-borrowing.html#dangling-references> error[E0597]: `y` does not live long enough - --> $DIR/issue-52534.rs:27:26 + --> $DIR/issue-52534.rs:28:26 | LL | baz(|first, second| &y) | ----- ^ `y` would have to be valid for `'0`... | | | has type `&'0 u32` +LL | //~^ ERROR does not live long enough LL | } | - ...but `y` will be dropped here, when the function `foobar` returns | diff --git a/src/test/ui/nll/issue-52669.rs b/src/test/ui/nll/issue-52669.rs index 17a59997e91..7bf0c7b8784 100644 --- a/src/test/ui/nll/issue-52669.rs +++ b/src/test/ui/nll/issue-52669.rs @@ -23,6 +23,7 @@ fn bar(mut a: A) -> B { a.b = B; foo(a); a.b.clone() +//~^ ERROR borrow of moved value } fn main() {} diff --git a/src/test/ui/nll/issue-53040.rs b/src/test/ui/nll/issue-53040.rs index 2b6e67be6d9..a08e7ffd501 100644 --- a/src/test/ui/nll/issue-53040.rs +++ b/src/test/ui/nll/issue-53040.rs @@ -13,4 +13,5 @@ fn main() { let mut v: Vec<()> = Vec::new(); || &mut v; +//~^ ERROR captured variable cannot escape `FnMut` closure body } diff --git a/src/test/ui/nll/issue-53807.rs b/src/test/ui/nll/issue-53807.rs index 791dee2fb31..007e40ed562 100644 --- a/src/test/ui/nll/issue-53807.rs +++ b/src/test/ui/nll/issue-53807.rs @@ -10,8 +10,10 @@ pub fn main(){ let maybe = Some(vec![true, true]); - loop { + loop { if let Some(thing) = maybe { +//~^ ERROR use of partially moved value +//~| ERROR use of moved value } } } diff --git a/src/test/ui/nll/issue-54382-use-span-of-tail-of-block.nll.stderr b/src/test/ui/nll/issue-54382-use-span-of-tail-of-block.nll.stderr index c308562c0cc..8412cbdc54b 100644 --- a/src/test/ui/nll/issue-54382-use-span-of-tail-of-block.nll.stderr +++ b/src/test/ui/nll/issue-54382-use-span-of-tail-of-block.nll.stderr @@ -6,7 +6,7 @@ LL | D("other").next(&_thing1) | | | | | borrowed value does not live long enough | a temporary with access to the borrow is created here ... -LL | } +... LL | } | - `_thing1` dropped here while still borrowed LL | diff --git a/src/test/ui/nll/issue-54382-use-span-of-tail-of-block.rs b/src/test/ui/nll/issue-54382-use-span-of-tail-of-block.rs index 99eafe0e9d1..312e6dce8c7 100644 --- a/src/test/ui/nll/issue-54382-use-span-of-tail-of-block.rs +++ b/src/test/ui/nll/issue-54382-use-span-of-tail-of-block.rs @@ -5,6 +5,7 @@ fn main() { let _thing2 = D("thing2"); side_effects(); D("other").next(&_thing1) +//~^ ERROR does not live long enough } } diff --git a/src/test/ui/nll/issue-54382-use-span-of-tail-of-block.stderr b/src/test/ui/nll/issue-54382-use-span-of-tail-of-block.stderr index eeba7d6bb44..8d23891e1ba 100644 --- a/src/test/ui/nll/issue-54382-use-span-of-tail-of-block.stderr +++ b/src/test/ui/nll/issue-54382-use-span-of-tail-of-block.stderr @@ -3,7 +3,7 @@ error[E0597]: `_thing1` does not live long enough | LL | D("other").next(&_thing1) | ^^^^^^^ borrowed value does not live long enough -LL | } +... LL | } | - `_thing1` dropped here while still borrowed LL | diff --git a/src/test/ui/nll/issue-54556-niconii.nll.stderr b/src/test/ui/nll/issue-54556-niconii.nll.stderr index 40cd04de5ec..58239fe6e88 100644 --- a/src/test/ui/nll/issue-54556-niconii.nll.stderr +++ b/src/test/ui/nll/issue-54556-niconii.nll.stderr @@ -1,7 +1,7 @@ error[E0597]: `counter` does not live long enough --> $DIR/issue-54556-niconii.rs:22:20 | -LL | if let Ok(_) = counter.lock() { } +LL | if let Ok(_) = counter.lock() { } //~ ERROR does not live long enough | ^^^^^^^------- | | | borrowed value does not live long enough diff --git a/src/test/ui/nll/issue-54556-niconii.rs b/src/test/ui/nll/issue-54556-niconii.rs index 49b063f44f4..cae389e8ccb 100644 --- a/src/test/ui/nll/issue-54556-niconii.rs +++ b/src/test/ui/nll/issue-54556-niconii.rs @@ -19,7 +19,7 @@ impl Mutex { fn main() { let counter = Mutex; - if let Ok(_) = counter.lock() { } + if let Ok(_) = counter.lock() { } //~ ERROR does not live long enough // With this code as written, the dynamic semantics here implies // that `Mutex::drop` for `counter` runs *before* diff --git a/src/test/ui/nll/issue-54556-niconii.stderr b/src/test/ui/nll/issue-54556-niconii.stderr index 2d0de26ab30..03a7b94d181 100644 --- a/src/test/ui/nll/issue-54556-niconii.stderr +++ b/src/test/ui/nll/issue-54556-niconii.stderr @@ -1,7 +1,7 @@ error[E0597]: `counter` does not live long enough --> $DIR/issue-54556-niconii.rs:22:20 | -LL | if let Ok(_) = counter.lock() { } +LL | if let Ok(_) = counter.lock() { } //~ ERROR does not live long enough | ^^^^^^^ borrowed value does not live long enough ... LL | } diff --git a/src/test/ui/nll/issue-54556-stephaneyfx.nll.stderr b/src/test/ui/nll/issue-54556-stephaneyfx.nll.stderr index 0bf76485eef..b58454427af 100644 --- a/src/test/ui/nll/issue-54556-stephaneyfx.nll.stderr +++ b/src/test/ui/nll/issue-54556-stephaneyfx.nll.stderr @@ -1,7 +1,7 @@ error[E0597]: `stmt` does not live long enough --> $DIR/issue-54556-stephaneyfx.rs:27:21 | -LL | let rows = Rows(&stmt); +LL | let rows = Rows(&stmt); //~ ERROR does not live long enough | ^^^^^ borrowed value does not live long enough LL | rows.map(|row| row).next() | ------------------- a temporary with access to the borrow is created here ... diff --git a/src/test/ui/nll/issue-54556-stephaneyfx.rs b/src/test/ui/nll/issue-54556-stephaneyfx.rs index 10a4e21497c..b758228e49c 100644 --- a/src/test/ui/nll/issue-54556-stephaneyfx.rs +++ b/src/test/ui/nll/issue-54556-stephaneyfx.rs @@ -24,7 +24,7 @@ impl<'stmt> Iterator for Rows<'stmt> { fn get_names() -> Option<String> { let stmt = Statement; - let rows = Rows(&stmt); + let rows = Rows(&stmt); //~ ERROR does not live long enough rows.map(|row| row).next() // let x = rows.map(|row| row).next(); // x diff --git a/src/test/ui/nll/issue-54556-stephaneyfx.stderr b/src/test/ui/nll/issue-54556-stephaneyfx.stderr index 4e581a516b2..bf3285a73c7 100644 --- a/src/test/ui/nll/issue-54556-stephaneyfx.stderr +++ b/src/test/ui/nll/issue-54556-stephaneyfx.stderr @@ -1,7 +1,7 @@ error[E0597]: `stmt` does not live long enough --> $DIR/issue-54556-stephaneyfx.rs:27:22 | -LL | let rows = Rows(&stmt); +LL | let rows = Rows(&stmt); //~ ERROR does not live long enough | ^^^^ borrowed value does not live long enough ... LL | } diff --git a/src/test/ui/nll/issue-54556-temps-in-tail-diagnostic.nll.stderr b/src/test/ui/nll/issue-54556-temps-in-tail-diagnostic.nll.stderr index 513dca7950a..1bc43017bc6 100644 --- a/src/test/ui/nll/issue-54556-temps-in-tail-diagnostic.nll.stderr +++ b/src/test/ui/nll/issue-54556-temps-in-tail-diagnostic.nll.stderr @@ -1,7 +1,7 @@ error[E0597]: `_thing1` does not live long enough --> $DIR/issue-54556-temps-in-tail-diagnostic.rs:5:11 | -LL | D(&_thing1).end() +LL | D(&_thing1).end() //~ ERROR does not live long enough | --^^^^^^^^- | | | | | borrowed value does not live long enough diff --git a/src/test/ui/nll/issue-54556-temps-in-tail-diagnostic.rs b/src/test/ui/nll/issue-54556-temps-in-tail-diagnostic.rs index 63b04333de4..2935caaf25c 100644 --- a/src/test/ui/nll/issue-54556-temps-in-tail-diagnostic.rs +++ b/src/test/ui/nll/issue-54556-temps-in-tail-diagnostic.rs @@ -2,7 +2,7 @@ fn main() { { let mut _thing1 = D(Box::new("thing1")); // D("other").next(&_thing1).end() - D(&_thing1).end() + D(&_thing1).end() //~ ERROR does not live long enough } ; diff --git a/src/test/ui/nll/issue-54556-temps-in-tail-diagnostic.stderr b/src/test/ui/nll/issue-54556-temps-in-tail-diagnostic.stderr index a74970f7118..ca636e76132 100644 --- a/src/test/ui/nll/issue-54556-temps-in-tail-diagnostic.stderr +++ b/src/test/ui/nll/issue-54556-temps-in-tail-diagnostic.stderr @@ -1,7 +1,7 @@ error[E0597]: `_thing1` does not live long enough --> $DIR/issue-54556-temps-in-tail-diagnostic.rs:5:12 | -LL | D(&_thing1).end() +LL | D(&_thing1).end() //~ ERROR does not live long enough | ^^^^^^^ borrowed value does not live long enough LL | } | - `_thing1` dropped here while still borrowed diff --git a/src/test/ui/nll/issue-54556-used-vs-unused-tails.nll.stderr b/src/test/ui/nll/issue-54556-used-vs-unused-tails.nll.stderr index 9911fc97291..52d0870b78f 100644 --- a/src/test/ui/nll/issue-54556-used-vs-unused-tails.nll.stderr +++ b/src/test/ui/nll/issue-54556-used-vs-unused-tails.nll.stderr @@ -11,7 +11,7 @@ LL | { let mut _t1 = D(Box::new("t1")); D(&_t1).end() } ; // = note: The temporary is part of an expression at the end of a block. Consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped. error[E0597]: `_t1` does not live long enough - --> $DIR/issue-54556-used-vs-unused-tails.rs:12:55 + --> $DIR/issue-54556-used-vs-unused-tails.rs:13:55 | LL | { { let mut _t1 = D(Box::new("t1")); D(&_t1).end() } } ; // suggest `;` | --^^^^- - - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D` @@ -23,7 +23,7 @@ LL | { { let mut _t1 = D(Box::new("t1")); D(&_t1).end() } } ; // = note: The temporary is part of an expression at the end of a block. Consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped. error[E0597]: `_t1` does not live long enough - --> $DIR/issue-54556-used-vs-unused-tails.rs:14:55 + --> $DIR/issue-54556-used-vs-unused-tails.rs:16:55 | LL | { { let mut _t1 = D(Box::new("t1")); D(&_t1).end() }; } // suggest `;` | --^^^^- -- ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D` @@ -35,7 +35,7 @@ LL | { { let mut _t1 = D(Box::new("t1")); D(&_t1).end() }; } // = note: The temporary is part of an expression at the end of a block. Consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped. error[E0597]: `_t1` does not live long enough - --> $DIR/issue-54556-used-vs-unused-tails.rs:16:55 + --> $DIR/issue-54556-used-vs-unused-tails.rs:19:55 | LL | let _ = { let mut _t1 = D(Box::new("t1")); D(&_t1).end() } ; // suggest `;` | --^^^^- - - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D` @@ -47,7 +47,7 @@ LL | let _ = { let mut _t1 = D(Box::new("t1")); D(&_t1).end() } ; // = note: The temporary is part of an expression at the end of a block. Consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped. error[E0597]: `_t1` does not live long enough - --> $DIR/issue-54556-used-vs-unused-tails.rs:18:55 + --> $DIR/issue-54556-used-vs-unused-tails.rs:22:55 | LL | let _u = { let mut _t1 = D(Box::new("t1")); D(&_t1).unit() } ; // suggest `;` | --^^^^- - - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D` @@ -59,7 +59,7 @@ LL | let _u = { let mut _t1 = D(Box::new("t1")); D(&_t1).unit() } ; // = note: The temporary is part of an expression at the end of a block. Consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped. error[E0597]: `_t1` does not live long enough - --> $DIR/issue-54556-used-vs-unused-tails.rs:20:55 + --> $DIR/issue-54556-used-vs-unused-tails.rs:25:55 | LL | let _x = { let mut _t1 = D(Box::new("t1")); D(&_t1).end() } ; // `let x = ...; x` | --^^^^- - - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D` @@ -71,7 +71,7 @@ LL | let _x = { let mut _t1 = D(Box::new("t1")); D(&_t1).end() } ; // = note: The temporary is part of an expression at the end of a block. Consider forcing this temporary to be dropped sooner, before the block's local variables are dropped. For example, you could save the expression's value in a new local variable `x` and then make `x` be the expression at the end of the block. error[E0597]: `_t1` does not live long enough - --> $DIR/issue-54556-used-vs-unused-tails.rs:24:55 + --> $DIR/issue-54556-used-vs-unused-tails.rs:30:55 | LL | _y = { let mut _t1 = D(Box::new("t1")); D(&_t1).end() } ; // `let x = ...; x` | --^^^^- - - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D` @@ -83,7 +83,7 @@ LL | _y = { let mut _t1 = D(Box::new("t1")); D(&_t1).end() } ; // `l = note: The temporary is part of an expression at the end of a block. Consider forcing this temporary to be dropped sooner, before the block's local variables are dropped. For example, you could save the expression's value in a new local variable `x` and then make `x` be the expression at the end of the block. error[E0597]: `_t1` does not live long enough - --> $DIR/issue-54556-used-vs-unused-tails.rs:30:55 + --> $DIR/issue-54556-used-vs-unused-tails.rs:37:55 | LL | fn f_local_ref() { let mut _t1 = D(Box::new("t1")); D(&_t1).unit() } // suggest `;` | --^^^^- - @@ -96,7 +96,7 @@ LL | fn f_local_ref() { let mut _t1 = D(Box::new("t1")); D(&_t1).unit() } // = note: The temporary is part of an expression at the end of a block. Consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped. error[E0597]: `_t1` does not live long enough - --> $DIR/issue-54556-used-vs-unused-tails.rs:32:55 + --> $DIR/issue-54556-used-vs-unused-tails.rs:40:55 | LL | fn f() -> String { let mut _t1 = D(Box::new("t1")); D(&_t1).end() } // `let x = ...; x` | --^^^^- - diff --git a/src/test/ui/nll/issue-54556-used-vs-unused-tails.rs b/src/test/ui/nll/issue-54556-used-vs-unused-tails.rs index 64e4f75724a..0d96767a05d 100644 --- a/src/test/ui/nll/issue-54556-used-vs-unused-tails.rs +++ b/src/test/ui/nll/issue-54556-used-vs-unused-tails.rs @@ -8,29 +8,37 @@ fn main() { { let mut _t1 = D(Box::new("t1")); D(&_t1).end() } ; // suggest `;` +//~^ ERROR does not live long enough { { let mut _t1 = D(Box::new("t1")); D(&_t1).end() } } ; // suggest `;` +//~^ ERROR does not live long enough { { let mut _t1 = D(Box::new("t1")); D(&_t1).end() }; } // suggest `;` +//~^ ERROR does not live long enough let _ = { let mut _t1 = D(Box::new("t1")); D(&_t1).end() } ; // suggest `;` +//~^ ERROR does not live long enough let _u = { let mut _t1 = D(Box::new("t1")); D(&_t1).unit() } ; // suggest `;` +//~^ ERROR does not live long enough let _x = { let mut _t1 = D(Box::new("t1")); D(&_t1).end() } ; // `let x = ...; x` +//~^ ERROR does not live long enough let _x = { let mut _t1 = D(Box::new("t1")); let x = D(&_t1).end(); x } ; // no error let mut _y; _y = { let mut _t1 = D(Box::new("t1")); D(&_t1).end() } ; // `let x = ...; x` +//~^ ERROR does not live long enough _y = { let mut _t1 = D(Box::new("t1")); let x = D(&_t1).end(); x } ; // no error } fn f_param_ref(_t1: D<Box<&'static str>>) { D(&_t1).unit() } // no error fn f_local_ref() { let mut _t1 = D(Box::new("t1")); D(&_t1).unit() } // suggest `;` +//~^ ERROR does not live long enough fn f() -> String { let mut _t1 = D(Box::new("t1")); D(&_t1).end() } // `let x = ...; x` - +//~^ ERROR does not live long enough #[derive(Debug)] struct D<T: std::fmt::Debug>(T); diff --git a/src/test/ui/nll/issue-54556-used-vs-unused-tails.stderr b/src/test/ui/nll/issue-54556-used-vs-unused-tails.stderr index c75707b2aee..e9e4e51136d 100644 --- a/src/test/ui/nll/issue-54556-used-vs-unused-tails.stderr +++ b/src/test/ui/nll/issue-54556-used-vs-unused-tails.stderr @@ -8,7 +8,7 @@ LL | { let mut _t1 = D(Box::new("t1")); D(&_t1).end() } ; // | borrowed value does not live long enough error[E0597]: `_t1` does not live long enough - --> $DIR/issue-54556-used-vs-unused-tails.rs:12:56 + --> $DIR/issue-54556-used-vs-unused-tails.rs:13:56 | LL | { { let mut _t1 = D(Box::new("t1")); D(&_t1).end() } } ; // suggest `;` | ^^^ - - borrowed value needs to live until here @@ -17,7 +17,7 @@ LL | { { let mut _t1 = D(Box::new("t1")); D(&_t1).end() } } ; // | borrowed value does not live long enough error[E0597]: `_t1` does not live long enough - --> $DIR/issue-54556-used-vs-unused-tails.rs:14:56 + --> $DIR/issue-54556-used-vs-unused-tails.rs:16:56 | LL | { { let mut _t1 = D(Box::new("t1")); D(&_t1).end() }; } // suggest `;` | ^^^ -- borrowed value needs to live until here @@ -26,7 +26,7 @@ LL | { { let mut _t1 = D(Box::new("t1")); D(&_t1).end() }; } // | borrowed value does not live long enough error[E0597]: `_t1` does not live long enough - --> $DIR/issue-54556-used-vs-unused-tails.rs:16:56 + --> $DIR/issue-54556-used-vs-unused-tails.rs:19:56 | LL | let _ = { let mut _t1 = D(Box::new("t1")); D(&_t1).end() } ; // suggest `;` | ^^^ - - borrowed value needs to live until here @@ -35,7 +35,7 @@ LL | let _ = { let mut _t1 = D(Box::new("t1")); D(&_t1).end() } ; // | borrowed value does not live long enough error[E0597]: `_t1` does not live long enough - --> $DIR/issue-54556-used-vs-unused-tails.rs:18:56 + --> $DIR/issue-54556-used-vs-unused-tails.rs:22:56 | LL | let _u = { let mut _t1 = D(Box::new("t1")); D(&_t1).unit() } ; // suggest `;` | ^^^ - - borrowed value needs to live until here @@ -44,7 +44,7 @@ LL | let _u = { let mut _t1 = D(Box::new("t1")); D(&_t1).unit() } ; // | borrowed value does not live long enough error[E0597]: `_t1` does not live long enough - --> $DIR/issue-54556-used-vs-unused-tails.rs:20:56 + --> $DIR/issue-54556-used-vs-unused-tails.rs:25:56 | LL | let _x = { let mut _t1 = D(Box::new("t1")); D(&_t1).end() } ; // `let x = ...; x` | ^^^ - - borrowed value needs to live until here @@ -53,7 +53,7 @@ LL | let _x = { let mut _t1 = D(Box::new("t1")); D(&_t1).end() } ; // | borrowed value does not live long enough error[E0597]: `_t1` does not live long enough - --> $DIR/issue-54556-used-vs-unused-tails.rs:24:56 + --> $DIR/issue-54556-used-vs-unused-tails.rs:30:56 | LL | _y = { let mut _t1 = D(Box::new("t1")); D(&_t1).end() } ; // `let x = ...; x` | ^^^ - - borrowed value needs to live until here @@ -62,7 +62,7 @@ LL | _y = { let mut _t1 = D(Box::new("t1")); D(&_t1).end() } ; // `l | borrowed value does not live long enough error[E0597]: `_t1` does not live long enough - --> $DIR/issue-54556-used-vs-unused-tails.rs:30:56 + --> $DIR/issue-54556-used-vs-unused-tails.rs:37:56 | LL | fn f_local_ref() { let mut _t1 = D(Box::new("t1")); D(&_t1).unit() } // suggest `;` | ^^^ - `_t1` dropped here while still borrowed @@ -72,7 +72,7 @@ LL | fn f_local_ref() { let mut _t1 = D(Box::new("t1")); D(&_t1).unit() } // = note: values in a scope are dropped in the opposite order they are created error[E0597]: `_t1` does not live long enough - --> $DIR/issue-54556-used-vs-unused-tails.rs:32:56 + --> $DIR/issue-54556-used-vs-unused-tails.rs:40:56 | LL | fn f() -> String { let mut _t1 = D(Box::new("t1")); D(&_t1).end() } // `let x = ...; x` | ^^^ - `_t1` dropped here while still borrowed diff --git a/src/test/ui/nll/issue-55394.rs b/src/test/ui/nll/issue-55394.rs index 452fc88d1ec..e3968640cdd 100644 --- a/src/test/ui/nll/issue-55394.rs +++ b/src/test/ui/nll/issue-55394.rs @@ -18,7 +18,7 @@ struct Foo<'s> { impl Foo<'_> { fn new(bar: &mut Bar) -> Self { - Foo { bar } + Foo { bar } //~ ERROR unsatisfied lifetime constraints } } diff --git a/src/test/ui/nll/issue-55394.stderr b/src/test/ui/nll/issue-55394.stderr index 284d7afa6fd..a194e086054 100644 --- a/src/test/ui/nll/issue-55394.stderr +++ b/src/test/ui/nll/issue-55394.stderr @@ -5,7 +5,7 @@ LL | fn new(bar: &mut Bar) -> Self { | - ---- return type is Foo<'2> | | | let's call the lifetime of this reference `'1` -LL | Foo { bar } +LL | Foo { bar } //~ ERROR unsatisfied lifetime constraints | ^^^^^^^^^^^ returning this value requires that `'1` must outlive `'2` error: aborting due to previous error diff --git a/src/test/ui/nll/move-subpaths-moves-root.rs b/src/test/ui/nll/move-subpaths-moves-root.rs index 7a4e518f977..ffa1171c2b7 100644 --- a/src/test/ui/nll/move-subpaths-moves-root.rs +++ b/src/test/ui/nll/move-subpaths-moves-root.rs @@ -13,5 +13,5 @@ fn main() { let x = (vec![1, 2, 3], ); drop(x.0); - drop(x); + drop(x); //~ ERROR use of moved value } diff --git a/src/test/ui/nll/move-subpaths-moves-root.stderr b/src/test/ui/nll/move-subpaths-moves-root.stderr index 76a1279750f..e9c1e7b853d 100644 --- a/src/test/ui/nll/move-subpaths-moves-root.stderr +++ b/src/test/ui/nll/move-subpaths-moves-root.stderr @@ -3,7 +3,7 @@ error[E0382]: use of moved value: `x` | LL | drop(x.0); | --- value moved here -LL | drop(x); +LL | drop(x); //~ ERROR use of moved value | ^ value used here after move | = note: move occurs because `x.0` has type `std::vec::Vec<i32>`, which does not implement the `Copy` trait diff --git a/src/test/ui/nll/relate_tys/universe-violation.rs b/src/test/ui/nll/relate_tys/universe-violation.rs index cc86c8d02d3..d29f8f8af20 100644 --- a/src/test/ui/nll/relate_tys/universe-violation.rs +++ b/src/test/ui/nll/relate_tys/universe-violation.rs @@ -12,6 +12,6 @@ fn make_it() -> fn(&'static u32) -> &'static u32 { fn main() { let a: fn(_) -> _ = make_it(); - let b: fn(&u32) -> &u32 = a; + let b: fn(&u32) -> &u32 = a; //~ ERROR higher-ranked subtype error drop(a); } diff --git a/src/test/ui/nll/relate_tys/universe-violation.stderr b/src/test/ui/nll/relate_tys/universe-violation.stderr index 6dc78789564..0a2e0ed7b2d 100644 --- a/src/test/ui/nll/relate_tys/universe-violation.stderr +++ b/src/test/ui/nll/relate_tys/universe-violation.stderr @@ -1,7 +1,7 @@ error: higher-ranked subtype error --> $DIR/universe-violation.rs:15:31 | -LL | let b: fn(&u32) -> &u32 = a; +LL | let b: fn(&u32) -> &u32 = a; //~ ERROR higher-ranked subtype error | ^ error: aborting due to previous error diff --git a/src/test/ui/nll/user-annotations/cast_static_lifetime.rs b/src/test/ui/nll/user-annotations/cast_static_lifetime.rs index aa2cf85dfd9..2fd59899777 100644 --- a/src/test/ui/nll/user-annotations/cast_static_lifetime.rs +++ b/src/test/ui/nll/user-annotations/cast_static_lifetime.rs @@ -13,5 +13,5 @@ fn main() { let x = 22_u32; - let y: &u32 = (&x) as &'static u32; + let y: &u32 = (&x) as &'static u32; //~ ERROR `x` does not live long enough } diff --git a/src/test/ui/nll/user-annotations/cast_static_lifetime.stderr b/src/test/ui/nll/user-annotations/cast_static_lifetime.stderr index c664746437d..908d03b5dd9 100644 --- a/src/test/ui/nll/user-annotations/cast_static_lifetime.stderr +++ b/src/test/ui/nll/user-annotations/cast_static_lifetime.stderr @@ -1,7 +1,7 @@ error[E0597]: `x` does not live long enough --> $DIR/cast_static_lifetime.rs:16:19 | -LL | let y: &u32 = (&x) as &'static u32; +LL | let y: &u32 = (&x) as &'static u32; //~ ERROR `x` does not live long enough | ^^^^---------------- | | | borrowed value does not live long enough diff --git a/src/test/ui/nll/user-annotations/issue-54124.rs b/src/test/ui/nll/user-annotations/issue-54124.rs index 8cdd390540a..042ad028575 100644 --- a/src/test/ui/nll/user-annotations/issue-54124.rs +++ b/src/test/ui/nll/user-annotations/issue-54124.rs @@ -1,7 +1,8 @@ #![feature(nll)] fn test<'a>() { - let _:fn(&()) = |_:&'a ()| {}; + let _:fn(&()) = |_:&'a ()| {}; //~ ERROR unsatisfied lifetime constraints + //~^ ERROR unsatisfied lifetime constraints } fn main() { diff --git a/src/test/ui/nll/user-annotations/issue-54124.stderr b/src/test/ui/nll/user-annotations/issue-54124.stderr index df5e4b0447c..5b5afaee8df 100644 --- a/src/test/ui/nll/user-annotations/issue-54124.stderr +++ b/src/test/ui/nll/user-annotations/issue-54124.stderr @@ -3,7 +3,7 @@ error: unsatisfied lifetime constraints | LL | fn test<'a>() { | -- lifetime `'a` defined here -LL | let _:fn(&()) = |_:&'a ()| {}; +LL | let _:fn(&()) = |_:&'a ()| {}; //~ ERROR unsatisfied lifetime constraints | ^ - let's call the lifetime of this reference `'1` | | | requires that `'1` must outlive `'a` @@ -13,7 +13,7 @@ error: unsatisfied lifetime constraints | LL | fn test<'a>() { | -- lifetime `'a` defined here -LL | let _:fn(&()) = |_:&'a ()| {}; +LL | let _:fn(&()) = |_:&'a ()| {}; //~ ERROR unsatisfied lifetime constraints | ^ requires that `'a` must outlive `'static` error: aborting due to 2 previous errors diff --git a/src/test/ui/panic-handler/panic-handler-wrong-location.rs b/src/test/ui/panic-handler/panic-handler-wrong-location.rs index 04e02682bc1..441a0d82364 100644 --- a/src/test/ui/panic-handler/panic-handler-wrong-location.rs +++ b/src/test/ui/panic-handler/panic-handler-wrong-location.rs @@ -13,6 +13,6 @@ #![no_std] #![no_main] -#[panic_handler] +#[panic_handler] //~ ERROR `panic_impl` language item must be applied to a function #[no_mangle] static X: u32 = 42; diff --git a/src/test/ui/panic-handler/panic-handler-wrong-location.stderr b/src/test/ui/panic-handler/panic-handler-wrong-location.stderr index f761e26b86e..513c9914362 100644 --- a/src/test/ui/panic-handler/panic-handler-wrong-location.stderr +++ b/src/test/ui/panic-handler/panic-handler-wrong-location.stderr @@ -1,7 +1,7 @@ error[E0718]: `panic_impl` language item must be applied to a function --> $DIR/panic-handler-wrong-location.rs:16:1 | -LL | #[panic_handler] +LL | #[panic_handler] //~ ERROR `panic_impl` language item must be applied to a function | ^^^^^^^^^^^^^^^^ attribute should be applied to a function, not a static item error: `#[panic_handler]` function required, but not found diff --git a/src/test/ui/parser/if-in-in.rs b/src/test/ui/parser/if-in-in.rs index 735d571938a..70088631db6 100644 --- a/src/test/ui/parser/if-in-in.rs +++ b/src/test/ui/parser/if-in-in.rs @@ -1,7 +1,7 @@ // compile-flags: -Z parse-only fn main() { - for i in in 1..2 { + for i in in 1..2 { //~ ERROR expected iterable, found keyword `in` println!("{}", i); } } diff --git a/src/test/ui/parser/if-in-in.stderr b/src/test/ui/parser/if-in-in.stderr index 65da252fc12..d741c70e580 100644 --- a/src/test/ui/parser/if-in-in.stderr +++ b/src/test/ui/parser/if-in-in.stderr @@ -1,7 +1,7 @@ error: expected iterable, found keyword `in` --> $DIR/if-in-in.rs:4:14 | -LL | for i in in 1..2 { +LL | for i in in 1..2 { //~ ERROR expected iterable, found keyword `in` | ---^^ | | | help: remove the duplicated `in` diff --git a/src/test/ui/regions/regions-struct-not-wf.rs b/src/test/ui/regions/regions-struct-not-wf.rs deleted file mode 100644 index bdd708197bc..00000000000 --- a/src/test/ui/regions/regions-struct-not-wf.rs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2014 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. - -// Various examples of structs whose fields are not well-formed. - -#![allow(dead_code)] - -trait Trait<'a, T> { - type Out; -} -trait Trait1<'a, 'b, T> { - type Out; -} - -impl<'a, T> Trait<'a, T> for usize { - type Out = &'a T; -} - -struct RefOk<'a, T:'a> { - field: &'a T -} - -impl<'a, T> Trait<'a, T> for u32 { - type Out = RefOk<'a, T>; -} - -impl<'a, 'b, T> Trait1<'a, 'b, T> for u32 { - type Out = &'a &'b T; -} - -fn main() { } diff --git a/src/test/ui/resolve/issue-22692.rs b/src/test/ui/resolve/issue-22692.rs index 06648c59953..600dd16ae3b 100644 --- a/src/test/ui/resolve/issue-22692.rs +++ b/src/test/ui/resolve/issue-22692.rs @@ -9,5 +9,5 @@ // except according to those terms. fn main() { - let _ = String.new(); + let _ = String.new(); //~ ERROR expected value, found struct `String` } diff --git a/src/test/ui/resolve/issue-22692.stderr b/src/test/ui/resolve/issue-22692.stderr index ecdd4ff855f..b964d3d6781 100644 --- a/src/test/ui/resolve/issue-22692.stderr +++ b/src/test/ui/resolve/issue-22692.stderr @@ -1,7 +1,7 @@ error[E0423]: expected value, found struct `String` --> $DIR/issue-22692.rs:12:13 | -LL | let _ = String.new(); +LL | let _ = String.new(); //~ ERROR expected value, found struct `String` | ^^^^^^---- | | | help: use `::` to access an associated function: `String::new` diff --git a/src/test/ui/resolve/issue-54379.rs b/src/test/ui/resolve/issue-54379.rs index 24aa758ea6c..60949a6e598 100644 --- a/src/test/ui/resolve/issue-54379.rs +++ b/src/test/ui/resolve/issue-54379.rs @@ -15,7 +15,9 @@ fn main() { let thing = MyStruct { s1: None }; match thing { - MyStruct { .., Some(_) } => {}, + MyStruct { .., Some(_) } => {}, //~ ERROR pattern does not mention field `s1` + //~^ ERROR expected `,` + //~| ERROR expected `}`, found `,` _ => {} } } diff --git a/src/test/ui/resolve/issue-54379.stderr b/src/test/ui/resolve/issue-54379.stderr index d1d693a3817..49612a41ad3 100644 --- a/src/test/ui/resolve/issue-54379.stderr +++ b/src/test/ui/resolve/issue-54379.stderr @@ -1,7 +1,7 @@ error: expected `}`, found `,` --> $DIR/issue-54379.rs:18:22 | -LL | MyStruct { .., Some(_) } => {}, +LL | MyStruct { .., Some(_) } => {}, //~ ERROR pattern does not mention field `s1` | --^ | | | | | expected `}` @@ -10,13 +10,13 @@ LL | MyStruct { .., Some(_) } => {}, error: expected `,` --> $DIR/issue-54379.rs:18:24 | -LL | MyStruct { .., Some(_) } => {}, +LL | MyStruct { .., Some(_) } => {}, //~ ERROR pattern does not mention field `s1` | ^^^^ error[E0027]: pattern does not mention field `s1` --> $DIR/issue-54379.rs:18:9 | -LL | MyStruct { .., Some(_) } => {}, +LL | MyStruct { .., Some(_) } => {}, //~ ERROR pattern does not mention field `s1` | ^^^^^^^^^^^^^^^^^^^^^^^^ missing field `s1` error: aborting due to 3 previous errors diff --git a/src/test/ui/rfc-2093-infer-outlives/regions-struct-not-wf.rs b/src/test/ui/rfc-2093-infer-outlives/regions-struct-not-wf.rs index bdd708197bc..e8bb584f0bb 100644 --- a/src/test/ui/rfc-2093-infer-outlives/regions-struct-not-wf.rs +++ b/src/test/ui/rfc-2093-infer-outlives/regions-struct-not-wf.rs @@ -20,7 +20,7 @@ trait Trait1<'a, 'b, T> { } impl<'a, T> Trait<'a, T> for usize { - type Out = &'a T; + type Out = &'a T; //~ ERROR `T` may not live long enough } struct RefOk<'a, T:'a> { @@ -28,11 +28,11 @@ struct RefOk<'a, T:'a> { } impl<'a, T> Trait<'a, T> for u32 { - type Out = RefOk<'a, T>; + type Out = RefOk<'a, T>; //~ ERROR `T` may not live long enough } impl<'a, 'b, T> Trait1<'a, 'b, T> for u32 { - type Out = &'a &'b T; + type Out = &'a &'b T; //~ ERROR reference has a longer lifetime than the data } fn main() { } diff --git a/src/test/ui/rfc-2093-infer-outlives/regions-struct-not-wf.stderr b/src/test/ui/rfc-2093-infer-outlives/regions-struct-not-wf.stderr index d8c8b6c3ccc..35a4f0cc725 100644 --- a/src/test/ui/rfc-2093-infer-outlives/regions-struct-not-wf.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/regions-struct-not-wf.stderr @@ -3,13 +3,13 @@ error[E0309]: the parameter type `T` may not live long enough | LL | impl<'a, T> Trait<'a, T> for usize { | - help: consider adding an explicit lifetime bound `T: 'a`... -LL | type Out = &'a T; +LL | type Out = &'a T; //~ ERROR `T` may not live long enough | ^^^^^^^^^^^^^^^^^ | note: ...so that the reference type `&'a T` does not outlive the data it points at --> $DIR/regions-struct-not-wf.rs:23:5 | -LL | type Out = &'a T; +LL | type Out = &'a T; //~ ERROR `T` may not live long enough | ^^^^^^^^^^^^^^^^^ error[E0309]: the parameter type `T` may not live long enough @@ -17,19 +17,19 @@ error[E0309]: the parameter type `T` may not live long enough | LL | impl<'a, T> Trait<'a, T> for u32 { | - help: consider adding an explicit lifetime bound `T: 'a`... -LL | type Out = RefOk<'a, T>; +LL | type Out = RefOk<'a, T>; //~ ERROR `T` may not live long enough | ^^^^^^^^^^^^^^^^^^^^^^^^ | note: ...so that the type `T` will meet its required lifetime bounds --> $DIR/regions-struct-not-wf.rs:31:5 | -LL | type Out = RefOk<'a, T>; +LL | type Out = RefOk<'a, T>; //~ ERROR `T` may not live long enough | ^^^^^^^^^^^^^^^^^^^^^^^^ error[E0491]: in type `&'a &'b T`, reference has a longer lifetime than the data it references --> $DIR/regions-struct-not-wf.rs:35:5 | -LL | type Out = &'a &'b T; +LL | type Out = &'a &'b T; //~ ERROR reference has a longer lifetime than the data | ^^^^^^^^^^^^^^^^^^^^^ | note: the pointer is valid for the lifetime 'a as defined on the impl at 34:6 diff --git a/src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.nll.stderr b/src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.nll.stderr index 218a1d5b5fd..0b3f59fd7e4 100644 --- a/src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.nll.stderr +++ b/src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.nll.stderr @@ -3,7 +3,7 @@ error[E0382]: use of moved value: `a` | LL | let _ = dbg!(a); | ------- value moved here -LL | let _ = dbg!(a); +LL | let _ = dbg!(a); //~ ERROR use of moved value | ^ value used here after move | = note: move occurs because `a` has type `NoCopy`, which does not implement the `Copy` trait diff --git a/src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.rs b/src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.rs index 06a23ea1767..e6ddb3d91bf 100644 --- a/src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.rs +++ b/src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.rs @@ -6,5 +6,6 @@ struct NoCopy(usize); fn main() { let a = NoCopy(0); let _ = dbg!(a); - let _ = dbg!(a); + let _ = dbg!(a); //~ ERROR use of moved value + //~^ ERROR use of moved value } diff --git a/src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.stderr b/src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.stderr index cfc318c1cd0..5f3a6b414e0 100644 --- a/src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.stderr +++ b/src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.stderr @@ -3,7 +3,7 @@ error[E0382]: use of moved value: `a` | LL | let _ = dbg!(a); | ------- value moved here -LL | let _ = dbg!(a); +LL | let _ = dbg!(a); //~ ERROR use of moved value | ^ value used here after move | = note: move occurs because `a` has type `NoCopy`, which does not implement the `Copy` trait @@ -14,7 +14,7 @@ error[E0382]: use of moved value: `a` | LL | let _ = dbg!(a); | ------- value moved here -LL | let _ = dbg!(a); +LL | let _ = dbg!(a); //~ ERROR use of moved value | ^^^^^^^ value used here after move | = note: move occurs because `a` has type `NoCopy`, which does not implement the `Copy` trait diff --git a/src/test/ui/rfc-2361-dbg-macro/dbg-macro-requires-debug.rs b/src/test/ui/rfc-2361-dbg-macro/dbg-macro-requires-debug.rs index 365e62c8086..bdde484c252 100644 --- a/src/test/ui/rfc-2361-dbg-macro/dbg-macro-requires-debug.rs +++ b/src/test/ui/rfc-2361-dbg-macro/dbg-macro-requires-debug.rs @@ -3,5 +3,5 @@ struct NotDebug; fn main() { - let _: NotDebug = dbg!(NotDebug); + let _: NotDebug = dbg!(NotDebug); //~ ERROR `NotDebug` doesn't implement `std::fmt::Debug` } diff --git a/src/test/ui/rfc-2361-dbg-macro/dbg-macro-requires-debug.stderr b/src/test/ui/rfc-2361-dbg-macro/dbg-macro-requires-debug.stderr index ecab673953d..bd41f7b3405 100644 --- a/src/test/ui/rfc-2361-dbg-macro/dbg-macro-requires-debug.stderr +++ b/src/test/ui/rfc-2361-dbg-macro/dbg-macro-requires-debug.stderr @@ -1,7 +1,7 @@ error[E0277]: `NotDebug` doesn't implement `std::fmt::Debug` --> $DIR/dbg-macro-requires-debug.rs:6:23 | -LL | let _: NotDebug = dbg!(NotDebug); +LL | let _: NotDebug = dbg!(NotDebug); //~ ERROR `NotDebug` doesn't implement `std::fmt::Debug` | ^^^^^^^^^^^^^^ `NotDebug` cannot be formatted using `{:?}` | = help: the trait `std::fmt::Debug` is not implemented for `NotDebug` diff --git a/src/test/ui/rfc1598-generic-associated-types/generic-associated-types-where.rs b/src/test/ui/rfc1598-generic-associated-types/generic-associated-types-where.rs index 9b59b24b105..0f67956a6d5 100644 --- a/src/test/ui/rfc1598-generic-associated-types/generic-associated-types-where.rs +++ b/src/test/ui/rfc1598-generic-associated-types/generic-associated-types-where.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(generic_associated_types)] +#![feature(generic_associated_types)] //~ WARN `generic_associated_types` is incomplete // Checking the interaction with this other feature #![feature(associated_type_defaults)] diff --git a/src/test/ui/rfc1598-generic-associated-types/generic-associated-types-where.stderr b/src/test/ui/rfc1598-generic-associated-types/generic-associated-types-where.stderr index 97d5482735f..8801ce3e3a0 100644 --- a/src/test/ui/rfc1598-generic-associated-types/generic-associated-types-where.stderr +++ b/src/test/ui/rfc1598-generic-associated-types/generic-associated-types-where.stderr @@ -1,6 +1,6 @@ warning: the feature `generic_associated_types` is incomplete and may cause the compiler to crash --> $DIR/generic-associated-types-where.rs:11:12 | -LL | #![feature(generic_associated_types)] +LL | #![feature(generic_associated_types)] //~ WARN `generic_associated_types` is incomplete | ^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/rust-2018/local-path-suggestions-2015.rs b/src/test/ui/rust-2018/local-path-suggestions-2015.rs index c691d294822..89fed563039 100644 --- a/src/test/ui/rust-2018/local-path-suggestions-2015.rs +++ b/src/test/ui/rust-2018/local-path-suggestions-2015.rs @@ -31,6 +31,6 @@ mod baz { use foo::Bar; -use foobar::Baz; +use foobar::Baz; //~ ERROR unresolved import `foobar` fn main() { } diff --git a/src/test/ui/rust-2018/local-path-suggestions-2015.stderr b/src/test/ui/rust-2018/local-path-suggestions-2015.stderr index 741b2ca0826..3f56b988a4a 100644 --- a/src/test/ui/rust-2018/local-path-suggestions-2015.stderr +++ b/src/test/ui/rust-2018/local-path-suggestions-2015.stderr @@ -1,7 +1,7 @@ error[E0432]: unresolved import `foobar` --> $DIR/local-path-suggestions-2015.rs:34:5 | -LL | use foobar::Baz; +LL | use foobar::Baz; //~ ERROR unresolved import `foobar` | ^^^^^^ did you mean `aux_baz::foobar`? error: aborting due to previous error diff --git a/src/test/ui/rust-2018/trait-import-suggestions.rs b/src/test/ui/rust-2018/trait-import-suggestions.rs index d603d8212ed..9e5e6980406 100644 --- a/src/test/ui/rust-2018/trait-import-suggestions.rs +++ b/src/test/ui/rust-2018/trait-import-suggestions.rs @@ -29,13 +29,13 @@ mod foo { fn in_foo() { let x: u32 = 22; - x.foobar(); + x.foobar(); //~ ERROR no method named `foobar` } } fn main() { let x: u32 = 22; - x.bar(); - x.baz(); - let y = u32::from_str("33"); + x.bar(); //~ ERROR no method named `bar` + x.baz(); //~ ERROR no method named `baz` + let y = u32::from_str("33"); //~ ERROR no function or associated item named `from_str` } diff --git a/src/test/ui/rust-2018/trait-import-suggestions.stderr b/src/test/ui/rust-2018/trait-import-suggestions.stderr index 59fe7b958e3..d5d996e27ee 100644 --- a/src/test/ui/rust-2018/trait-import-suggestions.stderr +++ b/src/test/ui/rust-2018/trait-import-suggestions.stderr @@ -1,7 +1,7 @@ error[E0599]: no method named `foobar` found for type `u32` in the current scope --> $DIR/trait-import-suggestions.rs:32:11 | -LL | x.foobar(); +LL | x.foobar(); //~ ERROR no method named `foobar` | ^^^^^^ | = help: items from traits can only be used if the trait is in scope @@ -11,7 +11,7 @@ LL | x.foobar(); error[E0599]: no method named `bar` found for type `u32` in the current scope --> $DIR/trait-import-suggestions.rs:38:7 | -LL | x.bar(); +LL | x.bar(); //~ ERROR no method named `bar` | ^^^ | = help: items from traits can only be used if the trait is in scope @@ -23,13 +23,13 @@ LL | use crate::foo::Bar; error[E0599]: no method named `baz` found for type `u32` in the current scope --> $DIR/trait-import-suggestions.rs:39:7 | -LL | x.baz(); +LL | x.baz(); //~ ERROR no method named `baz` | ^^^ error[E0599]: no function or associated item named `from_str` found for type `u32` in the current scope --> $DIR/trait-import-suggestions.rs:40:13 | -LL | let y = u32::from_str("33"); +LL | let y = u32::from_str("33"); //~ ERROR no function or associated item named `from_str` | ^^^^^^^^^^^^^ function or associated item not found in `u32` | = help: items from traits can only be used if the trait is in scope diff --git a/src/test/ui/suggestions/suggest-variants.rs b/src/test/ui/suggestions/suggest-variants.rs index 4a131ed837b..6d6e280d965 100644 --- a/src/test/ui/suggestions/suggest-variants.rs +++ b/src/test/ui/suggestions/suggest-variants.rs @@ -9,7 +9,7 @@ struct S { } fn main() { - println!("My shape is {:?}", Shape::Squareee { size: 5}); - println!("My shape is {:?}", Shape::Circl { size: 5}); - println!("My shape is {:?}", Shape::Rombus{ size: 5}); + println!("My shape is {:?}", Shape::Squareee { size: 5}); //~ ERROR no variant `Squareee` + println!("My shape is {:?}", Shape::Circl { size: 5}); //~ ERROR no variant `Circl` + println!("My shape is {:?}", Shape::Rombus{ size: 5}); //~ ERROR no variant `Rombus` } diff --git a/src/test/ui/suggestions/suggest-variants.stderr b/src/test/ui/suggestions/suggest-variants.stderr index 08ae68ea713..36abda2a89b 100644 --- a/src/test/ui/suggestions/suggest-variants.stderr +++ b/src/test/ui/suggestions/suggest-variants.stderr @@ -1,19 +1,19 @@ error: no variant `Squareee` on enum `Shape` --> $DIR/suggest-variants.rs:12:34 | -LL | println!("My shape is {:?}", Shape::Squareee { size: 5}); +LL | println!("My shape is {:?}", Shape::Squareee { size: 5}); //~ ERROR no variant `Squareee` | ^^^^^^^^^^^^^^^ help: did you mean: `Shape::Square` error: no variant `Circl` on enum `Shape` --> $DIR/suggest-variants.rs:13:34 | -LL | println!("My shape is {:?}", Shape::Circl { size: 5}); +LL | println!("My shape is {:?}", Shape::Circl { size: 5}); //~ ERROR no variant `Circl` | ^^^^^^^^^^^^ help: did you mean: `Shape::Circle` error: no variant `Rombus` on enum `Shape` --> $DIR/suggest-variants.rs:14:34 | -LL | println!("My shape is {:?}", Shape::Rombus{ size: 5}); +LL | println!("My shape is {:?}", Shape::Rombus{ size: 5}); //~ ERROR no variant `Rombus` | ^^^^^^^^^^^^^ unknown variant error: aborting due to 3 previous errors diff --git a/src/test/ui/suggestions/use-type-argument-instead-of-assoc-type.rs b/src/test/ui/suggestions/use-type-argument-instead-of-assoc-type.rs index 58e7718ba5b..a3cc53e69e2 100644 --- a/src/test/ui/suggestions/use-type-argument-instead-of-assoc-type.rs +++ b/src/test/ui/suggestions/use-type-argument-instead-of-assoc-type.rs @@ -3,6 +3,11 @@ pub trait T<X, Y> { type B; type C; } - pub struct Foo { i: Box<T<usize, usize, usize, usize, B=usize>> } +pub struct Foo { + i: Box<T<usize, usize, usize, usize, B=usize>>, + //~^ ERROR must be specified + //~| ERROR wrong number of type arguments +} + - fn main() {} +fn main() {} diff --git a/src/test/ui/suggestions/use-type-argument-instead-of-assoc-type.stderr b/src/test/ui/suggestions/use-type-argument-instead-of-assoc-type.stderr index b62b5d3b04c..16e9fa90aa1 100644 --- a/src/test/ui/suggestions/use-type-argument-instead-of-assoc-type.stderr +++ b/src/test/ui/suggestions/use-type-argument-instead-of-assoc-type.stderr @@ -1,29 +1,29 @@ error[E0107]: wrong number of type arguments: expected 2, found 4 - --> $DIR/use-type-argument-instead-of-assoc-type.rs:6:42 + --> $DIR/use-type-argument-instead-of-assoc-type.rs:7:28 | -LL | pub struct Foo { i: Box<T<usize, usize, usize, usize, B=usize>> } - | ^^^^^ ^^^^^ unexpected type argument - | | - | unexpected type argument +LL | i: Box<T<usize, usize, usize, usize, B=usize>>, + | ^^^^^ ^^^^^ unexpected type argument + | | + | unexpected type argument error[E0191]: the value of the associated types `A` (from the trait `T`), `C` (from the trait `T`) must be specified - --> $DIR/use-type-argument-instead-of-assoc-type.rs:6:26 + --> $DIR/use-type-argument-instead-of-assoc-type.rs:7:12 | LL | type A; | ------- `A` defined here LL | type B; LL | type C; | ------- `C` defined here -LL | } -LL | pub struct Foo { i: Box<T<usize, usize, usize, usize, B=usize>> } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | associated type `A` must be specified - | associated type `C` must be specified +... +LL | i: Box<T<usize, usize, usize, usize, B=usize>>, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | | + | associated type `A` must be specified + | associated type `C` must be specified help: if you meant to specify the associated types, write | -LL | pub struct Foo { i: Box<T<usize, usize, A = usize, C = usize, B=usize>> } - | ^^^^^^^^^ ^^^^^^^^^ +LL | i: Box<T<usize, usize, A = usize, C = usize, B=usize>>, + | ^^^^^^^^^ ^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/traits/trait-alias-impl.rs b/src/test/ui/traits/trait-alias-impl.rs index bf3483000e3..802fdd077aa 100644 --- a/src/test/ui/traits/trait-alias-impl.rs +++ b/src/test/ui/traits/trait-alias-impl.rs @@ -12,6 +12,6 @@ trait DefaultAlias = Default; -impl DefaultAlias for () {} +impl DefaultAlias for () {} //~ ERROR expected trait, found trait alias fn main() {} diff --git a/src/test/ui/traits/trait-alias-impl.stderr b/src/test/ui/traits/trait-alias-impl.stderr index 9ad625176b1..f94e4a40914 100644 --- a/src/test/ui/traits/trait-alias-impl.stderr +++ b/src/test/ui/traits/trait-alias-impl.stderr @@ -1,7 +1,7 @@ error[E0404]: expected trait, found trait alias `DefaultAlias` --> $DIR/trait-alias-impl.rs:15:6 | -LL | impl DefaultAlias for () {} +LL | impl DefaultAlias for () {} //~ ERROR expected trait, found trait alias | ^^^^^^^^^^^^ not a trait error: aborting due to previous error diff --git a/src/test/ui/traits/trait-alias-object.rs b/src/test/ui/traits/trait-alias-object.rs index 3adcd8436d8..4694135e78f 100644 --- a/src/test/ui/traits/trait-alias-object.rs +++ b/src/test/ui/traits/trait-alias-object.rs @@ -14,6 +14,6 @@ trait EqAlias = Eq; trait IteratorAlias = Iterator; fn main() { - let _: &dyn EqAlias = &123; - let _: &dyn IteratorAlias = &vec![123].into_iter(); + let _: &dyn EqAlias = &123; //~ ERROR `EqAlias` cannot be made into an object + let _: &dyn IteratorAlias = &vec![123].into_iter(); //~ ERROR must be specified } diff --git a/src/test/ui/traits/trait-alias-object.stderr b/src/test/ui/traits/trait-alias-object.stderr index fdb9427cba7..9d9c142802d 100644 --- a/src/test/ui/traits/trait-alias-object.stderr +++ b/src/test/ui/traits/trait-alias-object.stderr @@ -1,7 +1,7 @@ error[E0038]: the trait `EqAlias` cannot be made into an object --> $DIR/trait-alias-object.rs:17:13 | -LL | let _: &dyn EqAlias = &123; +LL | let _: &dyn EqAlias = &123; //~ ERROR `EqAlias` cannot be made into an object | ^^^^^^^^^^^ the trait `EqAlias` cannot be made into an object | = note: the trait cannot use `Self` as a type parameter in the supertraits or where-clauses @@ -9,7 +9,7 @@ LL | let _: &dyn EqAlias = &123; error[E0191]: the value of the associated type `Item` (from the trait `std::iter::Iterator`) must be specified --> $DIR/trait-alias-object.rs:18:13 | -LL | let _: &dyn IteratorAlias = &vec![123].into_iter(); +LL | let _: &dyn IteratorAlias = &vec![123].into_iter(); //~ ERROR must be specified | ^^^^^^^^^^^^^^^^^ associated type `Item` must be specified error: aborting due to 2 previous errors diff --git a/src/test/ui/traits/trait-alias-wf.rs b/src/test/ui/traits/trait-alias-wf.rs index 8c8ce1221ba..59ac5a02da3 100644 --- a/src/test/ui/traits/trait-alias-wf.rs +++ b/src/test/ui/traits/trait-alias-wf.rs @@ -12,6 +12,6 @@ trait Foo {} trait A<T: Foo> {} -trait B<T> = A<T>; // T cannot be unbounded +trait B<T> = A<T>; //~ ERROR `T: Foo` is not satisfied fn main() {} diff --git a/src/test/ui/traits/trait-alias-wf.stderr b/src/test/ui/traits/trait-alias-wf.stderr index e8c81c87796..cae571c4c61 100644 --- a/src/test/ui/traits/trait-alias-wf.stderr +++ b/src/test/ui/traits/trait-alias-wf.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `T: Foo` is not satisfied --> $DIR/trait-alias-wf.rs:15:1 | -LL | trait B<T> = A<T>; // T cannot be unbounded +LL | trait B<T> = A<T>; //~ ERROR `T: Foo` is not satisfied | ^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `T` | = help: consider adding a `where T: Foo` bound diff --git a/src/test/ui/underscore-lifetime/underscore-outlives-bounds.rs b/src/test/ui/underscore-lifetime/underscore-outlives-bounds.rs index b514ff43860..567cc7a3f5f 100644 --- a/src/test/ui/underscore-lifetime/underscore-outlives-bounds.rs +++ b/src/test/ui/underscore-lifetime/underscore-outlives-bounds.rs @@ -4,5 +4,5 @@ // #54902 trait Foo<'a> {} -impl<'b: '_> Foo<'b> for i32 {} +impl<'b: '_> Foo<'b> for i32 {} //~ ERROR `'_` cannot be used here fn main() { } diff --git a/src/test/ui/underscore-lifetime/underscore-outlives-bounds.stderr b/src/test/ui/underscore-lifetime/underscore-outlives-bounds.stderr index 4b38a26f957..e4ff653f3ad 100644 --- a/src/test/ui/underscore-lifetime/underscore-outlives-bounds.stderr +++ b/src/test/ui/underscore-lifetime/underscore-outlives-bounds.stderr @@ -1,7 +1,7 @@ error[E0637]: `'_` cannot be used here --> $DIR/underscore-outlives-bounds.rs:7:10 | -LL | impl<'b: '_> Foo<'b> for i32 {} +LL | impl<'b: '_> Foo<'b> for i32 {} //~ ERROR `'_` cannot be used here | ^^ `'_` is a reserved lifetime name error: aborting due to previous error diff --git a/src/test/ui/wf/wf-outlives-ty-in-fn-or-trait.rs b/src/test/ui/wf/wf-outlives-ty-in-fn-or-trait.rs index afdf59d1e5b..7c6fb8c9969 100644 --- a/src/test/ui/wf/wf-outlives-ty-in-fn-or-trait.rs +++ b/src/test/ui/wf/wf-outlives-ty-in-fn-or-trait.rs @@ -16,7 +16,7 @@ trait Trait<'a, T> { } impl<'a, T> Trait<'a, T> for usize { - type Out = &'a fn(T); + type Out = &'a fn(T); //~ ERROR `T` may not live long enough } struct Foo<'a,T> { @@ -26,7 +26,7 @@ struct Foo<'a,T> { trait Baz<T> { } impl<'a, T> Trait<'a, T> for u32 { - type Out = &'a Baz<T>; + type Out = &'a Baz<T>; //~ ERROR `T` may not live long enough } fn main() { } diff --git a/src/test/ui/wf/wf-outlives-ty-in-fn-or-trait.stderr b/src/test/ui/wf/wf-outlives-ty-in-fn-or-trait.stderr index 26a2138c9f8..0454215290c 100644 --- a/src/test/ui/wf/wf-outlives-ty-in-fn-or-trait.stderr +++ b/src/test/ui/wf/wf-outlives-ty-in-fn-or-trait.stderr @@ -3,13 +3,13 @@ error[E0309]: the parameter type `T` may not live long enough | LL | impl<'a, T> Trait<'a, T> for usize { | - help: consider adding an explicit lifetime bound `T: 'a`... -LL | type Out = &'a fn(T); +LL | type Out = &'a fn(T); //~ ERROR `T` may not live long enough | ^^^^^^^^^^^^^^^^^^^^^ | note: ...so that the reference type `&'a fn(T)` does not outlive the data it points at --> $DIR/wf-outlives-ty-in-fn-or-trait.rs:19:5 | -LL | type Out = &'a fn(T); +LL | type Out = &'a fn(T); //~ ERROR `T` may not live long enough | ^^^^^^^^^^^^^^^^^^^^^ error[E0309]: the parameter type `T` may not live long enough @@ -17,13 +17,13 @@ error[E0309]: the parameter type `T` may not live long enough | LL | impl<'a, T> Trait<'a, T> for u32 { | - help: consider adding an explicit lifetime bound `T: 'a`... -LL | type Out = &'a Baz<T>; +LL | type Out = &'a Baz<T>; //~ ERROR `T` may not live long enough | ^^^^^^^^^^^^^^^^^^^^^^ | note: ...so that the reference type `&'a (dyn Baz<T> + 'a)` does not outlive the data it points at --> $DIR/wf-outlives-ty-in-fn-or-trait.rs:29:5 | -LL | type Out = &'a Baz<T>; +LL | type Out = &'a Baz<T>; //~ ERROR `T` may not live long enough | ^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors |
