diff options
| author | Manish Goregaokar <manishsmail@gmail.com> | 2020-06-19 09:15:08 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-06-19 09:15:08 -0700 |
| commit | 058971cef3e7ce5925fa910239645f7c793d8dbc (patch) | |
| tree | ca2405a852667ef777c40b1ff878c160cdb27bcf /src/librustc_session | |
| parent | 4910206b4a5b36ce0d82e08f1e33e72875fd28df (diff) | |
| parent | f633dd385f7b064b4d9eb77e77a4836dc65ca82c (diff) | |
| download | rust-058971cef3e7ce5925fa910239645f7c793d8dbc.tar.gz rust-058971cef3e7ce5925fa910239645f7c793d8dbc.zip | |
Rollup merge of #73300 - crlf0710:crate_level_only_check, r=petrochenkov
Implement crate-level-only lints checking. This implements a crate_level_only flag on lints, and when it is true, it becomes an error when user tries to specify this flag upon nodes other than crate node. This also turns on this flag for all non_ascii_ident lints.
Diffstat (limited to 'src/librustc_session')
| -rw-r--r-- | src/librustc_session/lint.rs | 4 | ||||
| -rw-r--r-- | src/librustc_session/lint/builtin.rs | 11 |
2 files changed, 12 insertions, 3 deletions
diff --git a/src/librustc_session/lint.rs b/src/librustc_session/lint.rs index ffb45793090..0dcbee08abe 100644 --- a/src/librustc_session/lint.rs +++ b/src/librustc_session/lint.rs @@ -88,6 +88,8 @@ pub struct Lint { /// `Some` if this lint is feature gated, otherwise `None`. pub feature_gate: Option<Symbol>, + + pub crate_level_only: bool, } /// Extra information for a future incompatibility lint. @@ -111,6 +113,7 @@ impl Lint { report_in_external_macro: false, future_incompatible: None, feature_gate: None, + crate_level_only: false, } } @@ -336,6 +339,7 @@ macro_rules! declare_tool_lint { future_incompatible: None, is_plugin: true, feature_gate: None, + crate_level_only: false, }; ); } diff --git a/src/librustc_session/lint/builtin.rs b/src/librustc_session/lint/builtin.rs index 5a8f5c1b9fb..5deee6eb48e 100644 --- a/src/librustc_session/lint/builtin.rs +++ b/src/librustc_session/lint/builtin.rs @@ -17,6 +17,7 @@ declare_lint! { reference: "issue #57571 <https://github.com/rust-lang/rust/issues/57571>", edition: None, }; + crate_level_only } declare_lint! { @@ -75,7 +76,8 @@ declare_lint! { declare_lint! { pub UNUSED_CRATE_DEPENDENCIES, Allow, - "crate dependencies that are never used" + "crate dependencies that are never used", + crate_level_only } declare_lint! { @@ -166,7 +168,8 @@ declare_lint! { declare_lint! { pub UNKNOWN_CRATE_TYPES, Deny, - "unknown crate type found in `#[crate_type]` directive" + "unknown crate type found in `#[crate_type]` directive", + crate_level_only } declare_lint! { @@ -339,7 +342,8 @@ declare_lint! { declare_lint! { pub ELIDED_LIFETIMES_IN_PATHS, Allow, - "hidden lifetime parameters in types are deprecated" + "hidden lifetime parameters in types are deprecated", + crate_level_only } declare_lint! { @@ -459,6 +463,7 @@ declare_lint! { reference: "issue #52234 <https://github.com/rust-lang/rust/issues/52234>", edition: None, }; + crate_level_only } declare_lint! { |
