-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Make dyn
a keyword in the 2018 edition
#54261
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// edition:2015 | ||
// run-rustfix | ||
|
||
#![allow(unused_variables)] | ||
#![deny(keyword_idents)] | ||
|
||
fn main() { | ||
let r#dyn = (); //~ ERROR dyn | ||
//~^ WARN hard error in the 2018 edition | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// edition:2015 | ||
// run-rustfix | ||
|
||
#![allow(unused_variables)] | ||
#![deny(keyword_idents)] | ||
|
||
fn main() { | ||
let dyn = (); //~ ERROR dyn | ||
//~^ WARN hard error in the 2018 edition | ||
} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
error: `dyn` is a keyword in the 2018 edition | ||
--> $DIR/dyn-keyword.rs:8:9 | ||
| | ||
LL | let dyn = (); //~ ERROR dyn | ||
| ^^^ help: you can use a raw identifier to stay compatible: `r#dyn` | ||
| | ||
note: lint level defined here | ||
--> $DIR/dyn-keyword.rs:5: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: aborting due to previous error | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// edition:2018 | ||
|
||
type A0 = dyn; | ||
type A1 = dyn::dyn; //~ERROR expected identifier, found reserved keyword | ||
type A2 = dyn<dyn, dyn>; //~ERROR expected identifier, found `<` | ||
type A3 = dyn<<dyn as dyn>::dyn>; | ||
|
||
fn main() {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
error: expected identifier, found reserved keyword `dyn` | ||
--> $DIR/dyn-trait-compatibility.rs:4:16 | ||
| | ||
LL | type A1 = dyn::dyn; //~ERROR expected identifier, found reserved keyword | ||
| ^^^ expected identifier, found reserved keyword | ||
|
||
error: expected identifier, found `<` | ||
--> $DIR/dyn-trait-compatibility.rs:5:14 | ||
| | ||
LL | type A2 = dyn<dyn, dyn>; //~ERROR expected identifier, found `<` | ||
| ^ expected identifier | ||
|
||
error: aborting due to 2 previous errors | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.