diff --git a/src/tools/tidy/src/issues.txt b/src/tools/tidy/src/issues.txt index 3b23fe5d80826..cc5859bc72747 100644 --- a/src/tools/tidy/src/issues.txt +++ b/src/tools/tidy/src/issues.txt @@ -2554,8 +2554,6 @@ ui/suggestions/issue-109991.rs ui/suggestions/issue-112590-suggest-import.rs ui/suggestions/issue-114701.rs ui/suggestions/issue-114797-bad-parentheses-dyn-trait.rs -ui/suggestions/issue-116434-2015.rs -ui/suggestions/issue-116434-2021.rs ui/suggestions/issue-117669.rs ui/suggestions/issue-21673.rs ui/suggestions/issue-51055-missing-semicolon-between-call-and-tuple.rs diff --git a/tests/ui/macros/macro-at-most-once-rep-2018-rpass.rs b/tests/ui/macros/macro-at-most-once-rep-2018-rpass.rs deleted file mode 100644 index 0ca7e984c8812..0000000000000 --- a/tests/ui/macros/macro-at-most-once-rep-2018-rpass.rs +++ /dev/null @@ -1,50 +0,0 @@ -//@ run-pass - -#![allow(unused_mut)] - -// Check that when `?` is followed by what looks like a Kleene operator (?, +, and *) -// then that `?` is not interpreted as a separator. In other words, `$(pat)?+` matches `pat +` -// or `+` but does not match `pat` or `pat ? pat`. - -//@ edition:2018 - -macro_rules! foo { - // Check for `?`. - ($($a:ident)? ? $num:expr) => { - foo!($($a)? ; $num); - }; - // Check for `+`. - ($($a:ident)? + $num:expr) => { - foo!($($a)? ; $num); - }; - // Check for `*`. - ($($a:ident)? * $num:expr) => { - foo!($($a)? ; $num); - }; - // Check for `;`, not a kleene operator. - ($($a:ident)? ; $num:expr) => { - let mut x = 0; - - $( - x += $a; - )? - - assert_eq!(x, $num); - }; -} - -pub fn main() { - let a = 1; - - // Accept 0 repetitions. - foo!( ; 0); - foo!( + 0); - foo!( * 0); - foo!( ? 0); - - // Accept 1 repetition. - foo!(a ; 1); - foo!(a + 1); - foo!(a * 1); - foo!(a ? 1); -} diff --git a/tests/ui/macros/macro-at-most-once-rep-2018.rs b/tests/ui/macros/macro-at-most-once-rep-2018.rs deleted file mode 100644 index 98fbb2ad20733..0000000000000 --- a/tests/ui/macros/macro-at-most-once-rep-2018.rs +++ /dev/null @@ -1,42 +0,0 @@ -// Tests that `?` is a Kleene op and not a macro separator in the 2018 edition. - -//@ edition:2018 - -macro_rules! foo { - ($(a)?) => {}; -} - -// The Kleene op `?` does not admit a separator before it. -macro_rules! baz { - ($(a),?) => {}; //~ERROR the `?` macro repetition operator -} - -macro_rules! barplus { - ($(a)?+) => {}; // ok. matches "a+" and "+" -} - -macro_rules! barstar { - ($(a)?*) => {}; // ok. matches "a*" and "*" -} - -pub fn main() { - foo!(); - foo!(a); - foo!(a?); //~ ERROR no rules expected `?` - foo!(a?a); //~ ERROR no rules expected `?` - foo!(a?a?a); //~ ERROR no rules expected `?` - - barplus!(); //~ERROR unexpected end of macro invocation - barplus!(a); //~ERROR unexpected end of macro invocation - barplus!(a?); //~ ERROR no rules expected `?` - barplus!(a?a); //~ ERROR no rules expected `?` - barplus!(a+); - barplus!(+); - - barstar!(); //~ERROR unexpected end of macro invocation - barstar!(a); //~ERROR unexpected end of macro invocation - barstar!(a?); //~ ERROR no rules expected `?` - barstar!(a?a); //~ ERROR no rules expected `?` - barstar!(a*); - barstar!(*); -} diff --git a/tests/ui/macros/macro-at-most-once-rep-2015-rpass.rs b/tests/ui/macros/macro-at-most-once-rep-rpass.rs similarity index 91% rename from tests/ui/macros/macro-at-most-once-rep-2015-rpass.rs rename to tests/ui/macros/macro-at-most-once-rep-rpass.rs index c7a22c8b518b4..fadc857e78d22 100644 --- a/tests/ui/macros/macro-at-most-once-rep-2015-rpass.rs +++ b/tests/ui/macros/macro-at-most-once-rep-rpass.rs @@ -6,7 +6,9 @@ // then that `?` is not interpreted as a separator. In other words, `$(pat)?+` matches `pat +` // or `+` but does not match `pat` or `pat ? pat`. -//@ edition:2015 +//@ revisions: rust2015 rust2018 +//@[rust2015] edition:2015 +//@[rust2018] edition:2018 macro_rules! foo { // Check for `?`. diff --git a/tests/ui/macros/macro-at-most-once-rep-2015.rs b/tests/ui/macros/macro-at-most-once-rep.rs similarity index 90% rename from tests/ui/macros/macro-at-most-once-rep-2015.rs rename to tests/ui/macros/macro-at-most-once-rep.rs index 08967b82531c9..96c4226de2145 100644 --- a/tests/ui/macros/macro-at-most-once-rep-2015.rs +++ b/tests/ui/macros/macro-at-most-once-rep.rs @@ -1,6 +1,8 @@ -// Tests that `?` is a Kleene op and not a macro separator in the 2015 edition. +// Tests that `?` is a Kleene op and not a macro separator in the 2015 & 2018 editions. -//@ edition:2015 +//@ revisions: rust2015 rust2018 +//@[rust2015] edition:2015 +//@[rust2018] edition:2018 macro_rules! foo { ($(a)?) => {}; diff --git a/tests/ui/macros/macro-at-most-once-rep-2018.stderr b/tests/ui/macros/macro-at-most-once-rep.rust2015.stderr similarity index 78% rename from tests/ui/macros/macro-at-most-once-rep-2018.stderr rename to tests/ui/macros/macro-at-most-once-rep.rust2015.stderr index f165a199b10b9..1dba3bb5a5549 100644 --- a/tests/ui/macros/macro-at-most-once-rep-2018.stderr +++ b/tests/ui/macros/macro-at-most-once-rep.rust2015.stderr @@ -1,11 +1,11 @@ error: the `?` macro repetition operator does not take a separator - --> $DIR/macro-at-most-once-rep-2018.rs:11:10 + --> $DIR/macro-at-most-once-rep.rs:13:10 | LL | ($(a),?) => {}; | ^ error: no rules expected `?` - --> $DIR/macro-at-most-once-rep-2018.rs:25:11 + --> $DIR/macro-at-most-once-rep.rs:27:11 | LL | macro_rules! foo { | ---------------- when calling this macro @@ -16,7 +16,7 @@ LL | foo!(a?); = note: while trying to match sequence end error: no rules expected `?` - --> $DIR/macro-at-most-once-rep-2018.rs:26:11 + --> $DIR/macro-at-most-once-rep.rs:28:11 | LL | macro_rules! foo { | ---------------- when calling this macro @@ -27,7 +27,7 @@ LL | foo!(a?a); = note: while trying to match sequence end error: no rules expected `?` - --> $DIR/macro-at-most-once-rep-2018.rs:27:11 + --> $DIR/macro-at-most-once-rep.rs:29:11 | LL | macro_rules! foo { | ---------------- when calling this macro @@ -38,7 +38,7 @@ LL | foo!(a?a?a); = note: while trying to match sequence end error: unexpected end of macro invocation - --> $DIR/macro-at-most-once-rep-2018.rs:29:5 + --> $DIR/macro-at-most-once-rep.rs:31:5 | LL | macro_rules! barplus { | -------------------- when calling this macro @@ -47,13 +47,13 @@ LL | barplus!(); | ^^^^^^^^^^ missing tokens in macro arguments | note: while trying to match `+` - --> $DIR/macro-at-most-once-rep-2018.rs:15:11 + --> $DIR/macro-at-most-once-rep.rs:17:11 | LL | ($(a)?+) => {}; // ok. matches "a+" and "+" | ^ error: unexpected end of macro invocation - --> $DIR/macro-at-most-once-rep-2018.rs:30:15 + --> $DIR/macro-at-most-once-rep.rs:32:15 | LL | macro_rules! barplus { | -------------------- when calling this macro @@ -62,13 +62,13 @@ LL | barplus!(a); | ^ missing tokens in macro arguments | note: while trying to match `+` - --> $DIR/macro-at-most-once-rep-2018.rs:15:11 + --> $DIR/macro-at-most-once-rep.rs:17:11 | LL | ($(a)?+) => {}; // ok. matches "a+" and "+" | ^ error: no rules expected `?` - --> $DIR/macro-at-most-once-rep-2018.rs:31:15 + --> $DIR/macro-at-most-once-rep.rs:33:15 | LL | macro_rules! barplus { | -------------------- when calling this macro @@ -77,13 +77,13 @@ LL | barplus!(a?); | ^ no rules expected this token in macro call | note: while trying to match `+` - --> $DIR/macro-at-most-once-rep-2018.rs:15:11 + --> $DIR/macro-at-most-once-rep.rs:17:11 | LL | ($(a)?+) => {}; // ok. matches "a+" and "+" | ^ error: no rules expected `?` - --> $DIR/macro-at-most-once-rep-2018.rs:32:15 + --> $DIR/macro-at-most-once-rep.rs:34:15 | LL | macro_rules! barplus { | -------------------- when calling this macro @@ -92,13 +92,13 @@ LL | barplus!(a?a); | ^ no rules expected this token in macro call | note: while trying to match `+` - --> $DIR/macro-at-most-once-rep-2018.rs:15:11 + --> $DIR/macro-at-most-once-rep.rs:17:11 | LL | ($(a)?+) => {}; // ok. matches "a+" and "+" | ^ error: unexpected end of macro invocation - --> $DIR/macro-at-most-once-rep-2018.rs:36:5 + --> $DIR/macro-at-most-once-rep.rs:38:5 | LL | macro_rules! barstar { | -------------------- when calling this macro @@ -107,13 +107,13 @@ LL | barstar!(); | ^^^^^^^^^^ missing tokens in macro arguments | note: while trying to match `*` - --> $DIR/macro-at-most-once-rep-2018.rs:19:11 + --> $DIR/macro-at-most-once-rep.rs:21:11 | LL | ($(a)?*) => {}; // ok. matches "a*" and "*" | ^ error: unexpected end of macro invocation - --> $DIR/macro-at-most-once-rep-2018.rs:37:15 + --> $DIR/macro-at-most-once-rep.rs:39:15 | LL | macro_rules! barstar { | -------------------- when calling this macro @@ -122,13 +122,13 @@ LL | barstar!(a); | ^ missing tokens in macro arguments | note: while trying to match `*` - --> $DIR/macro-at-most-once-rep-2018.rs:19:11 + --> $DIR/macro-at-most-once-rep.rs:21:11 | LL | ($(a)?*) => {}; // ok. matches "a*" and "*" | ^ error: no rules expected `?` - --> $DIR/macro-at-most-once-rep-2018.rs:38:15 + --> $DIR/macro-at-most-once-rep.rs:40:15 | LL | macro_rules! barstar { | -------------------- when calling this macro @@ -137,13 +137,13 @@ LL | barstar!(a?); | ^ no rules expected this token in macro call | note: while trying to match `*` - --> $DIR/macro-at-most-once-rep-2018.rs:19:11 + --> $DIR/macro-at-most-once-rep.rs:21:11 | LL | ($(a)?*) => {}; // ok. matches "a*" and "*" | ^ error: no rules expected `?` - --> $DIR/macro-at-most-once-rep-2018.rs:39:15 + --> $DIR/macro-at-most-once-rep.rs:41:15 | LL | macro_rules! barstar { | -------------------- when calling this macro @@ -152,7 +152,7 @@ LL | barstar!(a?a); | ^ no rules expected this token in macro call | note: while trying to match `*` - --> $DIR/macro-at-most-once-rep-2018.rs:19:11 + --> $DIR/macro-at-most-once-rep.rs:21:11 | LL | ($(a)?*) => {}; // ok. matches "a*" and "*" | ^ diff --git a/tests/ui/macros/macro-at-most-once-rep-2015.stderr b/tests/ui/macros/macro-at-most-once-rep.rust2018.stderr similarity index 78% rename from tests/ui/macros/macro-at-most-once-rep-2015.stderr rename to tests/ui/macros/macro-at-most-once-rep.rust2018.stderr index 7f161cdc8d0b4..1dba3bb5a5549 100644 --- a/tests/ui/macros/macro-at-most-once-rep-2015.stderr +++ b/tests/ui/macros/macro-at-most-once-rep.rust2018.stderr @@ -1,11 +1,11 @@ error: the `?` macro repetition operator does not take a separator - --> $DIR/macro-at-most-once-rep-2015.rs:11:10 + --> $DIR/macro-at-most-once-rep.rs:13:10 | LL | ($(a),?) => {}; | ^ error: no rules expected `?` - --> $DIR/macro-at-most-once-rep-2015.rs:25:11 + --> $DIR/macro-at-most-once-rep.rs:27:11 | LL | macro_rules! foo { | ---------------- when calling this macro @@ -16,7 +16,7 @@ LL | foo!(a?); = note: while trying to match sequence end error: no rules expected `?` - --> $DIR/macro-at-most-once-rep-2015.rs:26:11 + --> $DIR/macro-at-most-once-rep.rs:28:11 | LL | macro_rules! foo { | ---------------- when calling this macro @@ -27,7 +27,7 @@ LL | foo!(a?a); = note: while trying to match sequence end error: no rules expected `?` - --> $DIR/macro-at-most-once-rep-2015.rs:27:11 + --> $DIR/macro-at-most-once-rep.rs:29:11 | LL | macro_rules! foo { | ---------------- when calling this macro @@ -38,7 +38,7 @@ LL | foo!(a?a?a); = note: while trying to match sequence end error: unexpected end of macro invocation - --> $DIR/macro-at-most-once-rep-2015.rs:29:5 + --> $DIR/macro-at-most-once-rep.rs:31:5 | LL | macro_rules! barplus { | -------------------- when calling this macro @@ -47,13 +47,13 @@ LL | barplus!(); | ^^^^^^^^^^ missing tokens in macro arguments | note: while trying to match `+` - --> $DIR/macro-at-most-once-rep-2015.rs:15:11 + --> $DIR/macro-at-most-once-rep.rs:17:11 | LL | ($(a)?+) => {}; // ok. matches "a+" and "+" | ^ error: unexpected end of macro invocation - --> $DIR/macro-at-most-once-rep-2015.rs:30:15 + --> $DIR/macro-at-most-once-rep.rs:32:15 | LL | macro_rules! barplus { | -------------------- when calling this macro @@ -62,13 +62,13 @@ LL | barplus!(a); | ^ missing tokens in macro arguments | note: while trying to match `+` - --> $DIR/macro-at-most-once-rep-2015.rs:15:11 + --> $DIR/macro-at-most-once-rep.rs:17:11 | LL | ($(a)?+) => {}; // ok. matches "a+" and "+" | ^ error: no rules expected `?` - --> $DIR/macro-at-most-once-rep-2015.rs:31:15 + --> $DIR/macro-at-most-once-rep.rs:33:15 | LL | macro_rules! barplus { | -------------------- when calling this macro @@ -77,13 +77,13 @@ LL | barplus!(a?); | ^ no rules expected this token in macro call | note: while trying to match `+` - --> $DIR/macro-at-most-once-rep-2015.rs:15:11 + --> $DIR/macro-at-most-once-rep.rs:17:11 | LL | ($(a)?+) => {}; // ok. matches "a+" and "+" | ^ error: no rules expected `?` - --> $DIR/macro-at-most-once-rep-2015.rs:32:15 + --> $DIR/macro-at-most-once-rep.rs:34:15 | LL | macro_rules! barplus { | -------------------- when calling this macro @@ -92,13 +92,13 @@ LL | barplus!(a?a); | ^ no rules expected this token in macro call | note: while trying to match `+` - --> $DIR/macro-at-most-once-rep-2015.rs:15:11 + --> $DIR/macro-at-most-once-rep.rs:17:11 | LL | ($(a)?+) => {}; // ok. matches "a+" and "+" | ^ error: unexpected end of macro invocation - --> $DIR/macro-at-most-once-rep-2015.rs:36:5 + --> $DIR/macro-at-most-once-rep.rs:38:5 | LL | macro_rules! barstar { | -------------------- when calling this macro @@ -107,13 +107,13 @@ LL | barstar!(); | ^^^^^^^^^^ missing tokens in macro arguments | note: while trying to match `*` - --> $DIR/macro-at-most-once-rep-2015.rs:19:11 + --> $DIR/macro-at-most-once-rep.rs:21:11 | LL | ($(a)?*) => {}; // ok. matches "a*" and "*" | ^ error: unexpected end of macro invocation - --> $DIR/macro-at-most-once-rep-2015.rs:37:15 + --> $DIR/macro-at-most-once-rep.rs:39:15 | LL | macro_rules! barstar { | -------------------- when calling this macro @@ -122,13 +122,13 @@ LL | barstar!(a); | ^ missing tokens in macro arguments | note: while trying to match `*` - --> $DIR/macro-at-most-once-rep-2015.rs:19:11 + --> $DIR/macro-at-most-once-rep.rs:21:11 | LL | ($(a)?*) => {}; // ok. matches "a*" and "*" | ^ error: no rules expected `?` - --> $DIR/macro-at-most-once-rep-2015.rs:38:15 + --> $DIR/macro-at-most-once-rep.rs:40:15 | LL | macro_rules! barstar { | -------------------- when calling this macro @@ -137,13 +137,13 @@ LL | barstar!(a?); | ^ no rules expected this token in macro call | note: while trying to match `*` - --> $DIR/macro-at-most-once-rep-2015.rs:19:11 + --> $DIR/macro-at-most-once-rep.rs:21:11 | LL | ($(a)?*) => {}; // ok. matches "a*" and "*" | ^ error: no rules expected `?` - --> $DIR/macro-at-most-once-rep-2015.rs:39:15 + --> $DIR/macro-at-most-once-rep.rs:41:15 | LL | macro_rules! barstar { | -------------------- when calling this macro @@ -152,7 +152,7 @@ LL | barstar!(a?a); | ^ no rules expected this token in macro call | note: while trying to match `*` - --> $DIR/macro-at-most-once-rep-2015.rs:19:11 + --> $DIR/macro-at-most-once-rep.rs:21:11 | LL | ($(a)?*) => {}; // ok. matches "a*" and "*" | ^ diff --git a/tests/ui/resolve/editions-crate-root-2015.rs b/tests/ui/resolve/editions-crate-root-2015.rs deleted file mode 100644 index 163984b4e8f78..0000000000000 --- a/tests/ui/resolve/editions-crate-root-2015.rs +++ /dev/null @@ -1,21 +0,0 @@ -//@ edition:2015 - -mod inner { - fn global_inner(_: ::nonexistant::Foo) { - //~^ ERROR: cannot find module or crate `nonexistant` - } - fn crate_inner(_: crate::nonexistant::Foo) { - //~^ ERROR: cannot find module or crate `nonexistant` - } - - fn bare_global(_: ::nonexistant) { - //~^ ERROR: cannot find type `nonexistant` in the crate root - } - fn bare_crate(_: crate::nonexistant) { - //~^ ERROR: cannot find type `nonexistant` in the crate root - } -} - -fn main() { - -} diff --git a/tests/ui/resolve/editions-crate-root-2018.rs b/tests/ui/resolve/editions-crate-root-2018.rs deleted file mode 100644 index c07f617455efb..0000000000000 --- a/tests/ui/resolve/editions-crate-root-2018.rs +++ /dev/null @@ -1,21 +0,0 @@ -//@ edition:2018 - -mod inner { - fn global_inner(_: ::nonexistant::Foo) { - //~^ ERROR: cannot find `nonexistant` - } - fn crate_inner(_: crate::nonexistant::Foo) { - //~^ ERROR: cannot find `nonexistant` - } - - fn bare_global(_: ::nonexistant) { - //~^ ERROR: cannot find crate `nonexistant` - } - fn bare_crate(_: crate::nonexistant) { - //~^ ERROR: cannot find type `nonexistant` in the crate root - } -} - -fn main() { - -} diff --git a/tests/ui/resolve/editions-crate-root.rs b/tests/ui/resolve/editions-crate-root.rs new file mode 100644 index 0000000000000..cc3d3ec69b822 --- /dev/null +++ b/tests/ui/resolve/editions-crate-root.rs @@ -0,0 +1,28 @@ +//@ revisions: rust2015 rust2018 +//@[rust2015] edition:2015 +//@[rust2018] edition:2018 + + +mod inner { + fn global_inner(_: ::nonexistant::Foo) { + //[rust2015]~^ ERROR: cannot find module or crate `nonexistant` + //[rust2018]~^^ ERROR: cannot find `nonexistant` + } + fn crate_inner(_: crate::nonexistant::Foo) { + //[rust2015]~^ ERROR: cannot find module or crate `nonexistant` + //[rust2018]~^^ ERROR: cannot find `nonexistant` + } + + fn bare_global(_: ::nonexistant) { + //[rust2015]~^ ERROR: cannot find type `nonexistant` in the crate root + //[rust2018]~^^ ERROR: cannot find crate `nonexistant` + } + fn bare_crate(_: crate::nonexistant) { + //[rust2015]~^ ERROR: cannot find type `nonexistant` in the crate root + //[rust2018]~^^ ERROR: cannot find type `nonexistant` in the crate root + } +} + +fn main() { + +} diff --git a/tests/ui/resolve/editions-crate-root-2015.stderr b/tests/ui/resolve/editions-crate-root.rust2015.stderr similarity index 87% rename from tests/ui/resolve/editions-crate-root-2015.stderr rename to tests/ui/resolve/editions-crate-root.rust2015.stderr index a4002349387a9..7314fa8f89f0f 100644 --- a/tests/ui/resolve/editions-crate-root-2015.stderr +++ b/tests/ui/resolve/editions-crate-root.rust2015.stderr @@ -1,5 +1,5 @@ error[E0433]: cannot find module or crate `nonexistant` in the crate root - --> $DIR/editions-crate-root-2015.rs:4:26 + --> $DIR/editions-crate-root.rs:7:26 | LL | fn global_inner(_: ::nonexistant::Foo) { | ^^^^^^^^^^^ use of unresolved module or unlinked crate `nonexistant` @@ -10,7 +10,7 @@ LL + extern crate nonexistant; | error[E0433]: cannot find module or crate `nonexistant` in `crate` - --> $DIR/editions-crate-root-2015.rs:7:30 + --> $DIR/editions-crate-root.rs:11:30 | LL | fn crate_inner(_: crate::nonexistant::Foo) { | ^^^^^^^^^^^ use of unresolved module or unlinked crate `nonexistant` @@ -21,13 +21,13 @@ LL + extern crate nonexistant; | error[E0425]: cannot find type `nonexistant` in the crate root - --> $DIR/editions-crate-root-2015.rs:11:25 + --> $DIR/editions-crate-root.rs:16:25 | LL | fn bare_global(_: ::nonexistant) { | ^^^^^^^^^^^ not found in the crate root error[E0425]: cannot find type `nonexistant` in the crate root - --> $DIR/editions-crate-root-2015.rs:14:29 + --> $DIR/editions-crate-root.rs:20:29 | LL | fn bare_crate(_: crate::nonexistant) { | ^^^^^^^^^^^ not found in the crate root diff --git a/tests/ui/resolve/editions-crate-root-2018.stderr b/tests/ui/resolve/editions-crate-root.rust2018.stderr similarity index 84% rename from tests/ui/resolve/editions-crate-root-2018.stderr rename to tests/ui/resolve/editions-crate-root.rust2018.stderr index c7ce936700511..5c50d778d2604 100644 --- a/tests/ui/resolve/editions-crate-root-2018.stderr +++ b/tests/ui/resolve/editions-crate-root.rust2018.stderr @@ -1,23 +1,23 @@ error[E0433]: cannot find `nonexistant` in the crate root - --> $DIR/editions-crate-root-2018.rs:4:26 + --> $DIR/editions-crate-root.rs:7:26 | LL | fn global_inner(_: ::nonexistant::Foo) { | ^^^^^^^^^^^ could not find `nonexistant` in the list of imported crates error[E0433]: cannot find `nonexistant` in `crate` - --> $DIR/editions-crate-root-2018.rs:7:30 + --> $DIR/editions-crate-root.rs:11:30 | LL | fn crate_inner(_: crate::nonexistant::Foo) { | ^^^^^^^^^^^ could not find `nonexistant` in the crate root error[E0425]: cannot find crate `nonexistant` in the list of imported crates - --> $DIR/editions-crate-root-2018.rs:11:25 + --> $DIR/editions-crate-root.rs:16:25 | LL | fn bare_global(_: ::nonexistant) { | ^^^^^^^^^^^ not found in the list of imported crates error[E0425]: cannot find type `nonexistant` in the crate root - --> $DIR/editions-crate-root-2018.rs:14:29 + --> $DIR/editions-crate-root.rs:20:29 | LL | fn bare_crate(_: crate::nonexistant) { | ^^^^^^^^^^^ not found in the crate root diff --git a/tests/ui/suggestions/bare_trait_objects.rs b/tests/ui/suggestions/bare_trait_objects.rs new file mode 100644 index 0000000000000..a7a9591a6167e --- /dev/null +++ b/tests/ui/suggestions/bare_trait_objects.rs @@ -0,0 +1,40 @@ +//@ revisions: rust2015 rust2021 +//@[rust2015] edition:2015 +//@[rust2021] edition:2021 + + +trait Foo { + type Clone; + fn foo() -> Clone; + //[rust2021]~^ ERROR expected a type, found a trait + //[rust2021]~| HELP `Clone` is dyn-incompatible, use `impl Clone` to return an opaque type, as long as you return a single underlying type + //[rust2015]~^^^ WARNING trait objects without an explicit `dyn` are deprecated [bare_trait_objects] + //[rust2015]~| WARNING this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! + //[rust2015]~| HELP if this is a dyn-compatible trait, use `dyn` + //[rust2015]~| WARNING trait objects without an explicit `dyn` are deprecated [bare_trait_objects] + //[rust2015]~| WARNING this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! + //[rust2015]~| HELP if this is a dyn-compatible trait, use `dyn` + //[rust2015]~| ERROR the trait `Clone` is not dyn compatible [E0038] + //~| HELP there is an associated type with the same name + //[rust2015]~| HELP use `Self` to refer to the implementing type +} + +trait DbHandle: Sized {} + +trait DbInterface { + type DbHandle; + fn handle() -> DbHandle; + //[rust2021]~^ ERROR expected a type, found a trait + //[rust2021]~| HELP `DbHandle` is dyn-incompatible, use `impl DbHandle` to return an opaque type, as long as you return a single underlying type + //[rust2015]~^^^ WARNING trait objects without an explicit `dyn` are deprecated [bare_trait_objects] + //[rust2015]~| WARNING this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! + //[rust2015]~| HELP if this is a dyn-compatible trait, use `dyn` + //[rust2015]~| WARNING trait objects without an explicit `dyn` are deprecated [bare_trait_objects] + //[rust2015]~| WARNING this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! + //[rust2015]~| HELP if this is a dyn-compatible trait, use `dyn` + //[rust2015]~| ERROR the trait `DbHandle` is not dyn compatible [E0038] + //~| HELP there is an associated type with the same name + //[rust2015]~| HELP use `Self` to refer to the implementing type +} + +fn main() {} diff --git a/tests/ui/suggestions/issue-116434-2015.stderr b/tests/ui/suggestions/bare_trait_objects.rust2015.stderr similarity index 93% rename from tests/ui/suggestions/issue-116434-2015.stderr rename to tests/ui/suggestions/bare_trait_objects.rust2015.stderr index 475cc84962538..c63517a2d7f11 100644 --- a/tests/ui/suggestions/issue-116434-2015.stderr +++ b/tests/ui/suggestions/bare_trait_objects.rust2015.stderr @@ -1,5 +1,5 @@ warning: trait objects without an explicit `dyn` are deprecated - --> $DIR/issue-116434-2015.rs:5:17 + --> $DIR/bare_trait_objects.rs:8:17 | LL | fn foo() -> Clone; | ^^^^^ @@ -13,7 +13,7 @@ LL | fn foo() -> dyn Clone; | +++ warning: trait objects without an explicit `dyn` are deprecated - --> $DIR/issue-116434-2015.rs:5:17 + --> $DIR/bare_trait_objects.rs:8:17 | LL | fn foo() -> Clone; | ^^^^^ @@ -27,7 +27,7 @@ LL | fn foo() -> dyn Clone; | +++ error[E0038]: the trait `Clone` is not dyn compatible - --> $DIR/issue-116434-2015.rs:5:17 + --> $DIR/bare_trait_objects.rs:8:17 | LL | fn foo() -> Clone; | ^^^^^ `Clone` is not dyn compatible @@ -46,7 +46,7 @@ LL | fn foo() -> Self::Clone; | ++++++ warning: trait objects without an explicit `dyn` are deprecated - --> $DIR/issue-116434-2015.rs:21:20 + --> $DIR/bare_trait_objects.rs:26:20 | LL | fn handle() -> DbHandle; | ^^^^^^^^ @@ -59,7 +59,7 @@ LL | fn handle() -> dyn DbHandle; | +++ warning: trait objects without an explicit `dyn` are deprecated - --> $DIR/issue-116434-2015.rs:21:20 + --> $DIR/bare_trait_objects.rs:26:20 | LL | fn handle() -> DbHandle; | ^^^^^^^^ @@ -73,14 +73,14 @@ LL | fn handle() -> dyn DbHandle; | +++ error[E0038]: the trait `DbHandle` is not dyn compatible - --> $DIR/issue-116434-2015.rs:21:20 + --> $DIR/bare_trait_objects.rs:26:20 | LL | fn handle() -> DbHandle; | ^^^^^^^^ `DbHandle` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable for more information, visit - --> $DIR/issue-116434-2015.rs:17:17 + --> $DIR/bare_trait_objects.rs:22:17 | LL | trait DbHandle: Sized {} | -------- ^^^^^ ...because it requires `Self: Sized` diff --git a/tests/ui/suggestions/issue-116434-2021.stderr b/tests/ui/suggestions/bare_trait_objects.rust2021.stderr similarity index 92% rename from tests/ui/suggestions/issue-116434-2021.stderr rename to tests/ui/suggestions/bare_trait_objects.rust2021.stderr index 3853f03f1db67..73b25dded9e32 100644 --- a/tests/ui/suggestions/issue-116434-2021.stderr +++ b/tests/ui/suggestions/bare_trait_objects.rust2021.stderr @@ -1,5 +1,5 @@ error[E0782]: expected a type, found a trait - --> $DIR/issue-116434-2021.rs:5:17 + --> $DIR/bare_trait_objects.rs:8:17 | LL | fn foo() -> Clone; | ^^^^^ @@ -14,7 +14,7 @@ LL | fn foo() -> Self::Clone; | ++++++ error[E0782]: expected a type, found a trait - --> $DIR/issue-116434-2021.rs:15:20 + --> $DIR/bare_trait_objects.rs:26:20 | LL | fn handle() -> DbHandle; | ^^^^^^^^ diff --git a/tests/ui/suggestions/issue-116434-2015.rs b/tests/ui/suggestions/issue-116434-2015.rs deleted file mode 100644 index e0438cdef253b..0000000000000 --- a/tests/ui/suggestions/issue-116434-2015.rs +++ /dev/null @@ -1,33 +0,0 @@ -//@ edition: 2015 - -trait Foo { - type Clone; - fn foo() -> Clone; - //~^ WARNING trait objects without an explicit `dyn` are deprecated [bare_trait_objects] - //~| WARNING this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - //~| HELP if this is a dyn-compatible trait, use `dyn` - //~| WARNING trait objects without an explicit `dyn` are deprecated [bare_trait_objects] - //~| WARNING this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - //~| HELP if this is a dyn-compatible trait, use `dyn` - //~| ERROR the trait `Clone` is not dyn compatible [E0038] - //~| HELP there is an associated type with the same name - //~| HELP use `Self` to refer to the implementing type -} - -trait DbHandle: Sized {} - -trait DbInterface { - type DbHandle; - fn handle() -> DbHandle; - //~^ WARNING trait objects without an explicit `dyn` are deprecated [bare_trait_objects] - //~| WARNING this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - //~| HELP if this is a dyn-compatible trait, use `dyn` - //~| WARNING trait objects without an explicit `dyn` are deprecated [bare_trait_objects] - //~| WARNING this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - //~| HELP if this is a dyn-compatible trait, use `dyn` - //~| ERROR the trait `DbHandle` is not dyn compatible [E0038] - //~| HELP there is an associated type with the same name - //~| HELP use `Self` to refer to the implementing type -} - -fn main() {} diff --git a/tests/ui/suggestions/issue-116434-2021.rs b/tests/ui/suggestions/issue-116434-2021.rs deleted file mode 100644 index 77cdfb8b614aa..0000000000000 --- a/tests/ui/suggestions/issue-116434-2021.rs +++ /dev/null @@ -1,21 +0,0 @@ -//@ edition:2021 - -trait Foo { - type Clone; - fn foo() -> Clone; - //~^ ERROR expected a type, found a trait - //~| HELP `Clone` is dyn-incompatible, use `impl Clone` to return an opaque type, as long as you return a single underlying type - //~| HELP there is an associated type with the same name -} - -trait DbHandle: Sized {} - -trait DbInterface { - type DbHandle; - fn handle() -> DbHandle; - //~^ ERROR expected a type, found a trait - //~| HELP `DbHandle` is dyn-incompatible, use `impl DbHandle` to return an opaque type, as long as you return a single underlying type - //~| HELP there is an associated type with the same name -} - -fn main() {} diff --git a/tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand-rust2018.rs b/tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand-rust2018.rs deleted file mode 100644 index f2235843a0648..0000000000000 --- a/tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand-rust2018.rs +++ /dev/null @@ -1,19 +0,0 @@ -//@ edition:2018 -//@ run-rustfix -#![allow(dead_code)] - -trait WithType {} -trait WithRegion<'a> { } - -#[allow(dead_code)] -struct Foo { - t: T -} - -impl Foo -where - T: WithType<&u32> -//~^ ERROR `&` without an explicit lifetime name cannot be used here -{ } - -fn main() {} diff --git a/tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand-rust2015.rs b/tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand.rs similarity index 74% rename from tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand-rust2015.rs rename to tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand.rs index 11c1fd90a4a98..6d4faf1330ba8 100644 --- a/tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand-rust2015.rs +++ b/tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand.rs @@ -1,4 +1,8 @@ //@ run-rustfix +//@ revisions: rust2015 rust2018 +//@[rust2015] edition:2015 +//@[rust2018] edition:2018 + #![allow(dead_code)] trait WithType {} diff --git a/tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand-rust2018.fixed b/tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand.rust2015.fixed similarity index 75% rename from tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand-rust2018.fixed rename to tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand.rust2015.fixed index 5222cf797f721..806827d3faac8 100644 --- a/tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand-rust2018.fixed +++ b/tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand.rust2015.fixed @@ -1,5 +1,8 @@ -//@ edition:2018 //@ run-rustfix +//@ revisions: rust2015 rust2018 +//@[rust2015] edition:2015 +//@[rust2018] edition:2018 + #![allow(dead_code)] trait WithType {} diff --git a/tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand-rust2015.stderr b/tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand.rust2015.stderr similarity index 86% rename from tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand-rust2015.stderr rename to tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand.rust2015.stderr index f012120e550d7..54294435bebae 100644 --- a/tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand-rust2015.stderr +++ b/tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand.rust2015.stderr @@ -1,5 +1,5 @@ error[E0637]: `&` without an explicit lifetime name cannot be used here - --> $DIR/where-clause-inherent-impl-ampersand-rust2015.rs:14:17 + --> $DIR/where-clause-inherent-impl-ampersand.rs:18:17 | LL | T: WithType<&u32> | ^ explicit lifetime name needed here diff --git a/tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand-rust2015.fixed b/tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand.rust2018.fixed similarity index 75% rename from tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand-rust2015.fixed rename to tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand.rust2018.fixed index 6bc09917bee1b..806827d3faac8 100644 --- a/tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand-rust2015.fixed +++ b/tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand.rust2018.fixed @@ -1,4 +1,8 @@ //@ run-rustfix +//@ revisions: rust2015 rust2018 +//@[rust2015] edition:2015 +//@[rust2018] edition:2018 + #![allow(dead_code)] trait WithType {} diff --git a/tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand-rust2018.stderr b/tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand.rust2018.stderr similarity index 86% rename from tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand-rust2018.stderr rename to tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand.rust2018.stderr index 7d675dd41e904..54294435bebae 100644 --- a/tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand-rust2018.stderr +++ b/tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand.rust2018.stderr @@ -1,5 +1,5 @@ error[E0637]: `&` without an explicit lifetime name cannot be used here - --> $DIR/where-clause-inherent-impl-ampersand-rust2018.rs:15:17 + --> $DIR/where-clause-inherent-impl-ampersand.rs:18:17 | LL | T: WithType<&u32> | ^ explicit lifetime name needed here diff --git a/tests/ui/underscore-lifetime/where-clause-trait-impl-region-2015.rs b/tests/ui/underscore-lifetime/where-clause-trait-impl-region-2015.rs deleted file mode 100644 index 3ea02c9478a44..0000000000000 --- a/tests/ui/underscore-lifetime/where-clause-trait-impl-region-2015.rs +++ /dev/null @@ -1,15 +0,0 @@ -//@ run-rustfix -#![allow(dead_code)] - -trait WithType {} -trait WithRegion<'a> { } - -trait Foo { } - -impl Foo for Vec -where - T: WithType<&u32> -//~^ ERROR `&` without an explicit lifetime name cannot be used here -{ } - -fn main() {} diff --git a/tests/ui/underscore-lifetime/where-clause-trait-impl-region-2018.rs b/tests/ui/underscore-lifetime/where-clause-trait-impl-region.rs similarity index 73% rename from tests/ui/underscore-lifetime/where-clause-trait-impl-region-2018.rs rename to tests/ui/underscore-lifetime/where-clause-trait-impl-region.rs index 18e8591e8b504..edff92ca7fe98 100644 --- a/tests/ui/underscore-lifetime/where-clause-trait-impl-region-2018.rs +++ b/tests/ui/underscore-lifetime/where-clause-trait-impl-region.rs @@ -1,5 +1,7 @@ //@ run-rustfix -//@ edition:2018 +//@ revisions: rust2015 rust2018 +//@[rust2015] edition:2015 +//@[rust2018] edition:2018 #![allow(dead_code)] diff --git a/tests/ui/underscore-lifetime/where-clause-trait-impl-region-2018.fixed b/tests/ui/underscore-lifetime/where-clause-trait-impl-region.rust2015.fixed similarity index 74% rename from tests/ui/underscore-lifetime/where-clause-trait-impl-region-2018.fixed rename to tests/ui/underscore-lifetime/where-clause-trait-impl-region.rust2015.fixed index d14ea8ffce8cf..f96441411d3a8 100644 --- a/tests/ui/underscore-lifetime/where-clause-trait-impl-region-2018.fixed +++ b/tests/ui/underscore-lifetime/where-clause-trait-impl-region.rust2015.fixed @@ -1,5 +1,7 @@ //@ run-rustfix -//@ edition:2018 +//@ revisions: rust2015 rust2018 +//@[rust2015] edition:2015 +//@[rust2018] edition:2018 #![allow(dead_code)] diff --git a/tests/ui/underscore-lifetime/where-clause-trait-impl-region-2015.stderr b/tests/ui/underscore-lifetime/where-clause-trait-impl-region.rust2015.stderr similarity index 87% rename from tests/ui/underscore-lifetime/where-clause-trait-impl-region-2015.stderr rename to tests/ui/underscore-lifetime/where-clause-trait-impl-region.rust2015.stderr index 8aa0e52c688db..718b661054f1c 100644 --- a/tests/ui/underscore-lifetime/where-clause-trait-impl-region-2015.stderr +++ b/tests/ui/underscore-lifetime/where-clause-trait-impl-region.rust2015.stderr @@ -1,5 +1,5 @@ error[E0637]: `&` without an explicit lifetime name cannot be used here - --> $DIR/where-clause-trait-impl-region-2015.rs:11:17 + --> $DIR/where-clause-trait-impl-region.rs:15:17 | LL | T: WithType<&u32> | ^ explicit lifetime name needed here diff --git a/tests/ui/underscore-lifetime/where-clause-trait-impl-region-2015.fixed b/tests/ui/underscore-lifetime/where-clause-trait-impl-region.rust2018.fixed similarity index 73% rename from tests/ui/underscore-lifetime/where-clause-trait-impl-region-2015.fixed rename to tests/ui/underscore-lifetime/where-clause-trait-impl-region.rust2018.fixed index 8d9ec9dd74756..f96441411d3a8 100644 --- a/tests/ui/underscore-lifetime/where-clause-trait-impl-region-2015.fixed +++ b/tests/ui/underscore-lifetime/where-clause-trait-impl-region.rust2018.fixed @@ -1,4 +1,8 @@ //@ run-rustfix +//@ revisions: rust2015 rust2018 +//@[rust2015] edition:2015 +//@[rust2018] edition:2018 + #![allow(dead_code)] trait WithType {} diff --git a/tests/ui/underscore-lifetime/where-clause-trait-impl-region-2018.stderr b/tests/ui/underscore-lifetime/where-clause-trait-impl-region.rust2018.stderr similarity index 87% rename from tests/ui/underscore-lifetime/where-clause-trait-impl-region-2018.stderr rename to tests/ui/underscore-lifetime/where-clause-trait-impl-region.rust2018.stderr index 22940d0b0b18d..718b661054f1c 100644 --- a/tests/ui/underscore-lifetime/where-clause-trait-impl-region-2018.stderr +++ b/tests/ui/underscore-lifetime/where-clause-trait-impl-region.rust2018.stderr @@ -1,5 +1,5 @@ error[E0637]: `&` without an explicit lifetime name cannot be used here - --> $DIR/where-clause-trait-impl-region-2018.rs:13:17 + --> $DIR/where-clause-trait-impl-region.rs:15:17 | LL | T: WithType<&u32> | ^ explicit lifetime name needed here