about summary refs log tree commit diff
path: root/src/librustc_interface/passes.rs
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-09-25 16:26:14 +0200
committerGitHub <noreply@github.com>2019-09-25 16:26:14 +0200
commitc26f1296d2d7a5f0c6e0b4f5cc00d59b341bcf09 (patch)
tree0ad1d924929f83bda0e7db308753b84daced7c0c /src/librustc_interface/passes.rs
parentacf7b50c737cfb8f4003477559305bedf3c316fe (diff)
parent9a6ca413714271adac017cbdd764a7de8b244001 (diff)
downloadrust-c26f1296d2d7a5f0c6e0b4f5cc00d59b341bcf09.tar.gz
rust-c26f1296d2d7a5f0c6e0b4f5cc00d59b341bcf09.zip
Rollup merge of #62975 - ljedrz:kill_off_hir_to_node_id, r=Zoxc
Almost fully deprecate hir::map::Map.hir_to_node_id

- HirIdify `doctree::Module.id`
- HirIdify `hir::Crate.modules`
- introduce a `HirId` to `DefIndex` map in `map::Definitions`

The only last uses of `hir::map::Map.hir_to_node_id` in the compiler are:
- for the purposes of `driver::pretty` (in `map::nodes_matching_suffix`), but I don't know if we can remove `NodeId`s in there (I think when I attempted it previously there was some issue due to `HirId` not being representable with an integer)
- in `ty::query::on_disk_cache` (not sure about the purpose of this one)
- in `mir::transform::check_unsafety` (only important for error message order)

Any suggestions how to kill these off?

r? @Zoxc
Diffstat (limited to 'src/librustc_interface/passes.rs')
-rw-r--r--src/librustc_interface/passes.rs15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/librustc_interface/passes.rs b/src/librustc_interface/passes.rs
index 56db695f254..37b33466d70 100644
--- a/src/librustc_interface/passes.rs
+++ b/src/librustc_interface/passes.rs
@@ -905,10 +905,10 @@ fn analysis(tcx: TyCtxt<'_>, cnum: CrateNum) -> Result<()> {
             });
         }, {
             par_iter(&tcx.hir().krate().modules).for_each(|(&module, _)| {
-                tcx.ensure().check_mod_loops(tcx.hir().local_def_id_from_node_id(module));
-                tcx.ensure().check_mod_attrs(tcx.hir().local_def_id_from_node_id(module));
-                tcx.ensure().check_mod_unstable_api_usage(
-                    tcx.hir().local_def_id_from_node_id(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_unstable_api_usage(local_def_id);
             });
         });
     });
@@ -931,9 +931,10 @@ 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?
-                    tcx.ensure().check_mod_liveness(tcx.hir().local_def_id_from_node_id(module));
+                    let local_def_id = tcx.hir().local_def_id(module);
 
-                    tcx.ensure().check_mod_intrinsics(tcx.hir().local_def_id_from_node_id(module));
+                    tcx.ensure().check_mod_liveness(local_def_id);
+                    tcx.ensure().check_mod_intrinsics(local_def_id);
                 });
             });
         });
@@ -993,7 +994,7 @@ fn analysis(tcx: TyCtxt<'_>, cnum: CrateNum) -> Result<()> {
         }, {
             time(sess, "privacy checking modules", || {
                 par_iter(&tcx.hir().krate().modules).for_each(|(&module, _)| {
-                    tcx.ensure().check_mod_privacy(tcx.hir().local_def_id_from_node_id(module));
+                    tcx.ensure().check_mod_privacy(tcx.hir().local_def_id(module));
                 });
             });
         });