]> git.lizzy.rs Git - rust.git/blobdiff - compiler/rustc_lint/src/context.rs
add: `#[rustc_lint_diagnostics]` for more `context.rs` functions.
[rust.git] / compiler / rustc_lint / src / context.rs
index 3c9ad410663f97f37346ea59c176fccbb36fb7f0..de9e71d26e17f63a920fa2bad6f6e14b814f5833 100644 (file)
@@ -13,6 +13,8 @@
 //! previous lint state is pushed onto a stack and the ast is then recursed
 //! upon. As the ast is traversed, this keeps track of the current lint level
 //! for all lint attributes.
+#![deny(rustc::untranslatable_diagnostic)]
+#![deny(rustc::diagnostic_outside_of_impl)]
 
 use self::TargetLint::*;
 
@@ -355,14 +357,12 @@ pub fn check_lint_name_cmdline(
                     sub: RequestedLevel { level, lint_name },
                 });
             }
-            CheckLintNameResult::Tool(result) => {
-                if let Err((Some(_), new_name)) = result {
-                    sess.emit_warning(CheckNameDeprecated {
-                        lint_name: lint_name.clone(),
-                        new_name,
-                        sub: RequestedLevel { level, lint_name },
-                    });
-                }
+            CheckLintNameResult::Tool(Err((Some(_), new_name))) => {
+                sess.emit_warning(CheckNameDeprecated {
+                    lint_name: lint_name.clone(),
+                    new_name,
+                    sub: RequestedLevel { level, lint_name },
+                });
             }
             CheckLintNameResult::NoTool => {
                 sess.emit_err(CheckNameUnknownTool {
@@ -967,6 +967,7 @@ fn lint(
     /// Note that this function should only be called for [`LintExpectationId`]s
     /// retrieved from the current lint pass. Buffered or manually created ids can
     /// cause ICEs.
+    #[rustc_lint_diagnostics]
     fn fulfill_expectation(&self, expectation: LintExpectationId) {
         // We need to make sure that submitted expectation ids are correctly fulfilled suppressed
         // and stored between compilation sessions. To not manually do these steps, we simply create
@@ -1013,6 +1014,7 @@ fn lints(&self) -> &LintStore {
         &*self.lint_store
     }
 
+    #[rustc_lint_diagnostics]
     fn lookup<S: Into<MultiSpan>>(
         &self,
         lint: &'static Lint,
@@ -1047,6 +1049,7 @@ fn lints(&self) -> &LintStore {
         self.builder.lint_store()
     }
 
+    #[rustc_lint_diagnostics]
     fn lookup<S: Into<MultiSpan>>(
         &self,
         lint: &'static Lint,