-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Lint async
identifiers in 2018 preparation mode
#52375
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
Merged
bors
merged 4 commits into
rust-lang:master
from
oli-obk:the_early_lint_pass_gets_the_worm
Jul 18, 2018
Merged
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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,87 @@ | ||
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT | ||
// file at the top-level directory of this distribution and at | ||
// http://rust-lang.org/COPYRIGHT. | ||
// | ||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
|
||
#![feature(raw_identifiers)] | ||
#![allow(dead_code, unused_variables, non_camel_case_types, non_upper_case_globals)] | ||
|
||
// edition:2015 | ||
// run-rustfix | ||
|
||
fn r#async() {} //~ ERROR async | ||
//~^ WARN hard error in the 2018 edition | ||
|
||
macro_rules! foo { | ||
($foo:ident) => {}; | ||
($r#async:expr, r#async) => {}; | ||
//~^ ERROR async | ||
//~| ERROR async | ||
//~| WARN hard error in the 2018 edition | ||
//~| WARN hard error in the 2018 edition | ||
} | ||
|
||
foo!(async); | ||
|
||
mod dont_lint_raw { | ||
fn r#async() {} | ||
} | ||
|
||
mod async_trait { | ||
trait r#async {} | ||
//~^ ERROR async | ||
//~| WARN hard error in the 2018 edition | ||
struct MyStruct; | ||
impl r#async for MyStruct {} | ||
//~^ ERROR async | ||
//~| WARN hard error in the 2018 edition | ||
} | ||
|
||
mod async_static { | ||
static r#async: u32 = 0; | ||
//~^ ERROR async | ||
//~| WARN hard error in the 2018 edition | ||
} | ||
|
||
mod async_const { | ||
const r#async: u32 = 0; | ||
//~^ ERROR async | ||
//~| WARN hard error in the 2018 edition | ||
} | ||
|
||
struct Foo; | ||
impl Foo { fn r#async() {} } | ||
//~^ ERROR async | ||
//~| WARN hard error in the 2018 edition | ||
|
||
fn main() { | ||
struct r#async {} | ||
//~^ ERROR async | ||
//~| WARN hard error in the 2018 edition | ||
let r#async: r#async = r#async {}; | ||
//~^ ERROR async | ||
//~| WARN hard error in the 2018 edition | ||
//~| ERROR async | ||
//~| WARN hard error in the 2018 edition | ||
//~| ERROR async | ||
//~| WARN hard error in the 2018 edition | ||
} | ||
|
||
#[macro_export] | ||
macro_rules! produces_async { | ||
() => (pub fn r#async() {}) | ||
//~^ ERROR async | ||
//~| WARN hard error in the 2018 edition | ||
} | ||
|
||
#[macro_export] | ||
macro_rules! consumes_async { | ||
(r#async) => (1) | ||
//~^ ERROR async | ||
//~| WARN hard error in the 2018 edition | ||
} |
Oops, something went wrong.
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.
Just to confirm, but the
Deny
here was for tests?For the other 2018 lints at least they're all set to
Allow
by default and they're only active with the lint group turned on (which rustfix does automatically)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.
I just followed what another 2018 incompat lint did, and that was deny
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.
E.g.
rust/src/librustc/lint/builtin.rs
Line 302 in 68c39b9
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.
Aha, that's not a 2018 lint I think because that's changing for the 2015 edition, I was thinking of lints like this one --
rust/src/librustc/lint/builtin.rs
Lines 264 to 269 in 68c39b9
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.
Then this is wrong:
rust/src/librustc_lint/lib.rs
Lines 213 to 216 in 254f879
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.
Ah I believe so! Want to file an issue for that?
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.
edition lints can be any level they wish to be, that one probably makes more sense as deny, but this one should be allow