Skip to content

Commit 98251d8

Browse files
committed
Reduce visibility of get_module_parent_node and remove get_module_parent
1 parent 542d813 commit 98251d8

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

src/librustc/hir/map/mod.rs

+1-7
Original file line numberDiff line numberDiff line change
@@ -746,15 +746,9 @@ impl<'hir> Map<'hir> {
746746
hir_id
747747
}
748748

749-
/// Returns the `DefId` of `id`'s nearest module parent, or `id` itself if no
750-
/// module parent is in this map.
751-
pub fn get_module_parent(&self, id: HirId) -> DefId {
752-
self.local_def_id(self.get_module_parent_node(id))
753-
}
754-
755749
/// Returns the `HirId` of `id`'s nearest module parent, or `id` itself if no
756750
/// module parent is in this map.
757-
pub fn get_module_parent_node(&self, hir_id: HirId) -> HirId {
751+
pub(super) fn get_module_parent_node(&self, hir_id: HirId) -> HirId {
758752
for (hir_id, node) in self.parent_iter(hir_id) {
759753
if let Node::Item(&Item { kind: ItemKind::Mod(_), .. }) = node {
760754
return hir_id;

src/librustc/hir/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ impl<'tcx> TyCtxt<'tcx> {
5555
pub fn provide(providers: &mut Providers<'_>) {
5656
providers.parent_module_from_def_id = |tcx, id| {
5757
let hir = tcx.hir();
58-
hir.get_module_parent(hir.as_local_hir_id(id).unwrap())
58+
hir.local_def_id(hir.get_module_parent_node(hir.as_local_hir_id(id).unwrap()))
5959
};
6060
providers.hir_crate = |tcx, _| tcx.hir_map.untracked_krate();
6161
map::provide(providers);

0 commit comments

Comments
 (0)