@@ -326,25 +326,28 @@ macro_rules! late_lint_pass_impl {
326326
327327crate :: late_lint_methods!( late_lint_pass_impl, [ ] , [ ' tcx] ) ;
328328
329- fn late_lint_mod_pass < ' tcx , T : LateLintPass < ' tcx > > (
329+ pub fn late_lint_mod < ' tcx , T : LateLintPass < ' tcx > + ' tcx > (
330330 tcx : TyCtxt < ' tcx > ,
331331 module_def_id : LocalDefId ,
332- pass : T ,
332+ builtin_lints : T ,
333333) {
334- let effective_visibilities = & tcx. effective_visibilities ( ( ) ) ;
335-
336334 let context = LateContext {
337335 tcx,
338336 enclosing_body : None ,
339337 cached_typeck_results : Cell :: new ( None ) ,
340338 param_env : ty:: ParamEnv :: empty ( ) ,
341- effective_visibilities,
339+ effective_visibilities : & tcx . effective_visibilities ( ( ) ) ,
342340 lint_store : unerased_lint_store ( tcx) ,
343341 last_node_with_lint_attrs : tcx. hir ( ) . local_def_id_to_hir_id ( module_def_id) ,
344342 generics : None ,
345343 only_module : true ,
346344 } ;
347345
346+ let mut passes: Vec < _ > =
347+ unerased_lint_store ( tcx) . late_module_passes . iter ( ) . map ( |pass| ( pass) ( tcx) ) . collect ( ) ;
348+ passes. push ( Box :: new ( builtin_lints) ) ;
349+ let pass = LateLintPassObjects { lints : & mut passes[ ..] } ;
350+
348351 let mut cx = LateContextAndPass { context, pass } ;
349352
350353 let ( module, _span, hir_id) = tcx. hir ( ) . get_module ( module_def_id) ;
@@ -358,18 +361,6 @@ fn late_lint_mod_pass<'tcx, T: LateLintPass<'tcx>>(
358361 }
359362}
360363
361- pub fn late_lint_mod < ' tcx , T : LateLintPass < ' tcx > + ' tcx > (
362- tcx : TyCtxt < ' tcx > ,
363- module_def_id : LocalDefId ,
364- builtin_lints : T ,
365- ) {
366- let mut passes: Vec < _ > =
367- unerased_lint_store ( tcx) . late_module_passes . iter ( ) . map ( |pass| ( pass) ( tcx) ) . collect ( ) ;
368- passes. push ( Box :: new ( builtin_lints) ) ;
369-
370- late_lint_mod_pass ( tcx, module_def_id, LateLintPassObjects { lints : & mut passes[ ..] } ) ;
371- }
372-
373364fn late_lint_pass_crate < ' tcx , T : LateLintPass < ' tcx > > ( tcx : TyCtxt < ' tcx > , pass : T ) {
374365 let effective_visibilities = & tcx. effective_visibilities ( ( ) ) ;
375366
0 commit comments