| author | bors <bors@rust-lang.org> 2026-06-22 02:28:23 UTC |
| committer | bors <bors@rust-lang.org> 2026-06-22 02:28:23 UTC |
| log | 942ac9ce4116d4ea784c9882659372b34978b1f8 |
| tree | 7545156540f11d0f4fff1c2c36512c50fb015cf4 |
| parent | e238223b17937be1d3682b7f28eb91945f372ae8 |
| parent | 618f5cd5c3e718a50f62ef1ed988b9a44515132e |
Lint cleanups
Details in individual commits.
r? @GuillaumeGomez 7 files changed, 55 insertions(+), 79 deletions(-)
compiler/rustc_lint/src/context.rs+14-32| ... | ... | @@ -40,9 +40,9 @@ use self::TargetLint::*; |
| 40 | 40 | use crate::levels::LintLevelsBuilder; |
| 41 | 41 | use crate::passes::{EarlyLintPassObject, LateLintPassObject}; |
| 42 | 42 | |
| 43 | type EarlyLintPassFactory = dyn Fn() -> EarlyLintPassObject + sync::DynSend + sync::DynSync; | |
| 43 | type EarlyLintPassFactory = Box<dyn Fn() -> EarlyLintPassObject + sync::DynSend + sync::DynSync>; | |
| 44 | 44 | type LateLintPassFactory = |
| 45 | dyn for<'tcx> Fn(TyCtxt<'tcx>) -> LateLintPassObject<'tcx> + sync::DynSend + sync::DynSync; | |
| 45 | Box<dyn for<'tcx> Fn(TyCtxt<'tcx>) -> LateLintPassObject<'tcx> + sync::DynSend + sync::DynSync>; | |
| 46 | 46 | |
| 47 | 47 | /// Information about the registered lints. |
| 48 | 48 | pub struct LintStore { |
| ... | ... | @@ -55,11 +55,11 @@ pub struct LintStore { |
| 55 | 55 | /// interior mutability, we don't enforce this (and lints should, in theory, |
| 56 | 56 | /// be compatible with being constructed more than once, though not |
| 57 | 57 | /// necessarily in a sane manner. This is safe though.) |
| 58 | pub pre_expansion_passes: Vec<Box<EarlyLintPassFactory>>, | |
| 59 | pub early_passes: Vec<Box<EarlyLintPassFactory>>, | |
| 60 | pub late_passes: Vec<Box<LateLintPassFactory>>, | |
| 58 | pub pre_expansion_passes: Vec<EarlyLintPassFactory>, | |
| 59 | pub early_passes: Vec<EarlyLintPassFactory>, | |
| 60 | pub late_passes: Vec<LateLintPassFactory>, | |
| 61 | 61 | /// This is unique in that we construct them per-module, so not once. |
| 62 | pub late_module_passes: Vec<Box<LateLintPassFactory>>, | |
| 62 | pub late_module_passes: Vec<LateLintPassFactory>, | |
| 63 | 63 | |
| 64 | 64 | /// Lints indexed by name. |
| 65 | 65 | by_name: UnordMap<String, TargetLint>, |
| ... | ... | @@ -165,11 +165,8 @@ impl LintStore { |
| 165 | 165 | self.lint_groups.keys().copied() |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | pub fn register_early_pass( | |
| 169 | &mut self, | |
| 170 | pass: impl Fn() -> EarlyLintPassObject + 'static + sync::DynSend + sync::DynSync, | |
| 171 | ) { | |
| 172 | self.early_passes.push(Box::new(pass)); | |
| 168 | pub fn register_early_pass(&mut self, pass: EarlyLintPassFactory) { | |
| 169 | self.early_passes.push(pass); | |
| 173 | 170 | } |
| 174 | 171 | |
| 175 | 172 | /// This lint pass is softly deprecated. It misses expanded code and has caused a few |
| ... | ... | @@ -178,31 +175,16 @@ impl LintStore { |
| 178 | 175 | /// |
| 179 | 176 | /// * See [rust#69838](https://github.com/rust-lang/rust/pull/69838) |
| 180 | 177 | /// * See [rust-clippy#5518](https://github.com/rust-lang/rust-clippy/pull/5518) |
| 181 | pub fn register_pre_expansion_pass( | |
| 182 | &mut self, | |
| 183 | pass: impl Fn() -> EarlyLintPassObject + 'static + sync::DynSend + sync::DynSync, | |
| 184 | ) { | |
| 185 | self.pre_expansion_passes.push(Box::new(pass)); | |
| 178 | pub fn register_pre_expansion_pass(&mut self, pass: EarlyLintPassFactory) { | |
| 179 | self.pre_expansion_passes.push(pass); | |
| 186 | 180 | } |
| 187 | 181 | |
| 188 | pub fn register_late_pass( | |
| 189 | &mut self, | |
| 190 | pass: impl for<'tcx> Fn(TyCtxt<'tcx>) -> LateLintPassObject<'tcx> | |
| 191 | + 'static | |
| 192 | + sync::DynSend | |
| 193 | + sync::DynSync, | |
| 194 | ) { | |
| 195 | self.late_passes.push(Box::new(pass)); | |
| 182 | pub fn register_late_pass(&mut self, pass: LateLintPassFactory) { | |
| 183 | self.late_passes.push(pass); | |
| 196 | 184 | } |
| 197 | 185 | |
| 198 | pub fn register_late_mod_pass( | |
| 199 | &mut self, | |
| 200 | pass: impl for<'tcx> Fn(TyCtxt<'tcx>) -> LateLintPassObject<'tcx> | |
| 201 | + 'static | |
| 202 | + sync::DynSend | |
| 203 | + sync::DynSync, | |
| 204 | ) { | |
| 205 | self.late_module_passes.push(Box::new(pass)); | |
| 186 | pub fn register_late_mod_pass(&mut self, pass: LateLintPassFactory) { | |
| 187 | self.late_module_passes.push(pass); | |
| 206 | 188 | } |
| 207 | 189 | |
| 208 | 190 | /// Helper method for register_early/late_pass |
compiler/rustc_lint/src/early.rs+7-7| ... | ... | @@ -195,9 +195,9 @@ impl<'ast, 'ecx, T: EarlyLintPass> ast_visit::Visitor<'ast> for EarlyContextAndP |
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | fn visit_where_predicate(&mut self, p: &'ast ast::WherePredicate) { |
| 198 | lint_callback!(self, enter_where_predicate, p); | |
| 198 | lint_callback!(self, check_where_predicate, p); | |
| 199 | 199 | ast_visit::walk_where_predicate(self, p); |
| 200 | lint_callback!(self, exit_where_predicate, p); | |
| 200 | lint_callback!(self, check_where_predicate_post, p); | |
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | fn visit_poly_trait_ref(&mut self, t: &'ast ast::PolyTraitRef) { |
| ... | ... | @@ -246,12 +246,12 @@ impl<'ast, 'ecx, T: EarlyLintPass> ast_visit::Visitor<'ast> for EarlyContextAndP |
| 246 | 246 | // `check_foo` method in `$methods` within this pass simply calls `check_foo` |
| 247 | 247 | // once per `$pass`. Compare with `declare_combined_early_lint_pass`, which is |
| 248 | 248 | // similar, but combines lint passes at compile time. |
| 249 | struct RuntimeCombinedEarlyLintPass<'a> { | |
| 250 | passes: &'a mut [EarlyLintPassObject], | |
| 249 | struct RuntimeCombinedEarlyLintPass { | |
| 250 | passes: Vec<EarlyLintPassObject>, | |
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | #[allow(rustc::lint_pass_impl_without_macro)] |
| 254 | impl LintPass for RuntimeCombinedEarlyLintPass<'_> { | |
| 254 | impl LintPass for RuntimeCombinedEarlyLintPass { | |
| 255 | 255 | fn name(&self) -> &'static str { |
| 256 | 256 | panic!() |
| 257 | 257 | } |
| ... | ... | @@ -262,7 +262,7 @@ impl LintPass for RuntimeCombinedEarlyLintPass<'_> { |
| 262 | 262 | |
| 263 | 263 | macro_rules! impl_early_lint_pass { |
| 264 | 264 | ([], [$($(#[$attr:meta])* fn $f:ident($($param:ident: $arg:ty),*);)*]) => ( |
| 265 | impl EarlyLintPass for RuntimeCombinedEarlyLintPass<'_> { | |
| 265 | impl EarlyLintPass for RuntimeCombinedEarlyLintPass { | |
| 266 | 266 | $(fn $f(&mut self, context: &EarlyContext<'_>, $($param: $arg),*) { |
| 267 | 267 | for pass in self.passes.iter_mut() { |
| 268 | 268 | pass.$f(context, $($param),*); |
| ... | ... | @@ -338,7 +338,7 @@ pub fn check_ast_node<'a>( |
| 338 | 338 | } else { |
| 339 | 339 | let mut passes: Vec<_> = passes.iter().map(|mk_pass| (mk_pass)()).collect(); |
| 340 | 340 | passes.push(Box::new(builtin_lints)); |
| 341 | let pass = RuntimeCombinedEarlyLintPass { passes: &mut passes[..] }; | |
| 341 | let pass = RuntimeCombinedEarlyLintPass { passes }; | |
| 342 | 342 | check_ast_node_inner(sess, check_node, context, pass); |
| 343 | 343 | } |
| 344 | 344 | } |
compiler/rustc_lint/src/late.rs+18-23| ... | ... | @@ -305,12 +305,12 @@ impl<'tcx, T: LateLintPass<'tcx>> hir_visit::Visitor<'tcx> for LateContextAndPas |
| 305 | 305 | // `check_foo` method in `$methods` within this pass simply calls `check_foo` |
| 306 | 306 | // once per `$pass`. Compare with `declare_combined_late_lint_pass`, which is |
| 307 | 307 | // similar, but combines lint passes at compile time. |
| 308 | struct RuntimeCombinedLateLintPass<'a, 'tcx> { | |
| 309 | passes: &'a mut [LateLintPassObject<'tcx>], | |
| 308 | struct RuntimeCombinedLateLintPass<'tcx> { | |
| 309 | passes: Vec<LateLintPassObject<'tcx>>, | |
| 310 | 310 | } |
| 311 | 311 | |
| 312 | 312 | #[allow(rustc::lint_pass_impl_without_macro)] |
| 313 | impl LintPass for RuntimeCombinedLateLintPass<'_, '_> { | |
| 313 | impl LintPass for RuntimeCombinedLateLintPass<'_> { | |
| 314 | 314 | fn name(&self) -> &'static str { |
| 315 | 315 | panic!() |
| 316 | 316 | } |
| ... | ... | @@ -321,7 +321,7 @@ impl LintPass for RuntimeCombinedLateLintPass<'_, '_> { |
| 321 | 321 | |
| 322 | 322 | macro_rules! impl_late_lint_pass { |
| 323 | 323 | ([], [$($(#[$attr:meta])* fn $f:ident($($param:ident: $arg:ty),*);)*]) => { |
| 324 | impl<'tcx> LateLintPass<'tcx> for RuntimeCombinedLateLintPass<'_, 'tcx> { | |
| 324 | impl<'tcx> LateLintPass<'tcx> for RuntimeCombinedLateLintPass<'tcx> { | |
| 325 | 325 | $(fn $f(&mut self, context: &LateContext<'tcx>, $($param: $arg),*) { |
| 326 | 326 | for pass in self.passes.iter_mut() { |
| 327 | 327 | pass.$f(context, $($param),*); |
| ... | ... | @@ -367,14 +367,14 @@ pub fn late_lint_mod<'tcx, T: LateLintPass<'tcx> + 'tcx>( |
| 367 | 367 | } |
| 368 | 368 | } else { |
| 369 | 369 | let builtin_lints = Box::new(builtin_lints) as Box<dyn LateLintPass<'tcx>>; |
| 370 | let mut binding = store | |
| 370 | let passes = store | |
| 371 | 371 | .late_module_passes |
| 372 | 372 | .iter() |
| 373 | 373 | .map(|mk_pass| (mk_pass)(tcx)) |
| 374 | 374 | .chain(std::iter::once(builtin_lints)) |
| 375 | 375 | .collect::<Vec<_>>(); |
| 376 | 376 | |
| 377 | let pass = RuntimeCombinedLateLintPass { passes: binding.as_mut_slice() }; | |
| 377 | let pass = RuntimeCombinedLateLintPass { passes }; | |
| 378 | 378 | late_lint_mod_inner(tcx, module_def_id, context, pass); |
| 379 | 379 | } |
| 380 | 380 | } |
| ... | ... | @@ -404,10 +404,18 @@ fn late_lint_mod_inner<'tcx, T: LateLintPass<'tcx>>( |
| 404 | 404 | } |
| 405 | 405 | |
| 406 | 406 | fn late_lint_crate<'tcx>(tcx: TyCtxt<'tcx>) { |
| 407 | // Note: `passes` is often empty. | |
| 408 | let passes: Vec<_> = | |
| 409 | unerased_lint_store(tcx.sess).late_passes.iter().map(|mk_pass| (mk_pass)(tcx)).collect(); | |
| 407 | let lints_that_dont_need_to_run = tcx.lints_that_dont_need_to_run(()); | |
| 410 | 408 | |
| 409 | // Note: `passes` is often empty after filtering. | |
| 410 | let mut passes: Vec<_> = | |
| 411 | unerased_lint_store(tcx.sess).late_passes.iter().map(|mk_pass| (mk_pass)(tcx)).collect(); | |
| 412 | passes.retain(|pass| { | |
| 413 | let lints = pass.get_lints(); | |
| 414 | // Lintless passes are always in | |
| 415 | lints.is_empty() || | |
| 416 | // If the pass doesn't have a single needed lint, omit it | |
| 417 | !lints.iter().all(|lint| lints_that_dont_need_to_run.contains(&LintId::of(lint))) | |
| 418 | }); | |
| 411 | 419 | if passes.is_empty() { |
| 412 | 420 | return; |
| 413 | 421 | } |
| ... | ... | @@ -423,20 +431,7 @@ fn late_lint_crate<'tcx>(tcx: TyCtxt<'tcx>) { |
| 423 | 431 | only_module: false, |
| 424 | 432 | }; |
| 425 | 433 | |
| 426 | let lints_that_dont_need_to_run = tcx.lints_that_dont_need_to_run(()); | |
| 427 | ||
| 428 | let mut filtered_passes: Vec<Box<dyn LateLintPass<'tcx>>> = passes | |
| 429 | .into_iter() | |
| 430 | .filter(|pass| { | |
| 431 | let lints = (**pass).get_lints(); | |
| 432 | // Lintless passes are always in | |
| 433 | lints.is_empty() || | |
| 434 | // If the pass doesn't have a single needed lint, omit it | |
| 435 | !lints.iter().all(|lint| lints_that_dont_need_to_run.contains(&LintId::of(lint))) | |
| 436 | }) | |
| 437 | .collect(); | |
| 438 | ||
| 439 | let pass = RuntimeCombinedLateLintPass { passes: &mut filtered_passes[..] }; | |
| 434 | let pass = RuntimeCombinedLateLintPass { passes }; | |
| 440 | 435 | let mut cx = LateContextAndPass { context, pass }; |
| 441 | 436 | |
| 442 | 437 | // Visit the whole crate. |
compiler/rustc_lint/src/lib.rs+2-2| ... | ... | @@ -694,10 +694,10 @@ fn register_builtins(store: &mut LintStore) { |
| 694 | 694 | |
| 695 | 695 | fn register_internals(store: &mut LintStore) { |
| 696 | 696 | store.register_lints(&InternalCombinedEarlyLintPass::lint_vec()); |
| 697 | store.register_early_pass(|| Box::new(InternalCombinedEarlyLintPass::new())); | |
| 697 | store.register_early_pass(Box::new(|| Box::new(InternalCombinedEarlyLintPass::new()))); | |
| 698 | 698 | |
| 699 | 699 | store.register_lints(&InternalCombinedModuleLateLintPass::lint_vec()); |
| 700 | store.register_late_mod_pass(|_| Box::new(InternalCombinedModuleLateLintPass::new())); | |
| 700 | store.register_late_mod_pass(Box::new(|_| Box::new(InternalCombinedModuleLateLintPass::new()))); | |
| 701 | 701 | |
| 702 | 702 | store.register_group( |
| 703 | 703 | false, |
compiler/rustc_lint/src/passes.rs+9-12| ... | ... | @@ -5,6 +5,7 @@ use crate::context::{EarlyContext, LateContext}; |
| 5 | 5 | #[macro_export] |
| 6 | 6 | macro_rules! late_lint_methods { |
| 7 | 7 | ($macro:path, $args:tt) => ( |
| 8 | // `_post` methods are called *after* recursing into the node. | |
| 8 | 9 | $macro!($args, [ |
| 9 | 10 | fn check_body(a: &rustc_hir::Body<'tcx>); |
| 10 | 11 | fn check_body_post(a: &rustc_hir::Body<'tcx>); |
| ... | ... | @@ -13,8 +14,6 @@ macro_rules! late_lint_methods { |
| 13 | 14 | fn check_mod(a: &'tcx rustc_hir::Mod<'tcx>, b: rustc_hir::HirId); |
| 14 | 15 | fn check_foreign_item(a: &'tcx rustc_hir::ForeignItem<'tcx>); |
| 15 | 16 | fn check_item(a: &'tcx rustc_hir::Item<'tcx>); |
| 16 | /// This is called *after* recursing into the item | |
| 17 | /// (in contrast to `check_item`, which is checked before). | |
| 18 | 17 | fn check_item_post(a: &'tcx rustc_hir::Item<'tcx>); |
| 19 | 18 | fn check_local(a: &'tcx rustc_hir::LetStmt<'tcx>); |
| 20 | 19 | fn check_block(a: &'tcx rustc_hir::Block<'tcx>); |
| ... | ... | @@ -59,7 +58,7 @@ macro_rules! late_lint_methods { |
| 59 | 58 | // contains a few lint-specific methods with no equivalent in `Visitor`. |
| 60 | 59 | // |
| 61 | 60 | macro_rules! declare_late_lint_pass { |
| 62 | ([], [$($(#[$attr:meta])* fn $name:ident($($param:ident: $arg:ty),*);)*]) => ( | |
| 61 | ([], [$(fn $name:ident($($param:ident: $arg:ty),*);)*]) => ( | |
| 63 | 62 | pub trait LateLintPass<'tcx>: LintPass { |
| 64 | 63 | $(#[inline(always)] fn $name(&mut self, _: &LateContext<'tcx>, $(_: $arg),*) {})* |
| 65 | 64 | } |
| ... | ... | @@ -79,7 +78,7 @@ macro_rules! expand_combined_late_lint_pass_method { |
| 79 | 78 | |
| 80 | 79 | #[macro_export] |
| 81 | 80 | macro_rules! expand_combined_late_lint_pass_methods { |
| 82 | ($passes:tt, [$($(#[$attr:meta])* fn $name:ident($($param:ident: $arg:ty),*);)*]) => ( | |
| 81 | ($passes:tt, [$(fn $name:ident($($param:ident: $arg:ty),*);)*]) => ( | |
| 83 | 82 | $(fn $name(&mut self, context: &$crate::LateContext<'tcx>, $($param: $arg),*) { |
| 84 | 83 | $crate::expand_combined_late_lint_pass_method!($passes, self, $name, (context, $($param),*)); |
| 85 | 84 | })* |
| ... | ... | @@ -132,14 +131,13 @@ macro_rules! declare_combined_late_lint_pass { |
| 132 | 131 | #[macro_export] |
| 133 | 132 | macro_rules! early_lint_methods { |
| 134 | 133 | ($macro:path, $args:tt) => ( |
| 134 | // `_post` methods are called *after* recursing into the node. | |
| 135 | 135 | $macro!($args, [ |
| 136 | 136 | fn check_param(a: &rustc_ast::Param); |
| 137 | 137 | fn check_ident(a: &rustc_span::Ident); |
| 138 | 138 | fn check_crate(a: &rustc_ast::Crate); |
| 139 | 139 | fn check_crate_post(a: &rustc_ast::Crate); |
| 140 | 140 | fn check_item(a: &rustc_ast::Item); |
| 141 | /// This is called *after* recursing into the item | |
| 142 | /// (in contrast to `check_item`, which is checked before). | |
| 143 | 141 | fn check_item_post(a: &rustc_ast::Item); |
| 144 | 142 | fn check_local(a: &rustc_ast::Local); |
| 145 | 143 | fn check_block(a: &rustc_ast::Block); |
| ... | ... | @@ -168,15 +166,14 @@ macro_rules! early_lint_methods { |
| 168 | 166 | fn check_attributes_post(a: &[rustc_ast::Attribute]); |
| 169 | 167 | fn check_mac_def(a: &rustc_ast::MacroDef); |
| 170 | 168 | fn check_mac(a: &rustc_ast::MacCall); |
| 171 | ||
| 172 | fn enter_where_predicate(a: &rustc_ast::WherePredicate); | |
| 173 | fn exit_where_predicate(a: &rustc_ast::WherePredicate); | |
| 169 | fn check_where_predicate(a: &rustc_ast::WherePredicate); | |
| 170 | fn check_where_predicate_post(a: &rustc_ast::WherePredicate); | |
| 174 | 171 | ]); |
| 175 | 172 | ) |
| 176 | 173 | } |
| 177 | 174 | |
| 178 | 175 | macro_rules! declare_early_lint_pass { |
| 179 | ([], [$($(#[$attr:meta])* fn $name:ident($($param:ident: $arg:ty),*);)*]) => ( | |
| 176 | ([], [$(fn $name:ident($($param:ident: $arg:ty),*);)*]) => ( | |
| 180 | 177 | pub trait EarlyLintPass: LintPass { |
| 181 | 178 | $(#[inline(always)] fn $name(&mut self, _: &EarlyContext<'_>, $(_: $arg),*) {})* |
| 182 | 179 | } |
| ... | ... | @@ -196,7 +193,7 @@ macro_rules! expand_combined_early_lint_pass_method { |
| 196 | 193 | |
| 197 | 194 | #[macro_export] |
| 198 | 195 | macro_rules! expand_combined_early_lint_pass_methods { |
| 199 | ($passes:tt, [$($(#[$attr:meta])* fn $name:ident($($param:ident: $arg:ty),*);)*]) => ( | |
| 196 | ($passes:tt, [$(fn $name:ident($($param:ident: $arg:ty),*);)*]) => ( | |
| 200 | 197 | $(fn $name(&mut self, context: &$crate::EarlyContext<'_>, $($param: $arg),*) { |
| 201 | 198 | $crate::expand_combined_early_lint_pass_method!($passes, self, $name, (context, $($param),*)); |
| 202 | 199 | })* |
| ... | ... | @@ -247,5 +244,5 @@ macro_rules! declare_combined_early_lint_pass { |
| 247 | 244 | } |
| 248 | 245 | |
| 249 | 246 | /// A lint pass boxed up as a trait object. |
| 250 | pub(crate) type EarlyLintPassObject = Box<dyn EarlyLintPass + 'static>; | |
| 247 | pub(crate) type EarlyLintPassObject = Box<dyn EarlyLintPass>; | |
| 251 | 248 | pub(crate) type LateLintPassObject<'tcx> = Box<dyn LateLintPass<'tcx> + 'tcx>; |
compiler/rustc_lint/src/unused.rs+2-2| ... | ... | @@ -975,7 +975,7 @@ impl EarlyLintPass for UnusedParens { |
| 975 | 975 | self.in_no_bounds_pos.clear(); |
| 976 | 976 | } |
| 977 | 977 | |
| 978 | fn enter_where_predicate(&mut self, _: &EarlyContext<'_>, pred: &ast::WherePredicate) { | |
| 978 | fn check_where_predicate(&mut self, _: &EarlyContext<'_>, pred: &ast::WherePredicate) { | |
| 979 | 979 | use rustc_ast::{WhereBoundPredicate, WherePredicateKind}; |
| 980 | 980 | if let WherePredicateKind::BoundPredicate(WhereBoundPredicate { |
| 981 | 981 | bounded_ty, |
| ... | ... | @@ -989,7 +989,7 @@ impl EarlyLintPass for UnusedParens { |
| 989 | 989 | } |
| 990 | 990 | } |
| 991 | 991 | |
| 992 | fn exit_where_predicate(&mut self, _: &EarlyContext<'_>, _: &ast::WherePredicate) { | |
| 992 | fn check_where_predicate_post(&mut self, _: &EarlyContext<'_>, _: &ast::WherePredicate) { | |
| 993 | 993 | assert!(!self.with_self_ty_parens); |
| 994 | 994 | } |
| 995 | 995 | } |
src/tools/clippy/clippy_lints/src/lib.rs+3-1| ... | ... | @@ -454,7 +454,9 @@ pub fn register_lint_passes(store: &mut rustc_lint::LintStore, conf: &'static Co |
| 454 | 454 | // NOTE: Do not add any more pre-expansion passes. These should be removed eventually. |
| 455 | 455 | // Due to the architecture of the compiler, currently `cfg_attr` attributes on crate |
| 456 | 456 | // level (i.e `#![cfg_attr(...)]`) will still be expanded even when using a pre-expansion pass. |
| 457 | store.register_pre_expansion_pass(move || Box::new(attrs::EarlyAttributes::new(conf))); | |
| 457 | store.register_pre_expansion_pass( | |
| 458 | Box::new(move || Box::new(attrs::EarlyAttributes::new(conf))) | |
| 459 | ); | |
| 458 | 460 | |
| 459 | 461 | let format_args_storage = FormatArgsStorage::default(); |
| 460 | 462 | let attr_storage = AttrStorage::default(); |