about summary refs log tree commit diff
path: root/src/librustc
diff options
context:
space:
mode:
authorMark Rousskov <mark.simulacrum@gmail.com>2019-10-25 09:15:33 -0400
committerMark Rousskov <mark.simulacrum@gmail.com>2019-11-03 21:52:42 -0500
commitbb0c930f826bf1929fed70109ecfaaf7e6fbda0d (patch)
tree51513d562fd415422a47e21875b152794151e2a8 /src/librustc
parent1bd6b489143879ab5775d7a92627687c4b9b1857 (diff)
Migrate resolver over to internal lint buffer
Diffstat (limited to 'src/librustc')
-rw-r--r--src/librustc/lint/mod.rs21
-rw-r--r--src/librustc/middle/stability.rs4
2 files changed, 23 insertions, 2 deletions
diff --git a/src/librustc/lint/mod.rs b/src/librustc/lint/mod.rs
index 49a90aee245..42f33740b23 100644
--- a/src/librustc/lint/mod.rs
+++ b/src/librustc/lint/mod.rs
@@ -646,6 +646,27 @@ impl LintBuffer {
     fn take(&mut self, id: ast::NodeId) -> Vec<BufferedEarlyLint> {
         self.map.remove(&id).unwrap_or_default()
     }
+
+    pub fn buffer_lint<S: Into<MultiSpan>>(
+        &mut self,
+        lint: &'static Lint,
+        id: ast::NodeId,
+        sp: S,
+        msg: &str,
+    ) {
+        self.add_lint(lint, id, sp.into(), msg, BuiltinLintDiagnostics::Normal)
+    }
+
+    pub fn buffer_lint_with_diagnostic<S: Into<MultiSpan>>(
+        &mut self,
+        lint: &'static Lint,
+        id: ast::NodeId,
+        sp: S,
+        msg: &str,
+        diagnostic: BuiltinLintDiagnostics,
+    ) {
+        self.add_lint(lint, id, sp.into(), msg, diagnostic)
+    }
 }
 
 pub fn struct_lint_level<'a>(sess: &'a Session,
diff --git a/src/librustc/middle/stability.rs b/src/librustc/middle/stability.rs
index e65f17c7949..93d0627ac6e 100644
--- a/src/librustc/middle/stability.rs
+++ b/src/librustc/middle/stability.rs
@@ -586,7 +586,7 @@ pub fn rustc_deprecation_message(depr: &RustcDeprecation, path: &str) -> (String
 }
 
 pub fn early_report_deprecation(
-    sess: &Session,
+    lint_buffer: &'a mut lint::LintBuffer,
     message: &str,
     suggestion: Option<Symbol>,
     lint: &'static Lint,
@@ -597,7 +597,7 @@ pub fn early_report_deprecation(
     }
 
     let diag = BuiltinLintDiagnostics::DeprecatedMacro(suggestion, span);
-    sess.buffer_lint_with_diagnostic(lint, CRATE_NODE_ID, span, message, diag);
+    lint_buffer.buffer_lint_with_diagnostic(lint, CRATE_NODE_ID, span, message, diag);
 }
 
 fn late_report_deprecation(