From 468647cabb231d7a3efbdc7a1819d7dbdf699b36 Mon Sep 17 00:00:00 2001 From: ljedrz Date: Wed, 19 Jun 2019 15:35:56 +0200 Subject: [PATCH] remove hir::map::name --- src/librustc/hir/map/mod.rs | 7 ------- src/librustc_mir/borrow_check/mod.rs | 3 +-- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/src/librustc/hir/map/mod.rs b/src/librustc/hir/map/mod.rs index 87da3273bd22..10632bc4d8a9 100644 --- a/src/librustc/hir/map/mod.rs +++ b/src/librustc/hir/map/mod.rs @@ -940,13 +940,6 @@ impl<'hir> Map<'hir> { } } - /// Returns the name associated with the given `NodeId`'s AST. - pub fn name(&self, id: NodeId) -> Name { - let hir_id = self.node_to_hir_id(id); - self.name_by_hir_id(hir_id) - } - - // FIXME(@ljedrz): replace the `NodeId` variant. pub fn name_by_hir_id(&self, id: HirId) -> Name { match self.get_by_hir_id(id) { Node::Item(i) => i.ident.name, diff --git a/src/librustc_mir/borrow_check/mod.rs b/src/librustc_mir/borrow_check/mod.rs index ca8c4c58301a..72e392fdddc8 100644 --- a/src/librustc_mir/borrow_check/mod.rs +++ b/src/librustc_mir/borrow_check/mod.rs @@ -124,14 +124,13 @@ fn do_mir_borrowck<'a, 'tcx>( .flat_map(|v| v.values()) .map(|upvar_id| { let var_hir_id = upvar_id.var_path.hir_id; - let var_node_id = tcx.hir().hir_to_node_id(var_hir_id); let capture = tables.upvar_capture(*upvar_id); let by_ref = match capture { ty::UpvarCapture::ByValue => false, ty::UpvarCapture::ByRef(..) => true, }; let mut upvar = Upvar { - name: tcx.hir().name(var_node_id), + name: tcx.hir().name_by_hir_id(var_hir_id), var_hir_id, by_ref, mutability: Mutability::Not,