diff options
| author | blyxyas <blyxyas@gmail.com> | 2023-11-13 14:35:37 +0100 |
|---|---|---|
| committer | blyxyas <blyxyas@gmail.com> | 2024-10-19 16:19:44 +0200 |
| commit | b4da0585959ec8b2c111bc9f8fd0e34e78c7f260 (patch) | |
| tree | ca92dd0b22c057b4c1632a91e8967126124b2c74 /compiler/rustc_lint/src/passes.rs | |
| parent | c926476d013fbb2ca43bd5259d0a7228009a9cb2 (diff) | |
| download | rust-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.rs | 10 |
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!() + } } ) } |
