From 748e95b568ee315dfcd0c584323d261973e18111 Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Sat, 20 Nov 2021 11:54:12 +0100 Subject: [PATCH] Bless tests. --- .../ui/dyn-keyword/dyn-2018-edition-lint.rs | 10 +++ .../dyn-keyword/dyn-2018-edition-lint.stderr | 72 +++++++++++++++++- src/test/ui/suggestions/issue-61963.rs | 10 +++ src/test/ui/suggestions/issue-61963.stderr | 74 ++++++++++++++++++- 4 files changed, 163 insertions(+), 3 deletions(-) diff --git a/src/test/ui/dyn-keyword/dyn-2018-edition-lint.rs b/src/test/ui/dyn-keyword/dyn-2018-edition-lint.rs index d8b3b9c7deba..a074b5fa5f7a 100644 --- a/src/test/ui/dyn-keyword/dyn-2018-edition-lint.rs +++ b/src/test/ui/dyn-keyword/dyn-2018-edition-lint.rs @@ -6,7 +6,17 @@ fn function(x: &SomeTrait, y: Box) { //~| WARN this is accepted in the current edition //~| ERROR trait objects without an explicit `dyn` are deprecated //~| WARN this is accepted in the current edition + //~| ERROR trait objects without an explicit `dyn` are deprecated + //~| WARN this is accepted in the current edition + //~| ERROR trait objects without an explicit `dyn` are deprecated + //~| WARN this is accepted in the current edition + //~| ERROR trait objects without an explicit `dyn` are deprecated + //~| WARN this is accepted in the current edition + //~| ERROR trait objects without an explicit `dyn` are deprecated + //~| WARN this is accepted in the current edition let _x: &SomeTrait = todo!(); + //~^ ERROR trait objects without an explicit `dyn` are deprecated + //~| WARN this is accepted in the current edition } trait SomeTrait {} diff --git a/src/test/ui/dyn-keyword/dyn-2018-edition-lint.stderr b/src/test/ui/dyn-keyword/dyn-2018-edition-lint.stderr index 7e9435efb08d..b8e4942dfefb 100644 --- a/src/test/ui/dyn-keyword/dyn-2018-edition-lint.stderr +++ b/src/test/ui/dyn-keyword/dyn-2018-edition-lint.stderr @@ -31,5 +31,75 @@ LL - fn function(x: &SomeTrait, y: Box) { LL + fn function(x: &SomeTrait, y: Box) { | -error: aborting due to 2 previous errors +error: trait objects without an explicit `dyn` are deprecated + --> $DIR/dyn-2018-edition-lint.rs:17:14 + | +LL | let _x: &SomeTrait = todo!(); + | ^^^^^^^^^ + | + = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021! + = note: for more information, see +help: use `dyn` + | +LL - let _x: &SomeTrait = todo!(); +LL + let _x: &dyn SomeTrait = todo!(); + | + +error: trait objects without an explicit `dyn` are deprecated + --> $DIR/dyn-2018-edition-lint.rs:4:17 + | +LL | fn function(x: &SomeTrait, y: Box) { + | ^^^^^^^^^ + | + = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021! + = note: for more information, see +help: use `dyn` + | +LL - fn function(x: &SomeTrait, y: Box) { +LL + fn function(x: &dyn SomeTrait, y: Box) { + | + +error: trait objects without an explicit `dyn` are deprecated + --> $DIR/dyn-2018-edition-lint.rs:4:17 + | +LL | fn function(x: &SomeTrait, y: Box) { + | ^^^^^^^^^ + | + = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021! + = note: for more information, see +help: use `dyn` + | +LL - fn function(x: &SomeTrait, y: Box) { +LL + fn function(x: &dyn SomeTrait, y: Box) { + | + +error: trait objects without an explicit `dyn` are deprecated + --> $DIR/dyn-2018-edition-lint.rs:4:35 + | +LL | fn function(x: &SomeTrait, y: Box) { + | ^^^^^^^^^ + | + = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021! + = note: for more information, see +help: use `dyn` + | +LL - fn function(x: &SomeTrait, y: Box) { +LL + fn function(x: &SomeTrait, y: Box) { + | + +error: trait objects without an explicit `dyn` are deprecated + --> $DIR/dyn-2018-edition-lint.rs:4:35 + | +LL | fn function(x: &SomeTrait, y: Box) { + | ^^^^^^^^^ + | + = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021! + = note: for more information, see +help: use `dyn` + | +LL - fn function(x: &SomeTrait, y: Box) { +LL + fn function(x: &SomeTrait, y: Box) { + | + +error: aborting due to 7 previous errors diff --git a/src/test/ui/suggestions/issue-61963.rs b/src/test/ui/suggestions/issue-61963.rs index d31ed01b1916..a27c38452539 100644 --- a/src/test/ui/suggestions/issue-61963.rs +++ b/src/test/ui/suggestions/issue-61963.rs @@ -18,10 +18,20 @@ pub struct Qux(T); pub struct Foo { //~^ ERROR trait objects without an explicit `dyn` are deprecated [bare_trait_objects] //~| WARN this is accepted in the current edition + //~| ERROR trait objects without an explicit `dyn` are deprecated [bare_trait_objects] + //~| WARN this is accepted in the current edition + //~| ERROR trait objects without an explicit `dyn` are deprecated [bare_trait_objects] + //~| WARN this is accepted in the current edition + //~| ERROR trait objects without an explicit `dyn` are deprecated [bare_trait_objects] + //~| WARN this is accepted in the current edition qux: Qux>, bar: Box, //~^ ERROR trait objects without an explicit `dyn` are deprecated [bare_trait_objects] //~| WARN this is accepted in the current edition + //~| ERROR trait objects without an explicit `dyn` are deprecated [bare_trait_objects] + //~| WARN this is accepted in the current edition + //~| ERROR trait objects without an explicit `dyn` are deprecated [bare_trait_objects] + //~| WARN this is accepted in the current edition } fn main() {} diff --git a/src/test/ui/suggestions/issue-61963.stderr b/src/test/ui/suggestions/issue-61963.stderr index 7dfd8c327085..1eebd8d60ca9 100644 --- a/src/test/ui/suggestions/issue-61963.stderr +++ b/src/test/ui/suggestions/issue-61963.stderr @@ -1,5 +1,5 @@ error: trait objects without an explicit `dyn` are deprecated - --> $DIR/issue-61963.rs:22:14 + --> $DIR/issue-61963.rs:28:14 | LL | bar: Box, | ^^^ @@ -31,5 +31,75 @@ LL - pub struct Foo { LL + dyn pub struct Foo { | -error: aborting due to 2 previous errors +error: trait objects without an explicit `dyn` are deprecated + --> $DIR/issue-61963.rs:28:14 + | +LL | bar: Box, + | ^^^ + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! + = note: for more information, see +help: use `dyn` + | +LL - bar: Box, +LL + bar: Box, + | + +error: trait objects without an explicit `dyn` are deprecated + --> $DIR/issue-61963.rs:28:14 + | +LL | bar: Box, + | ^^^ + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! + = note: for more information, see +help: use `dyn` + | +LL - bar: Box, +LL + bar: Box, + | + +error: trait objects without an explicit `dyn` are deprecated + --> $DIR/issue-61963.rs:18:1 + | +LL | pub struct Foo { + | ^^^ + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! + = note: for more information, see +help: use `dyn` + | +LL - pub struct Foo { +LL + dyn pub struct Foo { + | + +error: trait objects without an explicit `dyn` are deprecated + --> $DIR/issue-61963.rs:18:1 + | +LL | pub struct Foo { + | ^^^ + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! + = note: for more information, see +help: use `dyn` + | +LL - pub struct Foo { +LL + dyn pub struct Foo { + | + +error: trait objects without an explicit `dyn` are deprecated + --> $DIR/issue-61963.rs:18:1 + | +LL | pub struct Foo { + | ^^^ + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! + = note: for more information, see +help: use `dyn` + | +LL - pub struct Foo { +LL + dyn pub struct Foo { + | + +error: aborting due to 7 previous errors