@@ -326,7 +326,7 @@ macro_rules! late_lint_pass_impl {
326
326
327
327
crate :: late_lint_methods!( late_lint_pass_impl, [ ] , [ ' tcx] ) ;
328
328
329
- pub fn late_lint_mod < ' tcx , T : LateLintPass < ' tcx > + ' tcx > (
329
+ pub ( super ) fn late_lint_mod < ' tcx , T : LateLintPass < ' tcx > + ' tcx > (
330
330
tcx : TyCtxt < ' tcx > ,
331
331
module_def_id : LocalDefId ,
332
332
builtin_lints : T ,
@@ -361,26 +361,29 @@ pub fn late_lint_mod<'tcx, T: LateLintPass<'tcx> + 'tcx>(
361
361
}
362
362
}
363
363
364
- fn late_lint_pass_crate < ' tcx , T : LateLintPass < ' tcx > > ( tcx : TyCtxt < ' tcx > , pass : T ) {
365
- let effective_visibilities = & tcx. effective_visibilities ( ( ) ) ;
366
-
364
+ fn late_lint_crate < ' tcx , T : LateLintPass < ' tcx > + ' tcx > ( tcx : TyCtxt < ' tcx > , builtin_lints : T ) {
367
365
let context = LateContext {
368
366
tcx,
369
367
enclosing_body : None ,
370
368
cached_typeck_results : Cell :: new ( None ) ,
371
369
param_env : ty:: ParamEnv :: empty ( ) ,
372
- effective_visibilities,
370
+ effective_visibilities : & tcx . effective_visibilities ( ( ) ) ,
373
371
lint_store : unerased_lint_store ( tcx) ,
374
372
last_node_with_lint_attrs : hir:: CRATE_HIR_ID ,
375
373
generics : None ,
376
374
only_module : false ,
377
375
} ;
378
376
377
+ let mut passes =
378
+ unerased_lint_store ( tcx) . late_passes . iter ( ) . map ( |p| ( p) ( tcx) ) . collect :: < Vec < _ > > ( ) ;
379
+ passes. push ( Box :: new ( builtin_lints) ) ;
380
+ let pass = LateLintPassObjects { lints : & mut passes[ ..] } ;
381
+
379
382
let mut cx = LateContextAndPass { context, pass } ;
380
383
381
384
// Visit the whole crate.
382
385
cx. with_lint_attrs ( hir:: CRATE_HIR_ID , |cx| {
383
- // since the root module isn't visited as an item (because it isn't an
386
+ // Since the root module isn't visited as an item (because it isn't an
384
387
// item), warn for it here.
385
388
lint_callback ! ( cx, check_crate, ) ;
386
389
tcx. hir ( ) . walk_toplevel_module ( cx) ;
@@ -389,14 +392,6 @@ fn late_lint_pass_crate<'tcx, T: LateLintPass<'tcx>>(tcx: TyCtxt<'tcx>, pass: T)
389
392
} )
390
393
}
391
394
392
- fn late_lint_crate < ' tcx , T : LateLintPass < ' tcx > + ' tcx > ( tcx : TyCtxt < ' tcx > , builtin_lints : T ) {
393
- let mut passes =
394
- unerased_lint_store ( tcx) . late_passes . iter ( ) . map ( |p| ( p) ( tcx) ) . collect :: < Vec < _ > > ( ) ;
395
- passes. push ( Box :: new ( builtin_lints) ) ;
396
-
397
- late_lint_pass_crate ( tcx, LateLintPassObjects { lints : & mut passes[ ..] } ) ;
398
- }
399
-
400
395
/// Performs lint checking on a crate.
401
396
pub fn check_crate < ' tcx , T : LateLintPass < ' tcx > + ' tcx > (
402
397
tcx : TyCtxt < ' tcx > ,
0 commit comments