about summary refs log tree commit diff
path: root/compiler/rustc_lint/src/passes.rs
diff options
context:
space:
mode:
authorblyxyas <blyxyas@gmail.com>2023-11-13 14:35:37 +0100
committerblyxyas <blyxyas@gmail.com>2024-10-19 16:19:44 +0200
commitb4da0585959ec8b2c111bc9f8fd0e34e78c7f260 (patch)
treeca92dd0b22c057b4c1632a91e8967126124b2c74 /compiler/rustc_lint/src/passes.rs
parentc926476d013fbb2ca43bd5259d0a7228009a9cb2 (diff)
downloadrust-b4da0585959ec8b2c111bc9f8fd0e34e78c7f260.tar.gz
rust-b4da0585959ec8b2c111bc9f8fd0e34e78c7f260.zip
Do not run lints that cannot emit
Before this change, adding a lint was a difficult matter
because it always had some overhead involved. This was
because all lints would run, no matter their default level,
or if the user had #![allow]ed them. This PR changes that
Diffstat (limited to 'compiler/rustc_lint/src/passes.rs')
-rw-r--r--compiler/rustc_lint/src/passes.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/compiler/rustc_lint/src/passes.rs b/compiler/rustc_lint/src/passes.rs
index a1d436e0d3d..3750f90a044 100644
--- a/compiler/rustc_lint/src/passes.rs
+++ b/compiler/rustc_lint/src/passes.rs
@@ -110,7 +110,7 @@ macro_rules! declare_combined_late_lint_pass {
 
             $v fn get_lints() -> $crate::LintVec {
                 let mut lints = Vec::new();
-                $(lints.extend_from_slice(&$pass::get_lints());)*
+                $(lints.extend_from_slice(&$pass::default().get_lints());)*
                 lints
             }
         }
@@ -124,6 +124,9 @@ macro_rules! declare_combined_late_lint_pass {
             fn name(&self) -> &'static str {
                 panic!()
             }
+            fn get_lints(&self) -> LintVec {
+                panic!()
+            }
         }
     )
 }
@@ -222,7 +225,7 @@ macro_rules! declare_combined_early_lint_pass {
 
             $v fn get_lints() -> $crate::LintVec {
                 let mut lints = Vec::new();
-                $(lints.extend_from_slice(&$pass::get_lints());)*
+                $(lints.extend_from_slice(&$pass::default().get_lints());)*
                 lints
             }
         }
@@ -236,6 +239,9 @@ macro_rules! declare_combined_early_lint_pass {
             fn name(&self) -> &'static str {
                 panic!()
             }
+            fn get_lints(&self) -> LintVec {
+                panic!()
+            }
         }
     )
 }