]> git.lizzy.rs Git - rust.git/commitdiff
renamve hir_to_string to node_to_string
authorljedrz <ljedrz@gmail.com>
Sun, 16 Jun 2019 15:30:02 +0000 (17:30 +0200)
committerljedrz <ljedrz@gmail.com>
Mon, 17 Jun 2019 16:59:27 +0000 (18:59 +0200)
12 files changed:
src/librustc/cfg/graphviz.rs
src/librustc/hir/map/hir_id_validator.rs
src/librustc/hir/map/mod.rs
src/librustc/infer/opaque_types/mod.rs
src/librustc/middle/mem_categorization.rs
src/librustc/middle/reachable.rs
src/librustc/middle/resolve_lifetime.rs
src/librustc/ty/context.rs
src/librustc_borrowck/borrowck/mod.rs
src/librustc_typeck/check/mod.rs
src/librustc_typeck/coherence/orphan.rs
src/librustc_typeck/variance/terms.rs

index 0bfb6b98e630b29938ac758b3e91ad5b14712f96..66963e5856eec85b9ba5454c8ee7a6e5ec86b1bf 100644 (file)
@@ -26,7 +26,7 @@ fn local_id_to_string(&self, local_id: hir::ItemLocalId) -> String {
             owner: self.tcx.hir().def_index_to_hir_id(self.cfg.owner_def_id.index).owner,
             local_id
         };
-        let s = self.tcx.hir().hir_to_string(hir_id);
+        let s = self.tcx.hir().node_to_string(hir_id);
 
         // Replacing newlines with \\l causes each line to be left-aligned,
         // improving presentation of (long) pretty-printed expressions.
index 08ec2aeed2905b161cc597dd0ecede2cd706ba8f..d6ac7ea2ed703cd93582a7a8d99ac941e3488ffc 100644 (file)
@@ -125,7 +125,7 @@ fn check<F: FnOnce(&mut HirIdValidator<'a, 'hir>)>(&mut self,
                 let hir_id = self.hir_map.node_to_hir_id(node_id);
                 missing_items.push(format!("[local_id: {}, node:{}]",
                                            local_id,
-                                           self.hir_map.hir_to_string(hir_id)));
+                                           self.hir_map.node_to_string(hir_id)));
             }
             self.error(|| format!(
                 "ItemLocalIds not assigned densely in {}. \
@@ -139,7 +139,7 @@ fn check<F: FnOnce(&mut HirIdValidator<'a, 'hir>)>(&mut self,
                         owner: owner_def_index,
                         local_id,
                     })
-                    .map(|h| format!("({:?} {})", h, self.hir_map.hir_to_string(h)))
+                    .map(|h| format!("({:?} {})", h, self.hir_map.node_to_string(h)))
                     .collect::<Vec<_>>()));
         }
     }
@@ -157,14 +157,14 @@ fn visit_id(&mut self, hir_id: HirId) {
 
         if hir_id == hir::DUMMY_HIR_ID {
             self.error(|| format!("HirIdValidator: HirId {:?} is invalid",
-                                  self.hir_map.hir_to_string(hir_id)));
+                                  self.hir_map.node_to_string(hir_id)));
             return;
         }
 
         if owner != hir_id.owner {
             self.error(|| format!(
                 "HirIdValidator: The recorded owner of {} is {} instead of {}",
-                self.hir_map.hir_to_string(hir_id),
+                self.hir_map.node_to_string(hir_id),
                 self.hir_map.def_path(DefId::local(hir_id.owner)).to_string_no_crate(),
                 self.hir_map.def_path(DefId::local(owner)).to_string_no_crate()));
         }
index 5a45f04b6371977492a4a4b0994e4e89b0044260..26c08154647e29069cc1618f7fc97bf78051df5a 100644 (file)
@@ -453,7 +453,7 @@ pub fn maybe_body_owned_by(&self, hir_id: HirId) -> Option<BodyId> {
     pub fn body_owned_by(&self, id: HirId) -> BodyId {
         self.maybe_body_owned_by(id).unwrap_or_else(|| {
             span_bug!(self.span(id), "body_owned_by: {} has no associated body",
-                      self.hir_to_string(id));
+                      self.node_to_string(id));
         })
     }
 
@@ -486,7 +486,7 @@ pub fn ty_param_owner(&self, id: HirId) -> HirId {
             Node::Item(&Item { node: ItemKind::Trait(..), .. }) |
             Node::Item(&Item { node: ItemKind::TraitAlias(..), .. }) => id,
             Node::GenericParam(_) => self.get_parent_node_by_hir_id(id),
-            _ => bug!("ty_param_owner: {} not a type parameter", self.hir_to_string(id))
+            _ => bug!("ty_param_owner: {} not a type parameter", self.node_to_string(id))
         }
     }
 
@@ -495,7 +495,7 @@ pub fn ty_param_name(&self, id: HirId) -> Name {
             Node::Item(&Item { node: ItemKind::Trait(..), .. }) |
             Node::Item(&Item { node: ItemKind::TraitAlias(..), .. }) => kw::SelfUpper,
             Node::GenericParam(param) => param.name.ident().name,
-            _ => bug!("ty_param_name: {} not a type parameter", self.hir_to_string(id)),
+            _ => bug!("ty_param_name: {} not a type parameter", self.node_to_string(id)),
         }
     }
 
@@ -874,27 +874,27 @@ pub fn get_foreign_abi(&self, hir_id: HirId) -> Abi {
                 return nm.abi;
             }
         }
-        bug!("expected foreign mod or inlined parent, found {}", self.hir_to_string(parent))
+        bug!("expected foreign mod or inlined parent, found {}", self.node_to_string(parent))
     }
 
     pub fn expect_item(&self, id: HirId) -> &'hir Item {
         match self.find_by_hir_id(id) { // read recorded by `find`
             Some(Node::Item(item)) => item,
-            _ => bug!("expected item, found {}", self.hir_to_string(id))
+            _ => bug!("expected item, found {}", self.node_to_string(id))
         }
     }
 
     pub fn expect_impl_item(&self, id: HirId) -> &'hir ImplItem {
         match self.find_by_hir_id(id) {
             Some(Node::ImplItem(item)) => item,
-            _ => bug!("expected impl item, found {}", self.hir_to_string(id))
+            _ => bug!("expected impl item, found {}", self.node_to_string(id))
         }
     }
 
     pub fn expect_trait_item(&self, id: HirId) -> &'hir TraitItem {
         match self.find_by_hir_id(id) {
             Some(Node::TraitItem(item)) => item,
-            _ => bug!("expected trait item, found {}", self.hir_to_string(id))
+            _ => bug!("expected trait item, found {}", self.node_to_string(id))
         }
     }
 
@@ -904,26 +904,26 @@ pub fn expect_variant_data(&self, id: HirId) -> &'hir VariantData {
                 match i.node {
                     ItemKind::Struct(ref struct_def, _) |
                     ItemKind::Union(ref struct_def, _) => struct_def,
-                    _ => bug!("struct ID bound to non-struct {}", self.hir_to_string(id))
+                    _ => bug!("struct ID bound to non-struct {}", self.node_to_string(id))
                 }
             }
             Some(Node::Variant(variant)) => &variant.node.data,
             Some(Node::Ctor(data)) => data,
-            _ => bug!("expected struct or variant, found {}", self.hir_to_string(id))
+            _ => bug!("expected struct or variant, found {}", self.node_to_string(id))
         }
     }
 
     pub fn expect_variant(&self, id: HirId) -> &'hir Variant {
         match self.find_by_hir_id(id) {
             Some(Node::Variant(variant)) => variant,
-            _ => bug!("expected variant, found {}", self.hir_to_string(id)),
+            _ => bug!("expected variant, found {}", self.node_to_string(id)),
         }
     }
 
     pub fn expect_foreign_item(&self, id: HirId) -> &'hir ForeignItem {
         match self.find_by_hir_id(id) {
             Some(Node::ForeignItem(item)) => item,
-            _ => bug!("expected foreign item, found {}", self.hir_to_string(id))
+            _ => bug!("expected foreign item, found {}", self.node_to_string(id))
         }
     }
 
@@ -936,7 +936,7 @@ pub fn expect_expr(&self, id: NodeId) -> &'hir Expr {
     pub fn expect_expr_by_hir_id(&self, id: HirId) -> &'hir Expr {
         match self.find_by_hir_id(id) { // read recorded by find
             Some(Node::Expr(expr)) => expr,
-            _ => bug!("expected expr, found {}", self.hir_to_string(id))
+            _ => bug!("expected expr, found {}", self.node_to_string(id))
         }
     }
 
@@ -959,7 +959,7 @@ pub fn name_by_hir_id(&self, id: HirId) -> Name {
             Node::GenericParam(param) => param.name.ident().name,
             Node::Binding(&Pat { node: PatKind::Binding(_, _, l, _), .. }) => l.name,
             Node::Ctor(..) => self.name_by_hir_id(self.get_parent_item(id)),
-            _ => bug!("no name for {}", self.hir_to_string(id))
+            _ => bug!("no name for {}", self.node_to_string(id))
         }
     }
 
@@ -1071,7 +1071,7 @@ pub fn span_if_local(&self, id: DefId) -> Option<Span> {
         self.as_local_hir_id(id).map(|id| self.span(id))
     }
 
-    pub fn hir_to_string(&self, id: HirId) -> String {
+    pub fn node_to_string(&self, id: HirId) -> String {
         hir_id_to_string(self, id, true)
     }
 
index 1c52b5775a0ccca83222e55ec30759458e7f2f08..328ace51a58282c96b0ef8e87151f3de9c976f9c 100644 (file)
@@ -819,7 +819,7 @@ fn instantiate_opaque_types_in_map<T: TypeFoldable<'tcx>>(&mut self, value: &T)
                             },
                             _ => bug!(
                                 "expected (impl) item, found {}",
-                                tcx.hir().hir_to_string(opaque_hir_id),
+                                tcx.hir().node_to_string(opaque_hir_id),
                             ),
                         };
                         if in_definition_scope {
index a856430e68a234ebde21d4f43e7418bd08c94486..192e72383acee591d12134ee7bb78ce798de1a91 100644 (file)
@@ -501,7 +501,7 @@ fn resolve_type_vars_or_error(&self,
             None if self.is_tainted_by_errors() => Err(()),
             None => {
                 bug!("no type for node {}: {} in mem_categorization",
-                     id, self.tcx.hir().hir_to_string(id));
+                     id, self.tcx.hir().node_to_string(id));
             }
         }
     }
index 2285beb3758599f20e0662deed170811869f1a6c..628a44cbfe01fa7b3c0cadb5a0d2b4c89735aec5 100644 (file)
@@ -318,7 +318,7 @@ fn propagate_node(&mut self, node: &Node<'tcx>,
             _ => {
                 bug!(
                     "found unexpected node kind in worklist: {} ({:?})",
-                    self.tcx.hir().hir_to_string(search_item),
+                    self.tcx.hir().node_to_string(search_item),
                     node,
                 );
             }
index 6f2c4b66f5ec4eec79172b92bf2890a4dbf2e7d4..76bff500634a91fdead737b81c8135536ea16133 100644 (file)
@@ -2696,7 +2696,7 @@ fn insert_lifetime(&mut self, lifetime_ref: &'tcx hir::Lifetime, def: Region) {
 
         debug!(
             "insert_lifetime: {} resolved to {:?} span={:?}",
-            self.tcx.hir().hir_to_string(lifetime_ref.hir_id),
+            self.tcx.hir().node_to_string(lifetime_ref.hir_id),
             def,
             self.tcx.sess.source_map().span_to_string(lifetime_ref.span)
         );
index c32f62e88c423eeaa2b9e677c0abbe702b3a874e..b84ebd8afe8852bfdff20a09ef7ab7bd07dd8e96 100644 (file)
@@ -252,7 +252,7 @@ fn validate_hir_id_for_typeck_tables(local_id_root: Option<DefId>,
                 ty::tls::with(|tcx| {
                     bug!("node {} with HirId::owner {:?} cannot be placed in \
                           TypeckTables with local_id_root {:?}",
-                         tcx.hir().hir_to_string(hir_id),
+                         tcx.hir().node_to_string(hir_id),
                          DefId::local(hir_id.owner),
                          local_id_root)
                 });
@@ -554,7 +554,7 @@ pub fn node_types_mut(&mut self) -> LocalTableInContextMut<'_, Ty<'tcx>> {
     pub fn node_type(&self, id: hir::HirId) -> Ty<'tcx> {
         self.node_type_opt(id).unwrap_or_else(||
             bug!("node_type: no type for node `{}`",
-                 tls::with(|tcx| tcx.hir().hir_to_string(id)))
+                 tls::with(|tcx| tcx.hir().node_to_string(id)))
         )
     }
 
index cc9c83de179c8c3969faed963ab9812b1fb4ec51..23b28952935d1f043ba5042dccbf6daef4356f94 100644 (file)
@@ -1508,12 +1508,12 @@ impl<'tcx> fmt::Debug for LoanPath<'tcx> {
     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         match self.kind {
             LpVar(id) => {
-                write!(f, "$({})", ty::tls::with(|tcx| tcx.hir().hir_to_string(id)))
+                write!(f, "$({})", ty::tls::with(|tcx| tcx.hir().node_to_string(id)))
             }
 
             LpUpvar(ty::UpvarId{ var_path: ty::UpvarPath {hir_id: var_id}, closure_expr_id }) => {
                 let s = ty::tls::with(|tcx| {
-                    tcx.hir().hir_to_string(var_id)
+                    tcx.hir().node_to_string(var_id)
                 });
                 write!(f, "$({} captured by id={:?})", s, closure_expr_id)
             }
@@ -1547,7 +1547,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
 
             LpUpvar(ty::UpvarId{ var_path: ty::UpvarPath { hir_id }, closure_expr_id: _ }) => {
                 let s = ty::tls::with(|tcx| {
-                    tcx.hir().hir_to_string(hir_id)
+                    tcx.hir().node_to_string(hir_id)
                 });
                 write!(f, "$({} captured by closure)", s)
             }
index d4dbb68778ed2d15bad5a45a707104191fa9b5d0..10bfe9e034d32c09faf2b2d8167c0bd3d27669c4 100644 (file)
@@ -2181,7 +2181,7 @@ pub fn tag(&self) -> String {
     pub fn local_ty(&self, span: Span, nid: hir::HirId) -> LocalTy<'tcx> {
         self.locals.borrow().get(&nid).cloned().unwrap_or_else(||
             span_bug!(span, "no type for local variable {}",
-                      self.tcx.hir().hir_to_string(nid))
+                      self.tcx.hir().node_to_string(nid))
         )
     }
 
@@ -2518,7 +2518,7 @@ pub fn node_ty(&self, id: hir::HirId) -> Ty<'tcx> {
             None if self.is_tainted_by_errors() => self.tcx.types.err,
             None => {
                 bug!("no type for node {}: {} in fcx {}",
-                     id, self.tcx.hir().hir_to_string(id),
+                     id, self.tcx.hir().node_to_string(id),
                      self.tag());
             }
         }
index 43063d7b8d12a7a1c3c302bb1bc043c499db2e1f..4e6fcfe0593e2393a5bb0f765c6fd5c310af2ec3 100644 (file)
@@ -26,7 +26,7 @@ fn visit_item(&mut self, item: &hir::Item) {
         // "Trait" impl
         if let hir::ItemKind::Impl(.., Some(_), _, _) = item.node {
             debug!("coherence2::orphan check: trait impl {}",
-                   self.tcx.hir().hir_to_string(item.hir_id));
+                   self.tcx.hir().node_to_string(item.hir_id));
             let trait_ref = self.tcx.impl_trait_ref(def_id).unwrap();
             let trait_def_id = trait_ref.def_id;
             let cm = self.tcx.sess.source_map();
index b120f995ad3a6cbf214d5c3163af7c051fe8dd73..99f87ccb6f65e76fd465784fb09ea63da1520a33 100644 (file)
@@ -129,7 +129,7 @@ fn add_inferreds_for_item(&mut self, id: hir::HirId) {
 impl<'a, 'tcx, 'v> ItemLikeVisitor<'v> for TermsContext<'a, 'tcx> {
     fn visit_item(&mut self, item: &hir::Item) {
         debug!("add_inferreds for item {}",
-               self.tcx.hir().hir_to_string(item.hir_id));
+               self.tcx.hir().node_to_string(item.hir_id));
 
         match item.node {
             hir::ItemKind::Struct(ref struct_def, _) |