diff --git a/src/test/rustdoc-ui/doc-without-codeblock.rs b/src/test/rustdoc-ui/doc-without-codeblock.rs index e047b272c4160..645deff334b8b 100644 --- a/src/test/rustdoc-ui/doc-without-codeblock.rs +++ b/src/test/rustdoc-ui/doc-without-codeblock.rs @@ -1,3 +1,4 @@ +//~ ERROR Missing code example in this documentation // Copyright 2018 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. @@ -11,10 +12,13 @@ #![deny(missing_doc_code_examples)] /// Some docs. +//~^ ERROR Missing code example in this documentation pub struct Foo; /// And then, the princess died. +//~^ ERROR Missing code example in this documentation pub mod foo { /// Or maybe not because she saved herself! + //~^ ERROR Missing code example in this documentation pub fn bar() {} } diff --git a/src/test/rustdoc-ui/doc-without-codeblock.stderr b/src/test/rustdoc-ui/doc-without-codeblock.stderr index ba5bb7fc0b119..f3efc65405049 100644 --- a/src/test/rustdoc-ui/doc-without-codeblock.stderr +++ b/src/test/rustdoc-ui/doc-without-codeblock.stderr @@ -1,25 +1,25 @@ error: Missing code example in this documentation | note: lint level defined here - --> $DIR/doc-without-codeblock.rs:11:9 + --> $DIR/doc-without-codeblock.rs:12:9 | LL | #![deny(missing_doc_code_examples)] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: Missing code example in this documentation - --> $DIR/doc-without-codeblock.rs:13:1 + --> $DIR/doc-without-codeblock.rs:14:1 | LL | /// Some docs. | ^^^^^^^^^^^^^^ error: Missing code example in this documentation - --> $DIR/doc-without-codeblock.rs:16:1 + --> $DIR/doc-without-codeblock.rs:18:1 | LL | /// And then, the princess died. | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: Missing code example in this documentation - --> $DIR/doc-without-codeblock.rs:18:5 + --> $DIR/doc-without-codeblock.rs:21:5 | LL | /// Or maybe not because she saved herself! | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/rustdoc-ui/intra-link-span-ice-55723.rs b/src/test/rustdoc-ui/intra-link-span-ice-55723.rs index 12e59a4813f85..c701548faaa92 100644 --- a/src/test/rustdoc-ui/intra-link-span-ice-55723.rs +++ b/src/test/rustdoc-ui/intra-link-span-ice-55723.rs @@ -17,8 +17,9 @@ // https://github.com/rust-lang/rust/issues/55723 /// ## For example: -/// +/// /// (arr[i]) +//~^ ERROR `[i]` cannot be resolved, ignoring it... pub fn test_ice() { unimplemented!(); } diff --git a/src/test/rustdoc-ui/private-item-doc-test.rs b/src/test/rustdoc-ui/private-item-doc-test.rs index 5a13fe359f527..771dc3bd35112 100644 --- a/src/test/rustdoc-ui/private-item-doc-test.rs +++ b/src/test/rustdoc-ui/private-item-doc-test.rs @@ -16,5 +16,6 @@ mod foo { /// ``` /// assert!(false); /// ``` + //~^^^^^ ERROR Documentation test in private item fn bar() {} } 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 8d91561b7d64f..3153ba47aa9d4 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; fn main() { let _: &I32Iterator = &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 ed2211ecffd2b..1e0514edd66f6 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 {} -trait Bar: Foo {} +trait Bar: Foo {} //~ ERROR type annotations required trait I32Iterator = Iterator; trait U32Iterator = I32Iterator; 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 216aa097db9fb..c3e6eb8605635 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 `::Item == i32` --> $DIR/associated-types-overridden-binding.rs:14:1 | -LL | trait Bar: Foo {} +LL | trait Bar: Foo {} //~ 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 c2c40cd11a63b..c58496c91f513 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 95539ab29dc50..a7543a14325fb 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 073e9d7e6d009..d9ae1b9a167a6 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 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 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 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 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 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 a9e2e3f79ee76..7ba3382ddf129 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 d5727b8db3790..9ddb27916d184 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 580ca3b3a4f6c..96dd48052def8 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 e3b5341d2bcff..4f845d87aa2f8 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 001ed59059cc8..7861087ad02eb 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 b6339c4a3c754..358a5dd1cbdcf 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 0749900986d2e..ad4accbbeeef9 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 = 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 6a12016b2a5e3..d1d7d13088bcc 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 3180823f64327..f3e9ce364d9b4 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 0ccddf0a67d6f..434f318ad1449 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 0ccddf0a67d6f..434f318ad1449 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 25ad66a5d9b4a..2bd71ec25f841 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 dca8f3c474583..7e2a72f237014 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 cbf855633fd2d..6d4b50c1dde89 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 28753f1649abd..ca5a6f7f3d259 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 62e8676e63198..903019590ef10 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 79080fb4eae15..bfeab0c6e6b2c 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 62e8676e63198..903019590ef10 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 79080fb4eae15..bfeab0c6e6b2c 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 62e8676e63198..903019590ef10 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 79080fb4eae15..bfeab0c6e6b2c 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 edc5a84a84367..26742ff9400d1 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 62e8676e63198..903019590ef10 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 79080fb4eae15..bfeab0c6e6b2c 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 ce74e35ac6bb6..73678195492b5 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 8ce721d30a16b..8544b07618b86 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 c7bfa85093f2d..895f9e04d88c9 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 {} +//~^ ERROR is already specified type Unit = (); fn test() -> Box> { +//~^ 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 3a908fceced60..0666e1ede3cf7 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` 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> { | --------- ^^^^^^^^^^^ 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 9c76719e26cf2..34f23152c2dcc 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 82bc6194483c0..4582e3697e269 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 711159647b76a..56ede0104a5fd 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 a2a183f80f92e..52e01c24ace8b 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 b283e28651487..fec0868c540a8 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(PhantomData); let _ = ImplementsTrait::(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 ab90ef8f11f7c..694d2c1e73c82 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(PhantomData); LL | | let _ = ImplementsTrait::(PhantomData); diff --git a/src/test/ui/generator/generator-region-requirements.rs b/src/test/ui/generator/generator-region-requirements.rs index 59e7841309c57..2cda483b6a1c2 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 88b7a52af7fd3..84a0f788b1e7e 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 00358ee502e86..1f79149c5612f 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 571571aa75141..0cca12f8a674f 100644 --- a/src/test/ui/impl-trait/bindings.rs +++ b/src/test/ui/impl-trait/bindings.rs @@ -12,23 +12,27 @@ fn a(x: T) { const foo: impl Clone = x; +//~^ ERROR can't capture dynamic environment in a fn item } fn b(x: T) { let _ = move || { const foo: impl Clone = x; +//~^ ERROR can't capture dynamic environment in a fn item }; } trait Foo { fn a(x: T) { const foo: impl Clone = x; +//~^ ERROR can't capture dynamic environment in a fn item } } impl Foo 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 70a736d2fd18a..91be86f7af3d2 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 7b4a40e26b1bf..fb9e9e17c82e6 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 f6f23be2ab88a..cf8b519059950 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 7a83b098e78fe..a6130d21b5d39 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

(process: P) where P: Process<'static> { let _: Box 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 bcdfcc767fb9e..13e627a492f40 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 efe59c31263bc..ca912b211c42f 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 eb5fb458d8279..c4da18a3c9d63 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 55e51952a8804..4e8b70824b969 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 785932e5ef42a..0ba6ef34b4960 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 eca46484699b3..5135151bd64ed 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 6befee331d5ae..e6040e539c1f1 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 61c7e915fe88c..08cbbd6e5450c 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 41e3e8bbe1452..d4c323da70f92 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 9a2ec7a527326..5e131f0a0d02c 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 c1e4d9089068d..84bf8ed835672 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 dbe8733735e50..5be9c84f28331 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 7c6d87b1d205e..8e146d83066b3 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 a3edecb94f7c5..7826ce6c0f34e 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 d40e2bd3d530c..52397aa8b488b 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 2bf38296f2687..987c940b32057 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 945f5efe4a878..b18d694a5e08b 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 0b6cc36fa52ef..fb7662095d0c6 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 = ref_items.clone(); +//~^ ERROR mismatched types // in that case no suggestion will be triggered let items_clone_2:Vec = 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 9cd8a53615529..ff4660dc702c0 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 = 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 ece3caf78e218..e178007cd6be5 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 961e4c0ff6286..599abe95bb619 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 b980290391d3a..68d838054776e 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 a9f1b4942584d..d4ee94aa411b7 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 b48d4a9c022f4..a172f6a7bfad1 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> { Box::new(self.out_edges(u).map(|e| e.target())) +//~^ ERROR cannot infer } fn in_neighbors(&'a self, u: &Self::Node) -> Box> { 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 60ce8293a5ceb..f8ca0727efb7e 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>::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<>::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<>::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 a7d6e80bae5f7..d2dfc7ec327d3 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 fbe7e0ee74889..495659720c390 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 f54bb81274362..33c84f6fa3582 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 fd74cd7a727e2..582c812a8d6b6 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 78285b8161c38..bdd99ef8d17c0 100644 --- a/src/test/ui/iterators/bound.rs +++ b/src/test/ui/iterators/bound.rs @@ -1,3 +1,4 @@ struct S(I); struct T(S); +//~^ 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 eb959bfbcb533..1c288a7e44f37 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> { +//~^ ERROR missing lifetime Ok(()) } diff --git a/src/test/ui/loud_ui.rs b/src/test/ui/loud_ui.rs new file mode 100644 index 0000000000000..6a151fa49f883 --- /dev/null +++ b/src/test/ui/loud_ui.rs @@ -0,0 +1,6 @@ +// should-fail + +// this test ensures that when we forget to use +// any `//~ ERROR` comments whatsoever, that the test doesn't succeed + +fn main() {} 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 cf8572aefa242..9423f0a359c69 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 macro expansion ends with an incomplete expression }; } diff --git a/src/test/ui/mismatched_types/numeric-literal-cast.rs b/src/test/ui/mismatched_types/numeric-literal-cast.rs index 516b2e8dd30bf..9b5f73296c523 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 e2fe1a0914d4f..3aabbf530f22c 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 248f4ba066023..679567816c58f 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 } 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 1455c49ea161c..1834b9bea9a57 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 cd6c10335ccc6..07f9cf74d20bc 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 44a3ef3bb5d48..e6556cd513446 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 4eac6feac0d9c..91f9302721ea8 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 51cd7c7bf3b40..8bc463fede193 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 273c9b3c8020c..bf395a5b3ddff 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 00d72546ebc4c..7c3006b0e588f 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 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 17a59997e91ea..7bf0c7b8784f8 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 2b6e67be6d98d..a08e7ffd5015e 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 791dee2fb3183..007e40ed56273 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 c308562c0cc76..8412cbdc54b3b 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 99eafe0e9d18f..312e6dce8c795 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 eeba7d6bb445f..8d23891e1ba79 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 40cd04de5ecc1..58239fe6e888d 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 49b063f44f427..cae389e8ccb52 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 2d0de26ab309a..03a7b94d181ba 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 0bf76485eef2a..b58454427af84 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 10a4e21497c73..b758228e49cfc 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 { 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 4e581a516b2d3..bf3285a73c7c5 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 513dca7950af9..1bc43017bc675 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 63b04333de4be..2935caaf25cc1 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 a74970f71182a..ca636e7613265 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 9911fc9729190..52d0870b78f95 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 64e4f75724aad..0d96767a05d03 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>) { 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); 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 c75707b2aee17..e9e4e51136d0a 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 452fc88d1ecdd..e3968640cdd8f 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 284d7afa6fd23..a194e0860546e 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 7a4e518f97778..ffa1171c2b73f 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 76a1279750ff3..e9c1e7b853d44 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`, 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 cc86c8d02d3aa..d29f8f8af208c 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 6dc78789564c7..0a2e0ed7b2db2 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 aa2cf85dfd999..2fd5989977795 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 c664746437d2e..908d03b5dd93f 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 8cdd390540a09..042ad028575bb 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 df5e4b0447ce7..5b5afaee8df71 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 04e02682bc12b..441a0d823643c 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 f761e26b86e71..513c991436224 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 735d571938abf..70088631db66d 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 65da252fc128f..d741c70e58028 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/proc-macro/span-preservation.rs b/src/test/ui/proc-macro/span-preservation.rs index adcb42ab2d1cc..64f675ecc1c4d 100644 --- a/src/test/ui/proc-macro/span-preservation.rs +++ b/src/test/ui/proc-macro/span-preservation.rs @@ -1,3 +1,4 @@ +//~ ERROR mismatched types // aux-build:span-preservation.rs // For each of these, we should get the appropriate type mismatch error message, @@ -9,13 +10,13 @@ use foo::foo; #[foo] fn a() { - let x: usize = "hello";;;;; + let x: usize = "hello";;;;; //~ ERROR mismatched types } #[foo] fn b(x: Option) -> usize { match x { - Some(x) => { return x }, + Some(x) => { return x }, //~ ERROR mismatched types None => 10 } } @@ -31,8 +32,8 @@ fn c() { b: usize } - let x = Foo { a: 10isize }; - let y = Foo { a: 10, b: 10isize }; + let x = Foo { a: 10isize }; //~ ERROR mismatched types + let y = Foo { a: 10, b: 10isize }; //~ ERROR has no field named `b` } // FIXME: This doesn't work at the moment. See the one below. The pretty-printer @@ -45,7 +46,7 @@ extern fn bar() { #[foo] extern "C" fn baz() { - 0 + 0 //~ ERROR mismatched types } fn main() {} diff --git a/src/test/ui/proc-macro/span-preservation.stderr b/src/test/ui/proc-macro/span-preservation.stderr index f33245aec3720..64d0173cb9c22 100644 --- a/src/test/ui/proc-macro/span-preservation.stderr +++ b/src/test/ui/proc-macro/span-preservation.stderr @@ -4,40 +4,40 @@ error[E0308]: mismatched types found type `{integer}` error[E0308]: mismatched types - --> $DIR/span-preservation.rs:12:20 + --> $DIR/span-preservation.rs:13:20 | -LL | let x: usize = "hello";;;;; +LL | let x: usize = "hello";;;;; //~ ERROR mismatched types | ^^^^^^^ expected usize, found reference | = note: expected type `usize` found type `&'static str` error[E0308]: mismatched types - --> $DIR/span-preservation.rs:18:29 + --> $DIR/span-preservation.rs:19:29 | -LL | Some(x) => { return x }, +LL | Some(x) => { return x }, //~ ERROR mismatched types | ^ expected usize, found isize error[E0308]: mismatched types - --> $DIR/span-preservation.rs:34:22 + --> $DIR/span-preservation.rs:35:22 | -LL | let x = Foo { a: 10isize }; +LL | let x = Foo { a: 10isize }; //~ ERROR mismatched types | ^^^^^^^ expected usize, found isize error[E0560]: struct `c::Foo` has no field named `b` - --> $DIR/span-preservation.rs:35:26 + --> $DIR/span-preservation.rs:36:26 | -LL | let y = Foo { a: 10, b: 10isize }; +LL | let y = Foo { a: 10, b: 10isize }; //~ ERROR has no field named `b` | ^ `c::Foo` does not have this field | = note: available fields are: `a` error[E0308]: mismatched types - --> $DIR/span-preservation.rs:48:5 + --> $DIR/span-preservation.rs:49:5 | LL | extern "C" fn baz() { | - possibly return type missing here? -LL | 0 +LL | 0 //~ ERROR mismatched types | ^ expected (), found integral variable | = note: expected type `()` 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 bdd708197bc76..0000000000000 --- 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 or the MIT license -// , 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/regions/regions-struct-not-wf.stderr b/src/test/ui/regions/regions-struct-not-wf.stderr deleted file mode 100644 index d8c8b6c3ccc86..0000000000000 --- a/src/test/ui/regions/regions-struct-not-wf.stderr +++ /dev/null @@ -1,49 +0,0 @@ -error[E0309]: the parameter type `T` may not live long enough - --> $DIR/regions-struct-not-wf.rs:23:5 - | -LL | impl<'a, T> Trait<'a, T> for usize { - | - help: consider adding an explicit lifetime bound `T: 'a`... -LL | type Out = &'a T; - | ^^^^^^^^^^^^^^^^^ - | -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; - | ^^^^^^^^^^^^^^^^^ - -error[E0309]: the parameter type `T` may not live long enough - --> $DIR/regions-struct-not-wf.rs:31:5 - | -LL | impl<'a, T> Trait<'a, T> for u32 { - | - help: consider adding an explicit lifetime bound `T: 'a`... -LL | type Out = RefOk<'a, T>; - | ^^^^^^^^^^^^^^^^^^^^^^^^ - | -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>; - | ^^^^^^^^^^^^^^^^^^^^^^^^ - -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; - | ^^^^^^^^^^^^^^^^^^^^^ - | -note: the pointer is valid for the lifetime 'a as defined on the impl at 34:6 - --> $DIR/regions-struct-not-wf.rs:34:6 - | -LL | impl<'a, 'b, T> Trait1<'a, 'b, T> for u32 { - | ^^ -note: but the referenced data is only valid for the lifetime 'b as defined on the impl at 34:10 - --> $DIR/regions-struct-not-wf.rs:34:10 - | -LL | impl<'a, 'b, T> Trait1<'a, 'b, T> for u32 { - | ^^ - -error: aborting due to 3 previous errors - -Some errors occurred: E0309, E0491. -For more information about an error, try `rustc --explain E0309`. diff --git a/src/test/ui/resolve/issue-22692.rs b/src/test/ui/resolve/issue-22692.rs index 06648c599534f..600dd16ae3b0b 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 ecdd4ff855fb9..b964d3d6781be 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 24aa758ea6c23..60949a6e59886 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 d1d693a3817b9..49612a41ad331 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 bdd708197bc76..e8bb584f0bb60 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 d8c8b6c3ccc86..35a4f0cc72573 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 218a1d5b5fd12..0b3f59fd7e452 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 06a23ea1767b0..e6ddb3d91bfef 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 cfc318c1cd0f3..5f3a6b414e048 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 365e62c808673..bdde484c25217 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 ecab673953d6d..bd41f7b340530 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 9b59b24b105d2..0f67956a6d565 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 97d5482735f86..8801ce3e3a0e4 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 c691d2948229c..89fed56303933 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 741b2ca0826ce..3f56b988a4a88 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 d603d8212ed37..9e5e6980406ad 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 59fe7b958e345..d5d996e27eeb4 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-move-lifetimes.rs b/src/test/ui/suggestions/suggest-move-lifetimes.rs index 5051a406078aa..6b26f1214368c 100644 --- a/src/test/ui/suggestions/suggest-move-lifetimes.rs +++ b/src/test/ui/suggestions/suggest-move-lifetimes.rs @@ -1,18 +1,18 @@ -struct A { +struct A { //~ ERROR lifetime parameters must be declared t: &'a T, } -struct B { +struct B { //~ ERROR lifetime parameters must be declared t: &'a T, u: U, } -struct C { +struct C { //~ ERROR lifetime parameters must be declared t: &'a T, u: U, } -struct D { +struct D { //~ ERROR lifetime parameters must be declared t: &'a T, u: &'b U, v: &'c V, diff --git a/src/test/ui/suggestions/suggest-move-lifetimes.stderr b/src/test/ui/suggestions/suggest-move-lifetimes.stderr index f3d6469b51255..72a2cbe6bf6de 100644 --- a/src/test/ui/suggestions/suggest-move-lifetimes.stderr +++ b/src/test/ui/suggestions/suggest-move-lifetimes.stderr @@ -1,41 +1,41 @@ error: lifetime parameters must be declared prior to type parameters --> $DIR/suggest-move-lifetimes.rs:1:13 | -LL | struct A { +LL | struct A { //~ ERROR lifetime parameters must be declared | ^^ help: move the lifetime parameter prior to the first type parameter | -LL | struct A<'a, T> { +LL | struct A<'a, T> { //~ ERROR lifetime parameters must be declared | ^^^ -- error: lifetime parameters must be declared prior to type parameters --> $DIR/suggest-move-lifetimes.rs:5:13 | -LL | struct B { +LL | struct B { //~ ERROR lifetime parameters must be declared | ^^ help: move the lifetime parameter prior to the first type parameter | -LL | struct B<'a, T, U> { +LL | struct B<'a, T, U> { //~ ERROR lifetime parameters must be declared | ^^^ -- error: lifetime parameters must be declared prior to type parameters --> $DIR/suggest-move-lifetimes.rs:10:16 | -LL | struct C { +LL | struct C { //~ ERROR lifetime parameters must be declared | ^^ help: move the lifetime parameter prior to the first type parameter | -LL | struct C<'a, T, U> { +LL | struct C<'a, T, U> { //~ ERROR lifetime parameters must be declared | ^^^ -- error: lifetime parameters must be declared prior to type parameters --> $DIR/suggest-move-lifetimes.rs:15:16 | -LL | struct D { +LL | struct D { //~ ERROR lifetime parameters must be declared | ^^ ^^ ^^ help: move the lifetime parameter prior to the first type parameter | -LL | struct D<'a, 'b, 'c, T, U, V> { +LL | struct D<'a, 'b, 'c, T, U, V> { //~ ERROR lifetime parameters must be declared | ^^^ ^^^ ^^^ --- error: aborting due to 4 previous errors diff --git a/src/test/ui/suggestions/suggest-variants.rs b/src/test/ui/suggestions/suggest-variants.rs index 4a131ed837b87..6d6e280d9652f 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 08ae68ea71302..36abda2a89bb8 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 58e7718ba5bb4..a3cc53e69e20e 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 { type B; type C; } - pub struct Foo { i: Box> } +pub struct Foo { + i: Box>, + //~^ 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 b62b5d3b04ca0..16e9fa90aa1a6 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> } - | ^^^^^ ^^^^^ unexpected type argument - | | - | unexpected type argument +LL | i: Box>, + | ^^^^^ ^^^^^ 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> } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | associated type `A` must be specified - | associated type `C` must be specified +... +LL | i: Box>, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | | + | 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> } - | ^^^^^^^^^ ^^^^^^^^^ +LL | i: Box>, + | ^^^^^^^^^ ^^^^^^^^^ 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 bf3483000e3bc..802fdd077aa5a 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 9ad625176b148..f94e4a40914be 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 3adcd8436d8a1..4694135e78fb8 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 fdb9427cba734..9d9c142802d6c 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 8c8ce1221ba35..59ac5a02da312 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 {} -trait B = A; // T cannot be unbounded +trait B = A; //~ 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 e8c81c87796f3..cae571c4c61b1 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 = A; // T cannot be unbounded +LL | trait B = A; //~ 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 b514ff4386075..567cc7a3f5fa3 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 4b38a26f957f9..e4ff653f3ad42 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 afdf59d1e5bc5..7c6fb8c996998 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 { } impl<'a, T> Trait<'a, T> for u32 { - type Out = &'a Baz; + type Out = &'a Baz; //~ 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 26a2138c9f83c..0454215290cd9 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; +LL | type Out = &'a Baz; //~ ERROR `T` may not live long enough | ^^^^^^^^^^^^^^^^^^^^^^ | note: ...so that the reference type `&'a (dyn Baz + '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; +LL | type Out = &'a Baz; //~ ERROR `T` may not live long enough | ^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index b650e056eb774..c654230e2032f 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -2781,12 +2781,14 @@ impl<'test> TestCx<'test> { explicit, self.config.compare_mode, expected_errors, proc_res.status, self.props.error_patterns); if !explicit && self.config.compare_mode.is_none() { - if !expected_errors.is_empty() && !proc_res.status.success() { - // "//~ERROR comments" - self.check_expected_errors(expected_errors, &proc_res); - } else if !self.props.error_patterns.is_empty() && !proc_res.status.success() { - // "// error-pattern" comments - self.check_error_patterns(&proc_res.stderr, &proc_res); + if !proc_res.status.success() { + if !self.props.error_patterns.is_empty() { + // "// error-pattern" comments + self.check_error_patterns(&proc_res.stderr, &proc_res); + } else { + // "//~ERROR comments" + self.check_expected_errors(expected_errors, &proc_res); + } } }