From ff14cac621ce63d848abf615e45acd86fec32f50 Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Sun, 31 Jan 2021 17:58:57 +0100 Subject: Index Modules using their LocalDefId. --- compiler/rustc_interface/src/passes.rs | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'compiler/rustc_interface/src') diff --git a/compiler/rustc_interface/src/passes.rs b/compiler/rustc_interface/src/passes.rs index 56aa3939b22..544da4cd9aa 100644 --- a/compiler/rustc_interface/src/passes.rs +++ b/compiler/rustc_interface/src/passes.rs @@ -831,12 +831,11 @@ fn analysis(tcx: TyCtxt<'_>, cnum: CrateNum) -> Result<()> { }, { par_iter(&tcx.hir().krate().modules).for_each(|(&module, _)| { - let local_def_id = tcx.hir().local_def_id(module); - tcx.ensure().check_mod_loops(local_def_id); - tcx.ensure().check_mod_attrs(local_def_id); - tcx.ensure().check_mod_naked_functions(local_def_id); - tcx.ensure().check_mod_unstable_api_usage(local_def_id); - tcx.ensure().check_mod_const_bodies(local_def_id); + tcx.ensure().check_mod_loops(module); + tcx.ensure().check_mod_attrs(module); + tcx.ensure().check_mod_naked_functions(module); + tcx.ensure().check_mod_unstable_api_usage(module); + tcx.ensure().check_mod_const_bodies(module); }); } ); @@ -861,10 +860,8 @@ fn analysis(tcx: TyCtxt<'_>, cnum: CrateNum) -> Result<()> { // "not all control paths return a value" is reported here. // // maybe move the check to a MIR pass? - let local_def_id = tcx.hir().local_def_id(module); - - tcx.ensure().check_mod_liveness(local_def_id); - tcx.ensure().check_mod_intrinsics(local_def_id); + tcx.ensure().check_mod_liveness(module); + tcx.ensure().check_mod_intrinsics(module); }); }); } @@ -926,7 +923,7 @@ fn analysis(tcx: TyCtxt<'_>, cnum: CrateNum) -> Result<()> { { sess.time("privacy_checking_modules", || { par_iter(&tcx.hir().krate().modules).for_each(|(&module, _)| { - tcx.ensure().check_mod_privacy(tcx.hir().local_def_id(module)); + tcx.ensure().check_mod_privacy(module); }); }); } -- cgit 1.4.1-3-g733a5