]> git.lizzy.rs Git - rust.git/commitdiff
remove hir::map::name
authorljedrz <ljedrz@gmail.com>
Wed, 19 Jun 2019 13:35:56 +0000 (15:35 +0200)
committerljedrz <ljedrz@gmail.com>
Thu, 20 Jun 2019 10:47:25 +0000 (12:47 +0200)
src/librustc/hir/map/mod.rs
src/librustc_mir/borrow_check/mod.rs

index 87da3273bd220b93fff33c5af9aacc09330689a6..10632bc4d8a90c1ab1297063b32ad233b5c80ac9 100644 (file)
@@ -940,13 +940,6 @@ pub fn expect_expr_by_hir_id(&self, id: HirId) -> &'hir Expr {
         }
     }
 
-    /// 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,
index ca8c4c58301ab0393be4168d6314a05c57719e3d..72e392fdddc8a80c4641538eb6f9e49f4975b39d 100644 (file)
@@ -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,