diff options
| author | John Kåre Alsaker <john.kare.alsaker@gmail.com> | 2020-02-22 19:53:10 +0100 |
|---|---|---|
| committer | John Kåre Alsaker <john.kare.alsaker@gmail.com> | 2020-02-29 05:59:58 +0100 |
| commit | 98251d8fb25eac95df205b79b11217b45d924efd (patch) | |
| tree | cf29b74bdbfa6038975ed34c7933030e5ec1529f /src | |
| parent | 542d813475eeac7cac1bae5de32fe7809b4bf771 (diff) | |
| download | rust-98251d8fb25eac95df205b79b11217b45d924efd.tar.gz rust-98251d8fb25eac95df205b79b11217b45d924efd.zip | |
Reduce visibility of `get_module_parent_node` and remove `get_module_parent`
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc/hir/map/mod.rs | 8 | ||||
| -rw-r--r-- | src/librustc/hir/mod.rs | 2 |
2 files changed, 2 insertions, 8 deletions
diff --git a/src/librustc/hir/map/mod.rs b/src/librustc/hir/map/mod.rs index f7301280acd..d3de20fd970 100644 --- a/src/librustc/hir/map/mod.rs +++ b/src/librustc/hir/map/mod.rs @@ -746,15 +746,9 @@ impl<'hir> Map<'hir> { hir_id } - /// Returns the `DefId` of `id`'s nearest module parent, or `id` itself if no - /// module parent is in this map. - pub fn get_module_parent(&self, id: HirId) -> DefId { - self.local_def_id(self.get_module_parent_node(id)) - } - /// Returns the `HirId` of `id`'s nearest module parent, or `id` itself if no /// module parent is in this map. - pub fn get_module_parent_node(&self, hir_id: HirId) -> HirId { + pub(super) fn get_module_parent_node(&self, hir_id: HirId) -> HirId { for (hir_id, node) in self.parent_iter(hir_id) { if let Node::Item(&Item { kind: ItemKind::Mod(_), .. }) = node { return hir_id; diff --git a/src/librustc/hir/mod.rs b/src/librustc/hir/mod.rs index 4ce335d0c95..1aa3b27bd1a 100644 --- a/src/librustc/hir/mod.rs +++ b/src/librustc/hir/mod.rs @@ -55,7 +55,7 @@ impl<'tcx> TyCtxt<'tcx> { pub fn provide(providers: &mut Providers<'_>) { providers.parent_module_from_def_id = |tcx, id| { let hir = tcx.hir(); - hir.get_module_parent(hir.as_local_hir_id(id).unwrap()) + hir.local_def_id(hir.get_module_parent_node(hir.as_local_hir_id(id).unwrap())) }; providers.hir_crate = |tcx, _| tcx.hir_map.untracked_krate(); map::provide(providers); |
