-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
warn about keywords in macro invocations #54111
Merged
bors
merged 4 commits into
rust-lang:master
from
nikomatsakis:issue-53686-keywords-and-macros
Sep 11, 2018
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
38774aa
make `add_pre_expansion_builtin` add a pre-expansion lint
nikomatsakis b1a9f9e
visit the paths in pre-expansion macros
nikomatsakis 5adbdf8
add test case
nikomatsakis 0cd8e0d
we now successfully warn about `async` in macro invocations
nikomatsakis 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 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 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 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 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 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 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 @@ | ||
// Test that `try!` macros are rewritten. | ||
|
||
// run-rustfix | ||
// compile-pass | ||
|
||
#![warn(rust_2018_compatibility)] | ||
#![allow(unused_variables)] | ||
#![allow(dead_code)] | ||
|
||
fn foo() -> Result<usize, ()> { | ||
let x: Result<usize, ()> = Ok(22); | ||
r#try!(x); | ||
Ok(44) | ||
} | ||
|
||
fn main() { } |
This file contains 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 @@ | ||
// Test that `try!` macros are rewritten. | ||
|
||
// run-rustfix | ||
// compile-pass | ||
|
||
#![warn(rust_2018_compatibility)] | ||
#![allow(unused_variables)] | ||
#![allow(dead_code)] | ||
|
||
fn foo() -> Result<usize, ()> { | ||
let x: Result<usize, ()> = Ok(22); | ||
try!(x); | ||
Ok(44) | ||
} | ||
|
||
fn main() { } |
This file contains 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,15 @@ | ||
warning: `try` is a keyword in the 2018 edition | ||
--> $DIR/try-macro.rs:12:5 | ||
| | ||
LL | try!(x); | ||
| ^^^ help: you can use a raw identifier to stay compatible: `r#try` | ||
| | ||
note: lint level defined here | ||
--> $DIR/try-macro.rs:6:9 | ||
| | ||
LL | #![warn(rust_2018_compatibility)] | ||
| ^^^^^^^^^^^^^^^^^^^^^^^ | ||
= note: #[warn(keyword_idents)] implied by #[warn(rust_2018_compatibility)] | ||
= 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> | ||
|
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Heh, I had all of this PR awhile back except this line, I'm glad you knew this existed!