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
This commit is contained in:
Mazdak Farrokhzad 2019-09-25 16:26:14 +02:00 committed by GitHub
commit c26f1296d2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 22 additions and 21 deletions

View file

@ -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));
});
});
});