diff options
| author | ljedrz <ljedrz@gmail.com> | 2019-06-16 17:30:02 +0200 |
|---|---|---|
| committer | ljedrz <ljedrz@gmail.com> | 2019-06-17 18:59:27 +0200 |
| commit | 1c8551b0ebb4efc72dd1d57035672e5b1c915ac2 (patch) | |
| tree | 25a93234222ce5933929d07763f56d8945b67729 | |
| parent | d996c4d5a383744ec7550b59943b5744f4bcd122 (diff) | |
| download | rust-1c8551b0ebb4efc72dd1d57035672e5b1c915ac2.tar.gz rust-1c8551b0ebb4efc72dd1d57035672e5b1c915ac2.zip | |
renamve hir_to_string to node_to_string
| -rw-r--r-- | src/librustc/cfg/graphviz.rs | 2 | ||||
| -rw-r--r-- | src/librustc/hir/map/hir_id_validator.rs | 8 | ||||
| -rw-r--r-- | src/librustc/hir/map/mod.rs | 28 | ||||
| -rw-r--r-- | src/librustc/infer/opaque_types/mod.rs | 2 | ||||
| -rw-r--r-- | src/librustc/middle/mem_categorization.rs | 2 | ||||
| -rw-r--r-- | src/librustc/middle/reachable.rs | 2 | ||||
| -rw-r--r-- | src/librustc/middle/resolve_lifetime.rs | 2 | ||||
| -rw-r--r-- | src/librustc/ty/context.rs | 4 | ||||
| -rw-r--r-- | src/librustc_borrowck/borrowck/mod.rs | 6 | ||||
| -rw-r--r-- | src/librustc_typeck/check/mod.rs | 4 | ||||
| -rw-r--r-- | src/librustc_typeck/coherence/orphan.rs | 2 | ||||
| -rw-r--r-- | src/librustc_typeck/variance/terms.rs | 2 |
12 files changed, 32 insertions, 32 deletions
diff --git a/src/librustc/cfg/graphviz.rs b/src/librustc/cfg/graphviz.rs index 0bfb6b98e63..66963e5856e 100644 --- a/src/librustc/cfg/graphviz.rs +++ b/src/librustc/cfg/graphviz.rs @@ -26,7 +26,7 @@ impl<'a, 'tcx> LabelledCFG<'a, 'tcx> { 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. diff --git a/src/librustc/hir/map/hir_id_validator.rs b/src/librustc/hir/map/hir_id_validator.rs index 08ec2aeed29..d6ac7ea2ed7 100644 --- a/src/librustc/hir/map/hir_id_validator.rs +++ b/src/librustc/hir/map/hir_id_validator.rs @@ -125,7 +125,7 @@ impl<'a, 'hir: 'a> HirIdValidator<'a, 'hir> { 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 @@ impl<'a, 'hir: 'a> HirIdValidator<'a, 'hir> { 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 @@ impl<'a, 'hir: 'a> intravisit::Visitor<'hir> for HirIdValidator<'a, 'hir> { 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())); } diff --git a/src/librustc/hir/map/mod.rs b/src/librustc/hir/map/mod.rs index 5a45f04b637..26c08154647 100644 --- a/src/librustc/hir/map/mod.rs +++ b/src/librustc/hir/map/mod.rs @@ -453,7 +453,7 @@ impl<'hir> Map<'hir> { 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 @@ impl<'hir> Map<'hir> { 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 @@ impl<'hir> Map<'hir> { 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 @@ impl<'hir> Map<'hir> { 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 @@ impl<'hir> Map<'hir> { 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 @@ impl<'hir> Map<'hir> { 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 @@ impl<'hir> Map<'hir> { 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 @@ impl<'hir> Map<'hir> { 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) } diff --git a/src/librustc/infer/opaque_types/mod.rs b/src/librustc/infer/opaque_types/mod.rs index 1c52b5775a0..328ace51a58 100644 --- a/src/librustc/infer/opaque_types/mod.rs +++ b/src/librustc/infer/opaque_types/mod.rs @@ -819,7 +819,7 @@ impl<'a, 'tcx> Instantiator<'a, 'tcx> { }, _ => 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 { diff --git a/src/librustc/middle/mem_categorization.rs b/src/librustc/middle/mem_categorization.rs index a856430e68a..192e72383ac 100644 --- a/src/librustc/middle/mem_categorization.rs +++ b/src/librustc/middle/mem_categorization.rs @@ -501,7 +501,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> { 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)); } } } diff --git a/src/librustc/middle/reachable.rs b/src/librustc/middle/reachable.rs index 2285beb3758..628a44cbfe0 100644 --- a/src/librustc/middle/reachable.rs +++ b/src/librustc/middle/reachable.rs @@ -318,7 +318,7 @@ impl<'a, 'tcx> ReachableContext<'a, '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, ); } diff --git a/src/librustc/middle/resolve_lifetime.rs b/src/librustc/middle/resolve_lifetime.rs index 6f2c4b66f5e..76bff500634 100644 --- a/src/librustc/middle/resolve_lifetime.rs +++ b/src/librustc/middle/resolve_lifetime.rs @@ -2696,7 +2696,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> { 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) ); diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs index c32f62e88c4..b84ebd8afe8 100644 --- a/src/librustc/ty/context.rs +++ b/src/librustc/ty/context.rs @@ -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 @@ impl<'tcx> TypeckTables<'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))) ) } diff --git a/src/librustc_borrowck/borrowck/mod.rs b/src/librustc_borrowck/borrowck/mod.rs index cc9c83de179..23b28952935 100644 --- a/src/librustc_borrowck/borrowck/mod.rs +++ b/src/librustc_borrowck/borrowck/mod.rs @@ -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 @@ impl<'tcx> fmt::Display for LoanPath<'tcx> { 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) } diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index d4dbb68778e..10bfe9e034d 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -2181,7 +2181,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { 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 @@ impl<'a, 'tcx> FnCtxt<'a, '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()); } } diff --git a/src/librustc_typeck/coherence/orphan.rs b/src/librustc_typeck/coherence/orphan.rs index 43063d7b8d1..4e6fcfe0593 100644 --- a/src/librustc_typeck/coherence/orphan.rs +++ b/src/librustc_typeck/coherence/orphan.rs @@ -26,7 +26,7 @@ impl ItemLikeVisitor<'v> for OrphanChecker<'tcx> { // "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(); diff --git a/src/librustc_typeck/variance/terms.rs b/src/librustc_typeck/variance/terms.rs index b120f995ad3..99f87ccb6f6 100644 --- a/src/librustc_typeck/variance/terms.rs +++ b/src/librustc_typeck/variance/terms.rs @@ -129,7 +129,7 @@ impl<'a, 'tcx> TermsContext<'a, 'tcx> { 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, _) | |
