Skip to content

Commit 3ed7585

Browse files
committed
make hir::def_kind work with HirId
1 parent 98cc18a commit 3ed7585

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/librustc/hir/map/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -291,8 +291,8 @@ impl<'hir> Map<'hir> {
291291
self.definitions.def_index_to_hir_id(def_id.to_def_id().index)
292292
}
293293

294-
fn def_kind(&self, node_id: NodeId) -> Option<DefKind> {
295-
let node = if let Some(node) = self.find(node_id) {
294+
fn def_kind(&self, hir_id: HirId) -> Option<DefKind> {
295+
let node = if let Some(node) = self.find_by_hir_id(hir_id) {
296296
node
297297
} else {
298298
return None
@@ -347,7 +347,7 @@ impl<'hir> Map<'hir> {
347347
if variant_data.ctor_hir_id().is_none() {
348348
return None;
349349
}
350-
let ctor_of = match self.find(self.get_parent_node(node_id)) {
350+
let ctor_of = match self.find_by_hir_id(self.get_parent_node_by_hir_id(hir_id)) {
351351
Some(Node::Item(..)) => def::CtorOf::Struct,
352352
Some(Node::Variant(..)) => def::CtorOf::Variant,
353353
_ => unreachable!(),
@@ -1400,8 +1400,8 @@ fn hir_id_to_string(map: &Map<'_>, id: HirId, include_id: bool) -> String {
14001400

14011401
pub fn provide(providers: &mut Providers<'_>) {
14021402
providers.def_kind = |tcx, def_id| {
1403-
if let Some(node_id) = tcx.hir().as_local_node_id(def_id) {
1404-
tcx.hir().def_kind(node_id)
1403+
if let Some(hir_id) = tcx.hir().as_local_hir_id(def_id) {
1404+
tcx.hir().def_kind(hir_id)
14051405
} else {
14061406
bug!("calling local def_kind query provider for upstream DefId: {:?}",
14071407
def_id

0 commit comments

Comments
 (0)