Bless tests.

This commit is contained in:
Camille GILLOT 2021-11-20 11:54:12 +01:00
parent d3a6d4b1a0
commit 748e95b568
4 changed files with 163 additions and 3 deletions

View File

@ -6,7 +6,17 @@ fn function(x: &SomeTrait, y: Box<SomeTrait>) {
//~| 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 {}

View File

@ -31,5 +31,75 @@ LL - fn function(x: &SomeTrait, y: Box<SomeTrait>) {
LL + fn function(x: &SomeTrait, y: Box<dyn SomeTrait>) {
|
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 <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
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<SomeTrait>) {
| ^^^^^^^^^
|
= warning: this is accepted in the current edition (Rust 2018) 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 - fn function(x: &SomeTrait, y: Box<SomeTrait>) {
LL + fn function(x: &dyn SomeTrait, y: Box<SomeTrait>) {
|
error: trait objects without an explicit `dyn` are deprecated
--> $DIR/dyn-2018-edition-lint.rs:4:17
|
LL | fn function(x: &SomeTrait, y: Box<SomeTrait>) {
| ^^^^^^^^^
|
= warning: this is accepted in the current edition (Rust 2018) 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 - fn function(x: &SomeTrait, y: Box<SomeTrait>) {
LL + fn function(x: &dyn SomeTrait, y: Box<SomeTrait>) {
|
error: trait objects without an explicit `dyn` are deprecated
--> $DIR/dyn-2018-edition-lint.rs:4:35
|
LL | fn function(x: &SomeTrait, y: Box<SomeTrait>) {
| ^^^^^^^^^
|
= warning: this is accepted in the current edition (Rust 2018) 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 - fn function(x: &SomeTrait, y: Box<SomeTrait>) {
LL + fn function(x: &SomeTrait, y: Box<dyn SomeTrait>) {
|
error: trait objects without an explicit `dyn` are deprecated
--> $DIR/dyn-2018-edition-lint.rs:4:35
|
LL | fn function(x: &SomeTrait, y: Box<SomeTrait>) {
| ^^^^^^^^^
|
= warning: this is accepted in the current edition (Rust 2018) 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 - fn function(x: &SomeTrait, y: Box<SomeTrait>) {
LL + fn function(x: &SomeTrait, y: Box<dyn SomeTrait>) {
|
error: aborting due to 7 previous errors

View File

@ -18,10 +18,20 @@ pub struct Qux<T>(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<Qux<Baz>>,
bar: Box<Bar>,
//~^ 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() {}

View File

@ -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<Bar>,
| ^^^
@ -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<Bar>,
| ^^^
|
= 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 - bar: Box<Bar>,
LL + bar: Box<dyn Bar>,
|
error: trait objects without an explicit `dyn` are deprecated
--> $DIR/issue-61963.rs:28:14
|
LL | bar: Box<Bar>,
| ^^^
|
= 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 - bar: Box<Bar>,
LL + bar: Box<dyn Bar>,
|
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 <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
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 <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
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 <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
help: use `dyn`
|
LL - pub struct Foo {
LL + dyn pub struct Foo {
|
error: aborting due to 7 previous errors