diff --git a/src/librustc/hir/map/mod.rs b/src/librustc/hir/map/mod.rs index c9c40d0e5dbc..48ef4acca47a 100644 --- a/src/librustc/hir/map/mod.rs +++ b/src/librustc/hir/map/mod.rs @@ -220,7 +220,7 @@ impl<'hir> Map<'hir> { } pub fn def_path_from_hir_id(&self, id: HirId) -> Option { - self.opt_local_def_id_from_hir_id(id).map(|def_id| { + self.opt_local_def_id(id).map(|def_id| { self.def_path(def_id) }) } @@ -232,7 +232,7 @@ impl<'hir> Map<'hir> { #[inline] pub fn local_def_id_from_node_id(&self, node: NodeId) -> DefId { - self.opt_local_def_id(node).unwrap_or_else(|| { + self.opt_local_def_id_from_node_id(node).unwrap_or_else(|| { let hir_id = self.node_to_hir_id(node); bug!("local_def_id_from_node_id: no entry for `{}`, which has a map of `{:?}`", node, self.find_entry(hir_id)) @@ -248,13 +248,13 @@ impl<'hir> Map<'hir> { } #[inline] - pub fn opt_local_def_id_from_hir_id(&self, hir_id: HirId) -> Option { + pub fn opt_local_def_id(&self, hir_id: HirId) -> Option { let node_id = self.hir_to_node_id(hir_id); self.definitions.opt_local_def_id(node_id) } #[inline] - pub fn opt_local_def_id(&self, node: NodeId) -> Option { + pub fn opt_local_def_id_from_node_id(&self, node: NodeId) -> Option { self.definitions.opt_local_def_id(node) } diff --git a/src/librustc_save_analysis/dump_visitor.rs b/src/librustc_save_analysis/dump_visitor.rs index 5289013c9ea7..dfdf560d4190 100644 --- a/src/librustc_save_analysis/dump_visitor.rs +++ b/src/librustc_save_analysis/dump_visitor.rs @@ -1217,7 +1217,7 @@ impl<'l, 'tcx, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> { let access = access_from!(self.save_ctxt, root_item, hir_id); // The parent `DefId` of a given use tree is always the enclosing item. - let parent = self.save_ctxt.tcx.hir().opt_local_def_id(id) + let parent = self.save_ctxt.tcx.hir().opt_local_def_id_from_node_id(id) .and_then(|id| self.save_ctxt.tcx.parent(id)) .map(id_from_def_id); @@ -1367,7 +1367,7 @@ impl<'l, 'tcx, 'll, O: DumpOutput + 'll> Visitor<'l> for DumpVisitor<'l, 'tcx, ' let name_span = item.ident.span; if !self.span.filter_generated(name_span) { let span = self.span_from_span(name_span); - let parent = self.save_ctxt.tcx.hir().opt_local_def_id(item.id) + let parent = self.save_ctxt.tcx.hir().opt_local_def_id_from_node_id(item.id) .and_then(|id| self.save_ctxt.tcx.parent(id)) .map(id_from_def_id); self.dumper.import( diff --git a/src/librustc_save_analysis/lib.rs b/src/librustc_save_analysis/lib.rs index 481e501d24a6..8982405ea5d7 100644 --- a/src/librustc_save_analysis/lib.rs +++ b/src/librustc_save_analysis/lib.rs @@ -1193,7 +1193,7 @@ fn id_from_def_id(id: DefId) -> rls_data::Id { } fn id_from_node_id(id: NodeId, scx: &SaveContext<'_, '_>) -> rls_data::Id { - let def_id = scx.tcx.hir().opt_local_def_id(id); + let def_id = scx.tcx.hir().opt_local_def_id_from_node_id(id); def_id.map(|id| id_from_def_id(id)).unwrap_or_else(|| { // Create a *fake* `DefId` out of a `NodeId` by subtracting the `NodeId` // out of the maximum u32 value. This will work unless you have *billions* diff --git a/src/librustdoc/visit_ast.rs b/src/librustdoc/visit_ast.rs index 3561233bff1d..fa5faaf3ff56 100644 --- a/src/librustdoc/visit_ast.rs +++ b/src/librustdoc/visit_ast.rs @@ -66,12 +66,12 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> { } fn stability(&self, id: hir::HirId) -> Option { - self.cx.tcx.hir().opt_local_def_id_from_hir_id(id) + self.cx.tcx.hir().opt_local_def_id(id) .and_then(|def_id| self.cx.tcx.lookup_stability(def_id)).cloned() } fn deprecation(&self, id: hir::HirId) -> Option { - self.cx.tcx.hir().opt_local_def_id_from_hir_id(id) + self.cx.tcx.hir().opt_local_def_id(id) .and_then(|def_id| self.cx.tcx.lookup_deprecation(def_id)) }