Skip to content

Commit

Permalink
rename hir::map::opt_local_def_id*
Browse files Browse the repository at this point in the history
  • Loading branch information
ljedrz committed Jul 4, 2019
1 parent 37d7e1f commit c6131b2
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions src/librustc/hir/map/mod.rs
Expand Up @@ -220,7 +220,7 @@ impl<'hir> Map<'hir> {
}

pub fn def_path_from_hir_id(&self, id: HirId) -> Option<DefPath> {
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)
})
}
Expand All @@ -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))
Expand All @@ -248,13 +248,13 @@ impl<'hir> Map<'hir> {
}

#[inline]
pub fn opt_local_def_id_from_hir_id(&self, hir_id: HirId) -> Option<DefId> {
pub fn opt_local_def_id(&self, hir_id: HirId) -> Option<DefId> {
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<DefId> {
pub fn opt_local_def_id_from_node_id(&self, node: NodeId) -> Option<DefId> {
self.definitions.opt_local_def_id(node)
}

Expand Down
4 changes: 2 additions & 2 deletions src/librustc_save_analysis/dump_visitor.rs
Expand Up @@ -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);

Expand Down Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_save_analysis/lib.rs
Expand Up @@ -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*
Expand Down
4 changes: 2 additions & 2 deletions src/librustdoc/visit_ast.rs
Expand Up @@ -66,12 +66,12 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
}

fn stability(&self, id: hir::HirId) -> Option<attr::Stability> {
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<attr::Deprecation> {
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))
}

Expand Down

0 comments on commit c6131b2

Please sign in to comment.