diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2021-12-18 08:16:26 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-12-18 08:16:26 +0100 |
| commit | 7a626cf7ce908a1c210cc91a043c4c4a23d42b62 (patch) | |
| tree | fd9ed91ad999c74c2ea5aebf82ef2c0fc4e5b659 /src/test/ui/parser | |
| parent | 54e7946d0fde56ea25b331df8d971bed0d232cac (diff) | |
| parent | 6fcbc3a3238ac6f914b788fc49876a0becd31969 (diff) | |
| download | rust-7a626cf7ce908a1c210cc91a043c4c4a23d42b62.tar.gz rust-7a626cf7ce908a1c210cc91a043c4c4a23d42b62.zip | |
Rollup merge of #89090 - cjgillot:bare-dyn, r=jackh726
Lint bare traits in AstConv. Removing the lint from lowering allows to: - make lowering querification easier; - have the lint implementation in only one place. r? `@estebank`
Diffstat (limited to 'src/test/ui/parser')
7 files changed, 37 insertions, 69 deletions
diff --git a/src/test/ui/parser/issues/issue-68890-2.rs b/src/test/ui/parser/issues/issue-68890-2.rs index 0a6e26acfc7..29c12352146 100644 --- a/src/test/ui/parser/issues/issue-68890-2.rs +++ b/src/test/ui/parser/issues/issue-68890-2.rs @@ -3,5 +3,3 @@ fn main() {} type X<'a> = (?'a) +; //~^ ERROR `?` may only modify trait bounds, not lifetime bounds //~| ERROR at least one trait is required for an object type -//~| WARN trait objects without an explicit `dyn` are deprecated -//~| WARN this is accepted in the current edition diff --git a/src/test/ui/parser/issues/issue-68890-2.stderr b/src/test/ui/parser/issues/issue-68890-2.stderr index 1a64b9a017d..d9fb7beebdb 100644 --- a/src/test/ui/parser/issues/issue-68890-2.stderr +++ b/src/test/ui/parser/issues/issue-68890-2.stderr @@ -4,22 +4,12 @@ error: `?` may only modify trait bounds, not lifetime bounds LL | type X<'a> = (?'a) +; | ^ -warning: trait objects without an explicit `dyn` are deprecated - --> $DIR/issue-68890-2.rs:3:14 - | -LL | type X<'a> = (?'a) +; - | ^^^^^^^ help: use `dyn`: `dyn (?'a) +` - | - = note: `#[warn(bare_trait_objects)]` on by default - = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> - error[E0224]: at least one trait is required for an object type --> $DIR/issue-68890-2.rs:3:14 | LL | type X<'a> = (?'a) +; | ^^^^^^^ -error: aborting due to 2 previous errors; 1 warning emitted +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0224`. diff --git a/src/test/ui/parser/issues/issue-73568-lifetime-after-mut.rs b/src/test/ui/parser/issues/issue-73568-lifetime-after-mut.rs index e68ee747cfd..5f731f8db77 100644 --- a/src/test/ui/parser/issues/issue-73568-lifetime-after-mut.rs +++ b/src/test/ui/parser/issues/issue-73568-lifetime-after-mut.rs @@ -13,11 +13,7 @@ mac!('a); // avoid false positives fn y<'a>(y: &mut 'a + Send) { //~^ ERROR expected a path on the left-hand side of `+`, not `&mut 'a` - //~| WARNING trait objects without an explicit `dyn` are deprecated - //~| WARN this is accepted in the current edition //~| ERROR at least one trait is required for an object type let z = y as &mut 'a + Send; //~^ ERROR expected value, found trait `Send` - //~| WARNING trait objects without an explicit `dyn` are deprecated - //~| WARN this is accepted in the current edition } diff --git a/src/test/ui/parser/issues/issue-73568-lifetime-after-mut.stderr b/src/test/ui/parser/issues/issue-73568-lifetime-after-mut.stderr index 48c2b2a19d4..799bc16bd6a 100644 --- a/src/test/ui/parser/issues/issue-73568-lifetime-after-mut.stderr +++ b/src/test/ui/parser/issues/issue-73568-lifetime-after-mut.stderr @@ -22,37 +22,18 @@ LL | mac!('a); = note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0423]: expected value, found trait `Send` - --> $DIR/issue-73568-lifetime-after-mut.rs:19:28 + --> $DIR/issue-73568-lifetime-after-mut.rs:17:28 | LL | let z = y as &mut 'a + Send; | ^^^^ not a value -warning: trait objects without an explicit `dyn` are deprecated - --> $DIR/issue-73568-lifetime-after-mut.rs:14:18 - | -LL | fn y<'a>(y: &mut 'a + Send) { - | ^^ help: use `dyn`: `dyn 'a` - | - = note: `#[warn(bare_trait_objects)]` on by default - = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> - -warning: trait objects without an explicit `dyn` are deprecated - --> $DIR/issue-73568-lifetime-after-mut.rs:19:23 - | -LL | let z = y as &mut 'a + Send; - | ^^ help: use `dyn`: `dyn 'a` - | - = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> - error[E0224]: at least one trait is required for an object type --> $DIR/issue-73568-lifetime-after-mut.rs:14:18 | LL | fn y<'a>(y: &mut 'a + Send) { | ^^ -error: aborting due to 5 previous errors; 2 warnings emitted +error: aborting due to 5 previous errors Some errors have detailed explanations: E0178, E0224, E0423. For more information about an error, try `rustc --explain E0178`. diff --git a/src/test/ui/parser/macro/trait-object-macro-matcher.rs b/src/test/ui/parser/macro/trait-object-macro-matcher.rs index 663739f235a..560195977d0 100644 --- a/src/test/ui/parser/macro/trait-object-macro-matcher.rs +++ b/src/test/ui/parser/macro/trait-object-macro-matcher.rs @@ -11,6 +11,4 @@ fn main() { m!('static); //~^ ERROR lifetime in trait object type must be followed by `+` //~| ERROR at least one trait is required for an object type - //~| WARN trait objects without an explicit `dyn` are deprecated - //~| WARN this is accepted in the current edition } diff --git a/src/test/ui/parser/macro/trait-object-macro-matcher.stderr b/src/test/ui/parser/macro/trait-object-macro-matcher.stderr index 876bfd389cb..40082564bad 100644 --- a/src/test/ui/parser/macro/trait-object-macro-matcher.stderr +++ b/src/test/ui/parser/macro/trait-object-macro-matcher.stderr @@ -4,22 +4,12 @@ error: lifetime in trait object type must be followed by `+` LL | m!('static); | ^^^^^^^ -warning: trait objects without an explicit `dyn` are deprecated - --> $DIR/trait-object-macro-matcher.rs:11:8 - | -LL | m!('static); - | ^^^^^^^ help: use `dyn`: `dyn 'static` - | - = note: `#[warn(bare_trait_objects)]` on by default - = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> - error[E0224]: at least one trait is required for an object type --> $DIR/trait-object-macro-matcher.rs:11:8 | LL | m!('static); | ^^^^^^^ -error: aborting due to 2 previous errors; 1 warning emitted +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0224`. diff --git a/src/test/ui/parser/trait-object-trait-parens.stderr b/src/test/ui/parser/trait-object-trait-parens.stderr index 657288c70f3..a852337b6fe 100644 --- a/src/test/ui/parser/trait-object-trait-parens.stderr +++ b/src/test/ui/parser/trait-object-trait-parens.stderr @@ -20,29 +20,16 @@ warning: trait objects without an explicit `dyn` are deprecated --> $DIR/trait-object-trait-parens.rs:8:16 | LL | let _: Box<(Obj) + (?Sized) + (for<'a> Trait<'a>)>; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `dyn`: `dyn (Obj) + (?Sized) + (for<'a> Trait<'a>)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `#[warn(bare_trait_objects)]` on by default = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> - -warning: trait objects without an explicit `dyn` are deprecated - --> $DIR/trait-object-trait-parens.rs:13:16 - | -LL | let _: Box<?Sized + (for<'a> Trait<'a>) + (Obj)>; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `dyn`: `dyn ?Sized + (for<'a> Trait<'a>) + (Obj)` +help: use `dyn` | - = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> - -warning: trait objects without an explicit `dyn` are deprecated - --> $DIR/trait-object-trait-parens.rs:18:16 - | -LL | let _: Box<for<'a> Trait<'a> + (Obj) + (?Sized)>; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `dyn`: `dyn for<'a> Trait<'a> + (Obj) + (?Sized)` - | - = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> +LL - let _: Box<(Obj) + (?Sized) + (for<'a> Trait<'a>)>; +LL + let _: Box<dyn (Obj) + (?Sized) + (for<'a> Trait<'a>)>; + | error[E0225]: only auto traits can be used as additional traits in a trait object --> $DIR/trait-object-trait-parens.rs:8:35 @@ -55,6 +42,20 @@ LL | let _: Box<(Obj) + (?Sized) + (for<'a> Trait<'a>)>; = help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: Obj + for<'a> Trait<'a> {}` = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits> +warning: trait objects without an explicit `dyn` are deprecated + --> $DIR/trait-object-trait-parens.rs:13:16 + | +LL | let _: Box<?Sized + (for<'a> Trait<'a>) + (Obj)>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! + = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> +help: use `dyn` + | +LL - let _: Box<?Sized + (for<'a> Trait<'a>) + (Obj)>; +LL + let _: Box<dyn ?Sized + (for<'a> Trait<'a>) + (Obj)>; + | + error[E0225]: only auto traits can be used as additional traits in a trait object --> $DIR/trait-object-trait-parens.rs:13:47 | @@ -66,6 +67,20 @@ LL | let _: Box<?Sized + (for<'a> Trait<'a>) + (Obj)>; = help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: for<'a> Trait<'a> + Obj {}` = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits> +warning: trait objects without an explicit `dyn` are deprecated + --> $DIR/trait-object-trait-parens.rs:18:16 + | +LL | let _: Box<for<'a> Trait<'a> + (Obj) + (?Sized)>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! + = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> +help: use `dyn` + | +LL - let _: Box<for<'a> Trait<'a> + (Obj) + (?Sized)>; +LL + let _: Box<dyn for<'a> Trait<'a> + (Obj) + (?Sized)>; + | + error[E0225]: only auto traits can be used as additional traits in a trait object --> $DIR/trait-object-trait-parens.rs:18:36 | |
