about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--Cargo.lock2
-rw-r--r--src/librustc/lint/builtin.rs31
-rw-r--r--src/librustc/lint/internal.rs1
-rw-r--r--src/librustc/lint/levels.rs18
-rw-r--r--src/librustc/lint/mod.rs108
-rw-r--r--src/librustc/session/config.rs4
-rw-r--r--src/librustc_driver/lib.rs2
-rw-r--r--src/librustc_interface/passes.rs3
-rw-r--r--src/librustc_lint/Cargo.toml1
-rw-r--r--src/librustc_lint/lib.rs2
-rw-r--r--src/librustc_parse/validate_attr.rs4
-rw-r--r--src/librustc_session/lib.rs1
-rw-r--r--src/librustc_session/lint.rs122
-rw-r--r--src/libsyntax/Cargo.toml1
-rw-r--r--src/libsyntax/early_buffered_lints.rs31
-rw-r--r--src/libsyntax/sess.rs4
-rw-r--r--src/libsyntax_expand/mbe/macro_check.rs4
-rw-r--r--src/libsyntax_ext/source_util.rs4
18 files changed, 172 insertions, 171 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 7bdef057fd1..5f911a45330 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -3700,6 +3700,7 @@ dependencies = [
  "rustc_error_codes",
  "rustc_feature",
  "rustc_index",
+ "rustc_session",
  "rustc_target",
  "syntax",
  "syntax_pos",
@@ -4477,6 +4478,7 @@ dependencies = [
  "rustc_index",
  "rustc_lexer",
  "rustc_macros",
+ "rustc_session",
  "scoped-tls",
  "serialize",
  "smallvec 1.0.0",
diff --git a/src/librustc/lint/builtin.rs b/src/librustc/lint/builtin.rs
index f8a592d22c1..1aba73ec73d 100644
--- a/src/librustc/lint/builtin.rs
+++ b/src/librustc/lint/builtin.rs
@@ -12,6 +12,8 @@ use syntax::ast;
 use syntax::edition::Edition;
 use syntax::source_map::Span;
 use syntax::symbol::Symbol;
+use syntax::early_buffered_lints::{ILL_FORMED_ATTRIBUTE_INPUT, META_VARIABLE_MISUSE};
+use rustc_session::declare_lint;
 
 declare_lint! {
     pub EXCEEDING_BITSHIFTS,
@@ -404,31 +406,6 @@ declare_lint! {
     };
 }
 
-/// Some lints that are buffered from `libsyntax`. See `syntax::early_buffered_lints`.
-pub mod parser {
-    declare_lint! {
-        pub ILL_FORMED_ATTRIBUTE_INPUT,
-        Deny,
-        "ill-formed attribute inputs that were previously accepted and used in practice",
-        @future_incompatible = super::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"
-    }
-}
-
 declare_lint! {
     pub DEPRECATED_IN_FUTURE,
     Allow,
@@ -520,8 +497,8 @@ declare_lint_pass! {
         PROC_MACRO_DERIVE_RESOLUTION_FALLBACK,
         MACRO_USE_EXTERN_CRATE,
         MACRO_EXPANDED_MACRO_EXPORTS_ACCESSED_BY_ABSOLUTE_PATHS,
-        parser::ILL_FORMED_ATTRIBUTE_INPUT,
-        parser::META_VARIABLE_MISUSE,
+        ILL_FORMED_ATTRIBUTE_INPUT,
+        META_VARIABLE_MISUSE,
         DEPRECATED_IN_FUTURE,
         AMBIGUOUS_ASSOCIATED_ITEMS,
         MUTABLE_BORROW_RESERVATION_CONFLICT,
diff --git a/src/librustc/lint/internal.rs b/src/librustc/lint/internal.rs
index 1c5f86f4801..10c0c63995c 100644
--- a/src/librustc/lint/internal.rs
+++ b/src/librustc/lint/internal.rs
@@ -9,6 +9,7 @@ use errors::Applicability;
 use rustc_data_structures::fx::FxHashMap;
 use syntax::ast::{Ident, Item, ItemKind};
 use syntax::symbol::{sym, Symbol};
+use rustc_session::declare_tool_lint;
 
 declare_tool_lint! {
     pub rustc::DEFAULT_HASH_TYPES,
diff --git a/src/librustc/lint/levels.rs b/src/librustc/lint/levels.rs
index ca246994e5c..f29d1a3789a 100644
--- a/src/librustc/lint/levels.rs
+++ b/src/librustc/lint/levels.rs
@@ -8,7 +8,7 @@ use crate::lint::{self, Lint, LintId, Level, LintSource};
 use crate::session::Session;
 use crate::util::nodemap::FxHashMap;
 use errors::{Applicability, DiagnosticBuilder};
-use rustc_data_structures::stable_hasher::{HashStable, ToStableHashKey, StableHasher};
+use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
 use syntax::ast;
 use syntax::attr;
 use syntax::feature_gate;
@@ -566,19 +566,3 @@ impl<'a> HashStable<StableHashingContext<'a>> for LintLevelMap {
         })
     }
 }
-
-impl<HCX> HashStable<HCX> for LintId {
-    #[inline]
-    fn hash_stable(&self, hcx: &mut HCX, hasher: &mut StableHasher) {
-        self.lint_name_raw().hash_stable(hcx, hasher);
-    }
-}
-
-impl<HCX> ToStableHashKey<HCX> for LintId {
-    type KeyType = &'static str;
-
-    #[inline]
-    fn to_stable_hash_key(&self, _: &HCX) -> &'static str {
-        self.lint_name_raw()
-    }
-}
diff --git a/src/librustc/lint/mod.rs b/src/librustc/lint/mod.rs
index 3abda8023f3..a8d88686679 100644
--- a/src/librustc/lint/mod.rs
+++ b/src/librustc/lint/mod.rs
@@ -32,7 +32,6 @@ use crate::ty::TyCtxt;
 use crate::ty::query::Providers;
 use crate::util::nodemap::NodeMap;
 use errors::{DiagnosticBuilder, DiagnosticId};
-use std::{hash, ptr};
 use syntax::ast;
 use syntax::source_map::{MultiSpan, ExpnKind, DesugaringKind};
 use syntax::symbol::Symbol;
@@ -43,72 +42,7 @@ pub use crate::lint::context::{LateContext, EarlyContext, LintContext, LintStore
                         check_crate, check_ast_crate, late_lint_mod, CheckLintNameResult,
                         BufferedEarlyLint,};
 
-pub use rustc_session::lint::{Lint, Level, FutureIncompatibleInfo};
-
-/// Declares a static item of type `&'static Lint`.
-#[macro_export]
-macro_rules! declare_lint {
-    ($vis: vis $NAME: ident, $Level: ident, $desc: expr) => (
-        declare_lint!(
-            $vis $NAME, $Level, $desc,
-        );
-    );
-    ($vis: vis $NAME: ident, $Level: ident, $desc: expr,
-     $(@future_incompatible = $fi:expr;)? $($v:ident),*) => (
-        $vis static $NAME: &$crate::lint::Lint = &$crate::lint::Lint {
-            name: stringify!($NAME),
-            default_level: $crate::lint::$Level,
-            desc: $desc,
-            edition_lint_opts: None,
-            is_plugin: false,
-            $($v: true,)*
-            $(future_incompatible: Some($fi),)*
-            ..$crate::lint::Lint::default_fields_for_macro()
-        };
-    );
-    ($vis: vis $NAME: ident, $Level: ident, $desc: expr,
-     $lint_edition: expr => $edition_level: ident
-    ) => (
-        $vis static $NAME: &$crate::lint::Lint = &$crate::lint::Lint {
-            name: stringify!($NAME),
-            default_level: $crate::lint::$Level,
-            desc: $desc,
-            edition_lint_opts: Some(($lint_edition, $crate::lint::Level::$edition_level)),
-            report_in_external_macro: false,
-            is_plugin: false,
-        };
-    );
-}
-
-#[macro_export]
-macro_rules! declare_tool_lint {
-    (
-        $(#[$attr:meta])* $vis:vis $tool:ident ::$NAME:ident, $Level: ident, $desc: expr
-    ) => (
-        declare_tool_lint!{$(#[$attr])* $vis $tool::$NAME, $Level, $desc, false}
-    );
-    (
-        $(#[$attr:meta])* $vis:vis $tool:ident ::$NAME:ident, $Level:ident, $desc:expr,
-        report_in_external_macro: $rep:expr
-    ) => (
-         declare_tool_lint!{$(#[$attr])* $vis $tool::$NAME, $Level, $desc, $rep}
-    );
-    (
-        $(#[$attr:meta])* $vis:vis $tool:ident ::$NAME:ident, $Level:ident, $desc:expr,
-        $external:expr
-    ) => (
-        $(#[$attr])*
-        $vis static $NAME: &$crate::lint::Lint = &$crate::lint::Lint {
-            name: &concat!(stringify!($tool), "::", stringify!($NAME)),
-            default_level: $crate::lint::$Level,
-            desc: $desc,
-            edition_lint_opts: None,
-            report_in_external_macro: $external,
-            future_incompatible: None,
-            is_plugin: true,
-        };
-    );
-}
+pub use rustc_session::lint::{Lint, LintId, Level, FutureIncompatibleInfo};
 
 /// Declares a static `LintArray` and return it as an expression.
 #[macro_export]
@@ -420,46 +354,6 @@ pub type EarlyLintPassObject = Box<dyn EarlyLintPass + sync::Send + sync::Sync +
 pub type LateLintPassObject = Box<dyn for<'a, 'tcx> LateLintPass<'a, 'tcx> + sync::Send
                                                                            + sync::Sync + 'static>;
 
-/// Identifies a lint known to the compiler.
-#[derive(Clone, Copy, Debug)]
-pub struct LintId {
-    // Identity is based on pointer equality of this field.
-    lint: &'static Lint,
-}
-
-impl PartialEq for LintId {
-    fn eq(&self, other: &LintId) -> bool {
-        ptr::eq(self.lint, other.lint)
-    }
-}
-
-impl Eq for LintId { }
-
-impl hash::Hash for LintId {
-    fn hash<H: hash::Hasher>(&self, state: &mut H) {
-        let ptr = self.lint as *const Lint;
-        ptr.hash(state);
-    }
-}
-
-impl LintId {
-    /// Gets the `LintId` for a `Lint`.
-    pub fn of(lint: &'static Lint) -> LintId {
-        LintId {
-            lint,
-        }
-    }
-
-    pub fn lint_name_raw(&self) -> &'static str {
-        self.lint.name
-    }
-
-    /// Gets the name of the lint.
-    pub fn to_string(&self) -> String {
-        self.lint.name_lower()
-    }
-}
-
 /// How a lint level was set.
 #[derive(Clone, Copy, PartialEq, Eq, HashStable)]
 pub enum LintSource {
diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs
index 9a242d9d076..6a6ed3260de 100644
--- a/src/librustc/session/config.rs
+++ b/src/librustc/session/config.rs
@@ -1,7 +1,7 @@
 //! Contains infrastructure for configuring the compiler, including parsing
 //! command-line options.
 
-use crate::lint;
+use rustc_session::lint;
 use crate::middle::cstore;
 use crate::session::{early_error, early_warn, Session};
 use crate::session::search_paths::SearchPath;
@@ -2854,7 +2854,7 @@ impl PpMode {
 /// we have an opt-in scheme here, so one is hopefully forced to think about
 /// how the hash should be calculated when adding a new command-line argument.
 mod dep_tracking {
-    use crate::lint;
+    use rustc_session::lint;
     use crate::middle::cstore;
     use std::collections::BTreeMap;
     use std::hash::Hash;
diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs
index 93f4e73ccc3..05945504db2 100644
--- a/src/librustc_driver/lib.rs
+++ b/src/librustc_driver/lib.rs
@@ -828,7 +828,7 @@ Available lint options:
 
     fn sort_lints(sess: &Session, mut lints: Vec<&'static Lint>) -> Vec<&'static Lint> {
         // The sort doesn't case-fold but it's doubtful we care.
-        lints.sort_by_cached_key(|x: &&Lint| (x.default_level(sess), x.name));
+        lints.sort_by_cached_key(|x: &&Lint| (x.default_level(sess.edition()), x.name));
         lints
     }
 
diff --git a/src/librustc_interface/passes.rs b/src/librustc_interface/passes.rs
index f985a5b3755..235184382c5 100644
--- a/src/librustc_interface/passes.rs
+++ b/src/librustc_interface/passes.rs
@@ -439,8 +439,7 @@ fn configure_and_expand_inner<'a>(
     sess.parse_sess.buffered_lints.with_lock(|buffered_lints| {
         info!("{} parse sess buffered_lints", buffered_lints.len());
         for BufferedEarlyLint{id, span, msg, lint_id} in buffered_lints.drain(..) {
-            let lint = lint::Lint::from_parser_lint_id(lint_id);
-            resolver.lint_buffer().buffer_lint(lint, id, span, &msg);
+            resolver.lint_buffer().buffer_lint(lint_id, id, span, &msg);
         }
     });
 
diff --git a/src/librustc_lint/Cargo.toml b/src/librustc_lint/Cargo.toml
index ed38243581b..e834b87896d 100644
--- a/src/librustc_lint/Cargo.toml
+++ b/src/librustc_lint/Cargo.toml
@@ -18,3 +18,4 @@ rustc_data_structures = { path = "../librustc_data_structures" }
 rustc_feature = { path = "../librustc_feature" }
 rustc_index = { path = "../librustc_index" }
 rustc_error_codes = { path = "../librustc_error_codes" }
+rustc_session = { path = "../librustc_session" }
diff --git a/src/librustc_lint/lib.rs b/src/librustc_lint/lib.rs
index ab4063c421c..e60c025c3ef 100644
--- a/src/librustc_lint/lib.rs
+++ b/src/librustc_lint/lib.rs
@@ -21,6 +21,8 @@
 
 #[macro_use]
 extern crate rustc;
+#[macro_use]
+extern crate rustc_session;
 
 mod array_into_iter;
 mod nonstandard_style;
diff --git a/src/librustc_parse/validate_attr.rs b/src/librustc_parse/validate_attr.rs
index 0fb348efece..8601add3f6f 100644
--- a/src/librustc_parse/validate_attr.rs
+++ b/src/librustc_parse/validate_attr.rs
@@ -4,7 +4,7 @@ use errors::{PResult, Applicability};
 use rustc_feature::{AttributeTemplate, BUILTIN_ATTRIBUTE_MAP};
 use syntax::ast::{self, Attribute, AttrKind, Ident, MacArgs, MetaItem, MetaItemKind};
 use syntax::attr::mk_name_value_item_str;
-use syntax::early_buffered_lints::BufferedEarlyLintId;
+use syntax::early_buffered_lints::ILL_FORMED_ATTRIBUTE_INPUT;
 use syntax::sess::ParseSess;
 use syntax_pos::{Symbol, sym};
 
@@ -93,7 +93,7 @@ pub fn check_builtin_attribute(
             }
             if should_warn(name) {
                 sess.buffer_lint(
-                    BufferedEarlyLintId::IllFormedAttributeInput,
+                    &ILL_FORMED_ATTRIBUTE_INPUT,
                     meta.span,
                     ast::CRATE_NODE_ID,
                     &msg,
diff --git a/src/librustc_session/lib.rs b/src/librustc_session/lib.rs
index 4e873e8bb28..df5715f76b4 100644
--- a/src/librustc_session/lib.rs
+++ b/src/librustc_session/lib.rs
@@ -1,3 +1,4 @@
 pub mod cgu_reuse_tracker;
 pub mod utils;
+#[macro_use]
 pub mod lint;
diff --git a/src/librustc_session/lint.rs b/src/librustc_session/lint.rs
index 1078b46589d..0f1c91183bb 100644
--- a/src/librustc_session/lint.rs
+++ b/src/librustc_session/lint.rs
@@ -1,5 +1,6 @@
 use syntax_pos::{Symbol, sym};
 use syntax_pos::edition::Edition;
+use rustc_data_structures::stable_hasher::{HashStable, ToStableHashKey, StableHasher};
 pub use self::Level::*;
 
 /// Setting for how to handle a lint.
@@ -114,3 +115,124 @@ impl Lint {
             .unwrap_or(self.default_level)
     }
 }
+
+/// Identifies a lint known to the compiler.
+#[derive(Clone, Copy, Debug)]
+pub struct LintId {
+    // Identity is based on pointer equality of this field.
+    pub lint: &'static Lint,
+}
+
+impl PartialEq for LintId {
+    fn eq(&self, other: &LintId) -> bool {
+        std::ptr::eq(self.lint, other.lint)
+    }
+}
+
+impl Eq for LintId { }
+
+impl std::hash::Hash for LintId {
+    fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
+        let ptr = self.lint as *const Lint;
+        ptr.hash(state);
+    }
+}
+
+impl LintId {
+    /// Gets the `LintId` for a `Lint`.
+    pub fn of(lint: &'static Lint) -> LintId {
+        LintId {
+            lint,
+        }
+    }
+
+    pub fn lint_name_raw(&self) -> &'static str {
+        self.lint.name
+    }
+
+    /// Gets the name of the lint.
+    pub fn to_string(&self) -> String {
+        self.lint.name_lower()
+    }
+}
+
+impl<HCX> HashStable<HCX> for LintId {
+    #[inline]
+    fn hash_stable(&self, hcx: &mut HCX, hasher: &mut StableHasher) {
+        self.lint_name_raw().hash_stable(hcx, hasher);
+    }
+}
+
+impl<HCX> ToStableHashKey<HCX> for LintId {
+    type KeyType = &'static str;
+
+    #[inline]
+    fn to_stable_hash_key(&self, _: &HCX) -> &'static str {
+        self.lint_name_raw()
+    }
+}
+
+/// Declares a static item of type `&'static Lint`.
+#[macro_export]
+macro_rules! declare_lint {
+    ($vis: vis $NAME: ident, $Level: ident, $desc: expr) => (
+        $crate::declare_lint!(
+            $vis $NAME, $Level, $desc,
+        );
+    );
+    ($vis: vis $NAME: ident, $Level: ident, $desc: expr,
+     $(@future_incompatible = $fi:expr;)? $($v:ident),*) => (
+        $vis static $NAME: &$crate::lint::Lint = &$crate::lint::Lint {
+            name: stringify!($NAME),
+            default_level: $crate::lint::$Level,
+            desc: $desc,
+            edition_lint_opts: None,
+            is_plugin: false,
+            $($v: true,)*
+            $(future_incompatible: Some($fi),)*
+            ..$crate::lint::Lint::default_fields_for_macro()
+        };
+    );
+    ($vis: vis $NAME: ident, $Level: ident, $desc: expr,
+     $lint_edition: expr => $edition_level: ident
+    ) => (
+        $vis static $NAME: &$crate::lint::Lint = &$crate::lint::Lint {
+            name: stringify!($NAME),
+            default_level: $crate::lint::$Level,
+            desc: $desc,
+            edition_lint_opts: Some(($lint_edition, $crate::lint::Level::$edition_level)),
+            report_in_external_macro: false,
+            is_plugin: false,
+        };
+    );
+}
+
+#[macro_export]
+macro_rules! declare_tool_lint {
+    (
+        $(#[$attr:meta])* $vis:vis $tool:ident ::$NAME:ident, $Level: ident, $desc: expr
+    ) => (
+        $crate::declare_tool_lint!{$(#[$attr])* $vis $tool::$NAME, $Level, $desc, false}
+    );
+    (
+        $(#[$attr:meta])* $vis:vis $tool:ident ::$NAME:ident, $Level:ident, $desc:expr,
+        report_in_external_macro: $rep:expr
+    ) => (
+         $crate::declare_tool_lint!{$(#[$attr])* $vis $tool::$NAME, $Level, $desc, $rep}
+    );
+    (
+        $(#[$attr:meta])* $vis:vis $tool:ident ::$NAME:ident, $Level:ident, $desc:expr,
+        $external:expr
+    ) => (
+        $(#[$attr])*
+        $vis static $NAME: &$crate::lint::Lint = &$crate::lint::Lint {
+            name: &concat!(stringify!($tool), "::", stringify!($NAME)),
+            default_level: $crate::lint::$Level,
+            desc: $desc,
+            edition_lint_opts: None,
+            report_in_external_macro: $external,
+            future_incompatible: None,
+            is_plugin: true,
+        };
+    );
+}
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,
diff --git a/src/libsyntax_expand/mbe/macro_check.rs b/src/libsyntax_expand/mbe/macro_check.rs
index 837e04afd34..dfc8d699dbe 100644
--- a/src/libsyntax_expand/mbe/macro_check.rs
+++ b/src/libsyntax_expand/mbe/macro_check.rs
@@ -107,7 +107,7 @@
 use crate::mbe::{KleeneToken, TokenTree};
 
 use syntax::ast::NodeId;
-use syntax::early_buffered_lints::BufferedEarlyLintId;
+use syntax::early_buffered_lints::META_VARIABLE_MISUSE;
 use syntax::token::{DelimToken, Token, TokenKind};
 use syntax::sess::ParseSess;
 use syntax::symbol::{kw, sym};
@@ -623,5 +623,5 @@ fn ops_is_prefix(
 }
 
 fn buffer_lint(sess: &ParseSess, span: MultiSpan, node_id: NodeId, message: &str) {
-    sess.buffer_lint(BufferedEarlyLintId::MetaVariableMisuse, span, node_id, message);
+    sess.buffer_lint(&META_VARIABLE_MISUSE, span, node_id, message);
 }
diff --git a/src/libsyntax_ext/source_util.rs b/src/libsyntax_ext/source_util.rs
index 3d27af2f210..4aab68d7c0e 100644
--- a/src/libsyntax_ext/source_util.rs
+++ b/src/libsyntax_ext/source_util.rs
@@ -5,7 +5,7 @@ use syntax::ptr::P;
 use syntax::symbol::Symbol;
 use syntax::token;
 use syntax::tokenstream::TokenStream;
-use syntax::early_buffered_lints::BufferedEarlyLintId;
+use syntax::early_buffered_lints::INCOMPLETE_INCLUDE;
 use syntax_expand::panictry;
 use syntax_expand::base::{self, *};
 
@@ -101,7 +101,7 @@ pub fn expand_include<'cx>(cx: &'cx mut ExtCtxt<'_>, sp: Span, tts: TokenStream)
             let r = panictry!(self.p.parse_expr());
             if self.p.token != token::Eof {
                 self.p.sess.buffer_lint(
-                    BufferedEarlyLintId::IncompleteInclude,
+                    &INCOMPLETE_INCLUDE,
                     self.p.token.span,
                     ast::CRATE_NODE_ID,
                     "include macro expected single expression in source",