Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mark some edition tests as check-pass #86537

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
// to detect or fix uses of `dyn` under a macro. Since we are testing
// this file via `rustfix`, we want the rustfix output to be
// compilable; so the macros here carefully use `dyn` "correctly."

//
// edition:2015
// run-rustfix

#![allow(non_camel_case_types)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
// to detect or fix uses of `dyn` under a macro. Since we are testing
// this file via `rustfix`, we want the rustfix output to be
// compilable; so the macros here carefully use `dyn` "correctly."

//
// edition:2015
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need it as the default edition is 2015.

Copy link
Contributor Author

@inquisitivecrystal inquisitivecrystal Jun 22, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sorry, I really meant to explain that better and then forgot. We don't need it, but when the test is looking at edition specific behavior, it's clearer to have a marker in the test that shows what edition it runs on. That's presumably why that marking is already on some of the other 2015 edition-specific tests. Plus, we might change the default edition for these tests in the future. If new code is going to be written on a newer edition, it would make sense for most tests to look at the behavior of the current edition rather than the old one, so changing the default could be a good idea at some point. Given all that, I thought it made sense to add it to the tests I was changing anyway, and then I put it on the others in the same group for consistency.

// run-rustfix

#![allow(non_camel_case_types)]
Expand Down
30 changes: 15 additions & 15 deletions src/test/ui/dyn-keyword/dyn-2015-edition-keyword-ident-lint.stderr
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
error: `dyn` is a keyword in the 2018 edition
--> $DIR/dyn-2015-edition-keyword-ident-lint.rs:13:13
--> $DIR/dyn-2015-edition-keyword-ident-lint.rs:14:13
|
LL | pub mod dyn {
| ^^^ help: you can use a raw identifier to stay compatible: `r#dyn`
|
note: the lint level is defined here
--> $DIR/dyn-2015-edition-keyword-ident-lint.rs:10:9
--> $DIR/dyn-2015-edition-keyword-ident-lint.rs:11:9
|
LL | #![deny(keyword_idents)]
| ^^^^^^^^^^^^^^
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition!
= note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716>

error: `dyn` is a keyword in the 2018 edition
--> $DIR/dyn-2015-edition-keyword-ident-lint.rs:16:20
--> $DIR/dyn-2015-edition-keyword-ident-lint.rs:17:20
|
LL | pub struct dyn;
| ^^^ help: you can use a raw identifier to stay compatible: `r#dyn`
Expand All @@ -22,7 +22,7 @@ LL | pub struct dyn;
= note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716>

error: `dyn` is a keyword in the 2018 edition
--> $DIR/dyn-2015-edition-keyword-ident-lint.rs:21:16
--> $DIR/dyn-2015-edition-keyword-ident-lint.rs:22:16
|
LL | use outer_mod::dyn::dyn;
| ^^^ help: you can use a raw identifier to stay compatible: `r#dyn`
Expand All @@ -31,7 +31,7 @@ LL | use outer_mod::dyn::dyn;
= note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716>

error: `dyn` is a keyword in the 2018 edition
--> $DIR/dyn-2015-edition-keyword-ident-lint.rs:21:21
--> $DIR/dyn-2015-edition-keyword-ident-lint.rs:22:21
|
LL | use outer_mod::dyn::dyn;
| ^^^ help: you can use a raw identifier to stay compatible: `r#dyn`
Expand All @@ -40,7 +40,7 @@ LL | use outer_mod::dyn::dyn;
= note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716>

error: `dyn` is a keyword in the 2018 edition
--> $DIR/dyn-2015-edition-keyword-ident-lint.rs:28:11
--> $DIR/dyn-2015-edition-keyword-ident-lint.rs:29:11
|
LL | match dyn { dyn => {} }
| ^^^ help: you can use a raw identifier to stay compatible: `r#dyn`
Expand All @@ -49,7 +49,7 @@ LL | match dyn { dyn => {} }
= note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716>

error: `dyn` is a keyword in the 2018 edition
--> $DIR/dyn-2015-edition-keyword-ident-lint.rs:28:17
--> $DIR/dyn-2015-edition-keyword-ident-lint.rs:29:17
|
LL | match dyn { dyn => {} }
| ^^^ help: you can use a raw identifier to stay compatible: `r#dyn`
Expand All @@ -58,7 +58,7 @@ LL | match dyn { dyn => {} }
= note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716>

error: `dyn` is a keyword in the 2018 edition
--> $DIR/dyn-2015-edition-keyword-ident-lint.rs:33:17
--> $DIR/dyn-2015-edition-keyword-ident-lint.rs:34:17
|
LL | macro_defn::dyn();
| ^^^ help: you can use a raw identifier to stay compatible: `r#dyn`
Expand All @@ -67,7 +67,7 @@ LL | macro_defn::dyn();
= note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716>

error: `dyn` is a keyword in the 2018 edition
--> $DIR/dyn-2015-edition-keyword-ident-lint.rs:43:18
--> $DIR/dyn-2015-edition-keyword-ident-lint.rs:44:18
|
LL | macro_rules! dyn {
| ^^^ help: you can use a raw identifier to stay compatible: `r#dyn`
Expand All @@ -76,7 +76,7 @@ LL | macro_rules! dyn {
= note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716>

error: `dyn` is a keyword in the 2018 edition
--> $DIR/dyn-2015-edition-keyword-ident-lint.rs:51:12
--> $DIR/dyn-2015-edition-keyword-ident-lint.rs:52:12
|
LL | pub fn dyn() -> ::outer_mod::dyn::dyn {
| ^^^ help: you can use a raw identifier to stay compatible: `r#dyn`
Expand All @@ -85,7 +85,7 @@ LL | pub fn dyn() -> ::outer_mod::dyn::dyn {
= note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716>

error: `dyn` is a keyword in the 2018 edition
--> $DIR/dyn-2015-edition-keyword-ident-lint.rs:51:34
--> $DIR/dyn-2015-edition-keyword-ident-lint.rs:52:34
|
LL | pub fn dyn() -> ::outer_mod::dyn::dyn {
| ^^^ help: you can use a raw identifier to stay compatible: `r#dyn`
Expand All @@ -94,7 +94,7 @@ LL | pub fn dyn() -> ::outer_mod::dyn::dyn {
= note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716>

error: `dyn` is a keyword in the 2018 edition
--> $DIR/dyn-2015-edition-keyword-ident-lint.rs:51:39
--> $DIR/dyn-2015-edition-keyword-ident-lint.rs:52:39
|
LL | pub fn dyn() -> ::outer_mod::dyn::dyn {
| ^^^ help: you can use a raw identifier to stay compatible: `r#dyn`
Expand All @@ -103,7 +103,7 @@ LL | pub fn dyn() -> ::outer_mod::dyn::dyn {
= note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716>

error: `dyn` is a keyword in the 2018 edition
--> $DIR/dyn-2015-edition-keyword-ident-lint.rs:58:22
--> $DIR/dyn-2015-edition-keyword-ident-lint.rs:59:22
|
LL | ::outer_mod::dyn::dyn
| ^^^ help: you can use a raw identifier to stay compatible: `r#dyn`
Expand All @@ -112,7 +112,7 @@ LL | ::outer_mod::dyn::dyn
= note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716>

error: `dyn` is a keyword in the 2018 edition
--> $DIR/dyn-2015-edition-keyword-ident-lint.rs:58:27
--> $DIR/dyn-2015-edition-keyword-ident-lint.rs:59:27
|
LL | ::outer_mod::dyn::dyn
| ^^^ help: you can use a raw identifier to stay compatible: `r#dyn`
Expand All @@ -121,7 +121,7 @@ LL | ::outer_mod::dyn::dyn
= note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716>

error: `dyn` is a keyword in the 2018 edition
--> $DIR/dyn-2015-edition-keyword-ident-lint.rs:67:23
--> $DIR/dyn-2015-edition-keyword-ident-lint.rs:68:23
|
LL | pub fn boxed() -> dyn!(
| ^^^ help: you can use a raw identifier to stay compatible: `r#dyn`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
// build-pass (FIXME(62277): could be check-pass?)

// Under the 2015 edition with the keyword_idents lint, `dyn` is
// not entirely acceptable as an identifier.
//
// We currently do not attempt to detect or fix uses of `dyn` as an
// identifier under a macro, including under the declarative `macro`
// forms from macros 1.2 and macros 2.0.
//
// check-pass
// edition:2015

#![feature(decl_macro)]
#![allow(non_camel_case_types)]
Expand Down
5 changes: 3 additions & 2 deletions src/test/ui/dyn-keyword/dyn-2015-idents-in-macros-unlinted.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
// build-pass (FIXME(62277): could be check-pass?)

// Under the 2015 edition with the keyword_idents lint, `dyn` is
// not entirely acceptable as an identifier.
//
// We currently do not attempt to detect or fix uses of `dyn` as an
// identifier under a macro.
//
// check-pass
// edition:2015

#![allow(non_camel_case_types)]
#![deny(keyword_idents)]
Expand Down
5 changes: 3 additions & 2 deletions src/test/ui/dyn-keyword/dyn-2015-no-warnings-without-lints.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// Under the 2015 edition without the keyword_idents lint, `dyn` is
// entirely acceptable as an identifier.

// build-pass (FIXME(62277): could be check-pass?)
//
// check-pass
// edition:2015

#![allow(non_camel_case_types)]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// check-pass

// edition:2015
//
// rust-lang/rust#56327: Some occurrences of `dyn` within a macro are
// not instances of identifiers, and thus should *not* be caught by the
// keyword_ident lint.
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/editions/edition-feature-ok.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// build-pass (FIXME(62277): could be check-pass?)
// check-pass

#![feature(rust_2018_preview)]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// build-pass (FIXME(62277): could be check-pass?)
// check-pass
// edition:2018
// compile-flags:--extern edition_imports_2015
// aux-build:edition-imports-2015.rs
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// edition:2015
// aux-build:edition-kw-macro-2015.rs
// build-pass (FIXME(62277): could be check-pass?)
// check-pass

#![allow(keyword_idents)]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// edition:2018
// aux-build:edition-kw-macro-2015.rs
// build-pass (FIXME(62277): could be check-pass?)
// check-pass

#![allow(keyword_idents)]

Expand Down