diff options
| author | Mark Rousskov <mark.simulacrum@gmail.com> | 2019-11-12 12:09:20 -0500 |
|---|---|---|
| committer | Mark Rousskov <mark.simulacrum@gmail.com> | 2019-12-03 12:19:14 -0500 |
| commit | f03d8f305a80778ae034b0205803ea3edc297ac8 (patch) | |
| tree | 510804ecf5b989dcb8e21f116f2c9950addb1ec3 /src/libsyntax | |
| parent | 526ee51ccc02a64fe95e3df9bc24ddd395dc58ce (diff) | |
| download | rust-f03d8f305a80778ae034b0205803ea3edc297ac8.tar.gz rust-f03d8f305a80778ae034b0205803ea3edc297ac8.zip | |
Move early lint declarations to librustc_session
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/Cargo.toml | 1 | ||||
| -rw-r--r-- | src/libsyntax/early_buffered_lints.rs | 31 | ||||
| -rw-r--r-- | src/libsyntax/sess.rs | 4 |
3 files changed, 27 insertions, 9 deletions
diff --git a/src/libsyntax/Cargo.toml b/src/libsyntax/Cargo.toml index 085c1760c80..8a00bcbfe17 100644 --- a/src/libsyntax/Cargo.toml +++ b/src/libsyntax/Cargo.toml @@ -24,3 +24,4 @@ rustc_lexer = { path = "../librustc_lexer" } rustc_macros = { path = "../librustc_macros" } smallvec = { version = "1.0", features = ["union", "may_dangle"] } rustc_error_codes = { path = "../librustc_error_codes" } +rustc_session = { path = "../librustc_session" } diff --git a/src/libsyntax/early_buffered_lints.rs b/src/libsyntax/early_buffered_lints.rs index 5cc953b9066..e6b86a0f4fb 100644 --- a/src/libsyntax/early_buffered_lints.rs +++ b/src/libsyntax/early_buffered_lints.rs @@ -5,13 +5,30 @@ use crate::ast::NodeId; use syntax_pos::MultiSpan; +use rustc_session::lint::FutureIncompatibleInfo; +use rustc_session::declare_lint; +pub use rustc_session::lint::BufferedEarlyLint; -/// Since we cannot import `LintId`s from `rustc::lint`, we define some Ids here which can later be -/// passed to `rustc::lint::Lint::from_parser_lint_id` to get a `rustc::lint::Lint`. -pub enum BufferedEarlyLintId { - IllFormedAttributeInput, - MetaVariableMisuse, - IncompleteInclude, +declare_lint! { + pub ILL_FORMED_ATTRIBUTE_INPUT, + Deny, + "ill-formed attribute inputs that were previously accepted and used in practice", + @future_incompatible = FutureIncompatibleInfo { + reference: "issue #57571 <https://github.com/rust-lang/rust/issues/57571>", + edition: None, + }; +} + +declare_lint! { + pub META_VARIABLE_MISUSE, + Allow, + "possible meta-variable misuse at macro definition" +} + +declare_lint! { + pub INCOMPLETE_INCLUDE, + Deny, + "trailing content in included file" } /// Stores buffered lint info which can later be passed to `librustc`. @@ -26,5 +43,5 @@ pub struct BufferedEarlyLint { pub id: NodeId, /// A lint Id that can be passed to `rustc::lint::Lint::from_parser_lint_id`. - pub lint_id: BufferedEarlyLintId, + pub lint_id: &'static rustc_session::lint::Lint, } diff --git a/src/libsyntax/sess.rs b/src/libsyntax/sess.rs index aa9217c1b69..555e8a134f7 100644 --- a/src/libsyntax/sess.rs +++ b/src/libsyntax/sess.rs @@ -2,7 +2,7 @@ //! It also serves as an input to the parser itself. use crate::ast::{CrateConfig, NodeId}; -use crate::early_buffered_lints::{BufferedEarlyLint, BufferedEarlyLintId}; +use crate::early_buffered_lints::BufferedEarlyLint; use errors::{Applicability, emitter::SilentEmitter, Handler, ColorConfig, DiagnosticBuilder}; use rustc_data_structures::fx::{FxHashSet, FxHashMap}; @@ -137,7 +137,7 @@ impl ParseSess { pub fn buffer_lint( &self, - lint_id: BufferedEarlyLintId, + lint_id: &'static rustc_session::lint::Lint, span: impl Into<MultiSpan>, id: NodeId, msg: &str, |
