]> git.lizzy.rs Git - rust.git/commitdiff
Auto merge of #39309 - eddyb:map-shmap, r=nikomatsakis
authorbors <bors@rust-lang.org>
Thu, 26 Jan 2017 15:02:23 +0000 (15:02 +0000)
committerbors <bors@rust-lang.org>
Thu, 26 Jan 2017 15:02:23 +0000 (15:02 +0000)
Rename tcx.map to the far more descriptive tcx.hir.

Also a bit more renaming because `ast_map` and `'ast` were still used with HIR.
Main motivation is to "free up" `tcx.map`, or rather, `tcx.maps`, to consolidate `ty::maps` there.

r? @nikomatsakis

123 files changed:
src/librustc/cfg/construct.rs
src/librustc/cfg/graphviz.rs
src/librustc/dep_graph/dep_node.rs
src/librustc/dep_graph/dep_tracking_map.rs
src/librustc/dep_graph/visit.rs
src/librustc/hir/intravisit.rs
src/librustc/hir/itemlikevisit.rs
src/librustc/hir/map/collector.rs
src/librustc/hir/map/mod.rs
src/librustc/infer/error_reporting.rs
src/librustc/infer/mod.rs
src/librustc/lint/context.rs
src/librustc/middle/dataflow.rs
src/librustc/middle/dead.rs
src/librustc/middle/effect.rs
src/librustc/middle/entry.rs
src/librustc/middle/expr_use_visitor.rs
src/librustc/middle/intrinsicck.rs
src/librustc/middle/lang_items.rs
src/librustc/middle/liveness.rs
src/librustc/middle/mem_categorization.rs
src/librustc/middle/reachable.rs
src/librustc/middle/region.rs
src/librustc/middle/stability.rs
src/librustc/mir/mod.rs
src/librustc/mir/transform.rs
src/librustc/traits/error_reporting.rs
src/librustc/ty/context.rs
src/librustc/ty/error.rs
src/librustc/ty/inhabitedness/def_id_forest.rs
src/librustc/ty/item_path.rs
src/librustc/ty/mod.rs
src/librustc/ty/util.rs
src/librustc/util/ppaux.rs
src/librustc_borrowck/borrowck/check_loans.rs
src/librustc_borrowck/borrowck/fragments.rs
src/librustc_borrowck/borrowck/gather_loans/mod.rs
src/librustc_borrowck/borrowck/mir/mod.rs
src/librustc_borrowck/borrowck/mod.rs
src/librustc_borrowck/borrowck/move_data.rs
src/librustc_const_eval/check_match.rs
src/librustc_const_eval/eval.rs
src/librustc_const_eval/pattern.rs
src/librustc_driver/driver.rs
src/librustc_driver/lib.rs
src/librustc_driver/pretty.rs
src/librustc_driver/test.rs
src/librustc_incremental/assert_dep_graph.rs
src/librustc_incremental/calculate_svh/mod.rs
src/librustc_incremental/calculate_svh/svh_visitor.rs
src/librustc_incremental/persist/dirty_clean.rs
src/librustc_lint/bad_style.rs
src/librustc_lint/builtin.rs
src/librustc_lint/types.rs
src/librustc_lint/unused.rs
src/librustc_metadata/astencode.rs
src/librustc_metadata/cstore_impl.rs
src/librustc_metadata/decoder.rs
src/librustc_metadata/encoder.rs
src/librustc_metadata/index_builder.rs
src/librustc_mir/build/block.rs
src/librustc_mir/build/mod.rs
src/librustc_mir/build/scope.rs
src/librustc_mir/graphviz.rs
src/librustc_mir/hair/cx/expr.rs
src/librustc_mir/hair/cx/mod.rs
src/librustc_mir/mir_map.rs
src/librustc_mir/pretty.rs
src/librustc_mir/transform/copy_prop.rs
src/librustc_mir/transform/deaggregator.rs
src/librustc_mir/transform/qualify_consts.rs
src/librustc_passes/consts.rs
src/librustc_passes/loops.rs
src/librustc_passes/rvalues.rs
src/librustc_passes/static_recursion.rs
src/librustc_privacy/lib.rs
src/librustc_save_analysis/dump_visitor.rs
src/librustc_save_analysis/external_data.rs
src/librustc_save_analysis/lib.rs
src/librustc_trans/assert_module_sources.rs
src/librustc_trans/back/symbol_export.rs
src/librustc_trans/back/symbol_names.rs
src/librustc_trans/base.rs
src/librustc_trans/collector.rs
src/librustc_trans/consts.rs
src/librustc_trans/debuginfo/gdb.rs
src/librustc_trans/debuginfo/metadata.rs
src/librustc_trans/debuginfo/mod.rs
src/librustc_trans/declare.rs
src/librustc_trans/partitioning.rs
src/librustc_trans/symbol_map.rs
src/librustc_trans/symbol_names_test.rs
src/librustc_trans/trans_item.rs
src/librustc_typeck/astconv.rs
src/librustc_typeck/check/_match.rs
src/librustc_typeck/check/callee.rs
src/librustc_typeck/check/closure.rs
src/librustc_typeck/check/compare_method.rs
src/librustc_typeck/check/dropck.rs
src/librustc_typeck/check/intrinsic.rs
src/librustc_typeck/check/method/probe.rs
src/librustc_typeck/check/method/suggest.rs
src/librustc_typeck/check/mod.rs
src/librustc_typeck/check/regionck.rs
src/librustc_typeck/check/upvar.rs
src/librustc_typeck/check/wfcheck.rs
src/librustc_typeck/check/writeback.rs
src/librustc_typeck/check_unused.rs
src/librustc_typeck/coherence/builtin.rs
src/librustc_typeck/coherence/mod.rs
src/librustc_typeck/coherence/orphan.rs
src/librustc_typeck/coherence/overlap.rs
src/librustc_typeck/coherence/unsafety.rs
src/librustc_typeck/collect.rs
src/librustc_typeck/impl_wf_check.rs
src/librustc_typeck/lib.rs
src/librustc_typeck/variance/constraints.rs
src/librustc_typeck/variance/solve.rs
src/librustc_typeck/variance/terms.rs
src/librustdoc/clean/mod.rs
src/librustdoc/core.rs
src/librustdoc/visit_ast.rs
src/test/run-pass-fulldeps/issue-37290/auxiliary/lint.rs

index 6f2b9ca0c4220488be3378e2a7d9900d0c579859..595059332895de875da28ed8b7c86ed9482e7d7a 100644 (file)
@@ -46,18 +46,18 @@ pub fn construct<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
     // Find the function this expression is from.
     let mut node_id = body.id;
     loop {
-        let node = tcx.map.get(node_id);
+        let node = tcx.hir.get(node_id);
         if hir::map::blocks::FnLikeNode::from_node(node).is_some() {
             break;
         }
-        let parent = tcx.map.get_parent_node(node_id);
+        let parent = tcx.hir.get_parent_node(node_id);
         assert!(node_id != parent);
         node_id = parent;
     }
 
     let mut cfg_builder = CFGBuilder {
         tcx: tcx,
-        tables: tcx.item_tables(tcx.map.local_def_id(node_id)),
+        tables: tcx.item_tables(tcx.hir.local_def_id(node_id)),
         graph: graph,
         fn_exit: fn_exit,
         loop_scopes: Vec::new()
index c651baae28224015fc3b790a3af5ee59d14d6aba..944b77dbf01fd21367234a21bd59997bc46ac4d6 100644 (file)
 
 use syntax::ast;
 
-use hir::map as ast_map;
+use hir::map as hir_map;
 use cfg;
 
 pub type Node<'a> = (cfg::CFGIndex, &'a cfg::CFGNode);
 pub type Edge<'a> = &'a cfg::CFGEdge;
 
-pub struct LabelledCFG<'a, 'ast: 'a> {
-    pub ast_map: &'a ast_map::Map<'ast>,
+pub struct LabelledCFG<'a, 'hir: 'a> {
+    pub hir_map: &'a hir_map::Map<'hir>,
     pub cfg: &'a cfg::CFG,
     pub name: String,
     /// `labelled_edges` controls whether we emit labels on the edges
@@ -52,7 +52,7 @@ fn replace_newline_with_backslash_l(s: String) -> String {
     }
 }
 
-impl<'a, 'ast> dot::Labeller<'a> for LabelledCFG<'a, 'ast> {
+impl<'a, 'hir> dot::Labeller<'a> for LabelledCFG<'a, 'hir> {
     type Node = Node<'a>;
     type Edge = Edge<'a>;
     fn graph_id(&'a self) -> dot::Id<'a> { dot::Id::new(&self.name[..]).unwrap() }
@@ -69,7 +69,7 @@ fn node_label(&'a self, &(i, n): &Node<'a>) -> dot::LabelText<'a> {
         } else if n.data.id() == ast::DUMMY_NODE_ID {
             dot::LabelText::LabelStr("(dummy_node)".into_cow())
         } else {
-            let s = self.ast_map.node_to_string(n.data.id());
+            let s = self.hir_map.node_to_string(n.data.id());
             // left-aligns the lines
             let s = replace_newline_with_backslash_l(s);
             dot::LabelText::EscStr(s.into_cow())
@@ -88,7 +88,7 @@ fn edge_label(&self, e: &Edge<'a>) -> dot::LabelText<'a> {
             } else {
                 put_one = true;
             }
-            let s = self.ast_map.node_to_string(node_id);
+            let s = self.hir_map.node_to_string(node_id);
             // left-aligns the lines
             let s = replace_newline_with_backslash_l(s);
             label.push_str(&format!("exiting scope_{} {}",
@@ -120,7 +120,7 @@ fn target(&'a self, edge: &Edge<'a>) -> Node<'a> {
     }
 }
 
-impl<'a, 'ast> dot::GraphWalk<'a> for LabelledCFG<'a, 'ast>
+impl<'a, 'hir> dot::GraphWalk<'a> for LabelledCFG<'a, 'hir>
 {
     type Node = Node<'a>;
     type Edge = Edge<'a>;
index d9fd0b9a1f939db7de2dfcb2100a2c893db1183e..df6db366df5b36bd6426bd9acbb65c2f5a52aeaf 100644 (file)
@@ -29,10 +29,10 @@ pub enum DepNode<D: Clone + Debug> {
     // Represents the `Krate` as a whole (the `hir::Krate` value) (as
     // distinct from the krate module). This is basically a hash of
     // the entire krate, so if you read from `Krate` (e.g., by calling
-    // `tcx.map.krate()`), we will have to assume that any change
+    // `tcx.hir.krate()`), we will have to assume that any change
     // means that you need to be recompiled. This is because the
     // `Krate` value gives you access to all other items. To avoid
-    // this fate, do not call `tcx.map.krate()`; instead, prefer
+    // this fate, do not call `tcx.hir.krate()`; instead, prefer
     // wrappers like `tcx.visit_all_items_in_krate()`.  If there is no
     // suitable wrapper, you can use `tcx.dep_graph.ignore()` to gain
     // access to the krate, but you must remember to add suitable
index 50dfe9d22f12fa110f3a22d5056016e1960e3913..9660758220368c47270733b367da00600076f653 100644 (file)
@@ -117,7 +117,7 @@ impl<M: DepTrackingMapConfig> MemoizationMap for RefCell<DepTrackingMap<M>> {
     ///
     /// ```
     /// fn type_of_item(..., item: &hir::Item) -> Ty<'tcx> {
-    ///     let item_def_id = ccx.tcx.map.local_def_id(it.id);
+    ///     let item_def_id = ccx.tcx.hir.local_def_id(it.id);
     ///     ccx.tcx.item_types.memoized(item_def_id, || {
     ///         ccx.tcx.dep_graph.read(DepNode::Hir(item_def_id)); // (*)
     ///         compute_type_of_item(ccx, item)
index 1990574ca9a831d3232c95b282cb854e97333f59..f0a81fd1cfd334f061686970ed6a8a69d9b58201 100644 (file)
@@ -36,7 +36,7 @@ impl<'visit, 'tcx, F, V> ItemLikeVisitor<'tcx> for TrackingVisitor<'visit, 'tcx,
         where F: FnMut(DefId) -> DepNode<DefId>, V: ItemLikeVisitor<'tcx>
     {
         fn visit_item(&mut self, i: &'tcx hir::Item) {
-            let item_def_id = self.tcx.map.local_def_id(i.id);
+            let item_def_id = self.tcx.hir.local_def_id(i.id);
             let task_id = (self.dep_node_fn)(item_def_id);
             let _task = self.tcx.dep_graph.in_task(task_id.clone());
             debug!("Started task {:?}", task_id);
@@ -46,7 +46,7 @@ fn visit_item(&mut self, i: &'tcx hir::Item) {
         }
 
         fn visit_trait_item(&mut self, i: &'tcx hir::TraitItem) {
-            let trait_item_def_id = self.tcx.map.local_def_id(i.id);
+            let trait_item_def_id = self.tcx.hir.local_def_id(i.id);
             let task_id = (self.dep_node_fn)(trait_item_def_id);
             let _task = self.tcx.dep_graph.in_task(task_id.clone());
             debug!("Started task {:?}", task_id);
@@ -56,7 +56,7 @@ fn visit_trait_item(&mut self, i: &'tcx hir::TraitItem) {
         }
 
         fn visit_impl_item(&mut self, i: &'tcx hir::ImplItem) {
-            let impl_item_def_id = self.tcx.map.local_def_id(i.id);
+            let impl_item_def_id = self.tcx.hir.local_def_id(i.id);
             let task_id = (self.dep_node_fn)(impl_item_def_id);
             let _task = self.tcx.dep_graph.in_task(task_id.clone());
             debug!("Started task {:?}", task_id);
@@ -66,7 +66,7 @@ fn visit_impl_item(&mut self, i: &'tcx hir::ImplItem) {
         }
     }
 
-    let krate = tcx.dep_graph.with_ignore(|| tcx.map.krate());
+    let krate = tcx.dep_graph.with_ignore(|| tcx.hir.krate());
     let mut tracking_visitor = TrackingVisitor {
         tcx: tcx,
         dep_node_fn: &mut dep_node_fn,
index cc6d61c21c69613e66809b3247ac389607356005..d4095c6875c1d10e44b61a8c37060440893502e6 100644 (file)
@@ -1085,13 +1085,13 @@ pub fn add(&mut self, id: NodeId) {
 }
 
 
-pub struct IdRangeComputingVisitor<'a, 'ast: 'a> {
+pub struct IdRangeComputingVisitor<'a, 'hir: 'a> {
     result: IdRange,
-    map: &'a map::Map<'ast>,
+    map: &'a map::Map<'hir>,
 }
 
-impl<'a, 'ast> IdRangeComputingVisitor<'a, 'ast> {
-    pub fn new(map: &'a map::Map<'ast>) -> IdRangeComputingVisitor<'a, 'ast> {
+impl<'a, 'hir> IdRangeComputingVisitor<'a, 'hir> {
+    pub fn new(map: &'a map::Map<'hir>) -> IdRangeComputingVisitor<'a, 'hir> {
         IdRangeComputingVisitor { result: IdRange::max(), map: map }
     }
 
@@ -1100,8 +1100,8 @@ pub fn result(&self) -> IdRange {
     }
 }
 
-impl<'a, 'ast> Visitor<'ast> for IdRangeComputingVisitor<'a, 'ast> {
-    fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'ast> {
+impl<'a, 'hir> Visitor<'hir> for IdRangeComputingVisitor<'a, 'hir> {
+    fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'hir> {
         NestedVisitorMap::OnlyBodies(&self.map)
     }
 
index f359ca2016359ef85cf04f58d9ee2c1e7d67f3b4..0d79017066b01da6946a97a70559737aa8596de7 100644 (file)
@@ -44,7 +44,7 @@
 ///    - How: Implement `intravisit::Visitor` and override the
 ///      `visit_nested_map()` methods to return
 ///      `NestedVisitorMap::All`. Walk your crate with
-///      `intravisit::walk_crate()` invoked on `tcx.map.krate()`.
+///      `intravisit::walk_crate()` invoked on `tcx.hir.krate()`.
 ///    - Pro: Visitor methods for any kind of HIR node, not just item-like things.
 ///    - Pro: Preserves nesting information
 ///    - Con: Does not integrate well into dependency tracking.
index bd0ff695d093a518ca58c395b59953f5cf477fc0..904f74b8787fd5d6a633491937ab97df93345bd2 100644 (file)
 use syntax_pos::Span;
 
 /// A Visitor that walks over the HIR and collects Nodes into a HIR map
-pub struct NodeCollector<'ast> {
+pub struct NodeCollector<'hir> {
     /// The crate
-    pub krate: &'ast Crate,
+    pub krate: &'hir Crate,
     /// The node map
-    pub(super) map: Vec<MapEntry<'ast>>,
+    pub(super) map: Vec<MapEntry<'hir>>,
     /// The parent of this node
     pub parent_node: NodeId,
 }
 
-impl<'ast> NodeCollector<'ast> {
-    pub fn root(krate: &'ast Crate) -> NodeCollector<'ast> {
+impl<'hir> NodeCollector<'hir> {
+    pub fn root(krate: &'hir Crate) -> NodeCollector<'hir> {
         let mut collector = NodeCollector {
             krate: krate,
             map: vec![],
@@ -37,8 +37,8 @@ pub fn root(krate: &'ast Crate) -> NodeCollector<'ast> {
         collector
     }
 
-    fn insert_entry(&mut self, id: NodeId, entry: MapEntry<'ast>) {
-        debug!("ast_map: {:?} => {:?}", id, entry);
+    fn insert_entry(&mut self, id: NodeId, entry: MapEntry<'hir>) {
+        debug!("hir_map: {:?} => {:?}", id, entry);
         let len = self.map.len();
         if id.as_usize() >= len {
             self.map.extend(repeat(NotPresent).take(id.as_usize() - len + 1));
@@ -46,7 +46,7 @@ fn insert_entry(&mut self, id: NodeId, entry: MapEntry<'ast>) {
         self.map[id.as_usize()] = entry;
     }
 
-    fn insert(&mut self, id: NodeId, node: Node<'ast>) {
+    fn insert(&mut self, id: NodeId, node: Node<'hir>) {
         let entry = MapEntry::from_node(self.parent_node, node);
         self.insert_entry(id, entry);
     }
@@ -59,12 +59,12 @@ fn with_parent<F: FnOnce(&mut Self)>(&mut self, parent_id: NodeId, f: F) {
     }
 }
 
-impl<'ast> Visitor<'ast> for NodeCollector<'ast> {
+impl<'hir> Visitor<'hir> for NodeCollector<'hir> {
     /// Because we want to track parent items and so forth, enable
     /// deep walking so that we walk nested items in the context of
     /// their outer items.
 
-    fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'ast> {
+    fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'hir> {
         panic!("visit_nested_xxx must be manually implemented in this visitor")
     }
 
@@ -85,7 +85,7 @@ fn visit_nested_body(&mut self, id: BodyId) {
         self.visit_body(self.krate.body(id));
     }
 
-    fn visit_item(&mut self, i: &'ast Item) {
+    fn visit_item(&mut self, i: &'hir Item) {
         debug!("visit_item: {:?}", i);
 
         self.insert(i.id, NodeItem(i));
@@ -104,7 +104,7 @@ fn visit_item(&mut self, i: &'ast Item) {
         });
     }
 
-    fn visit_foreign_item(&mut self, foreign_item: &'ast ForeignItem) {
+    fn visit_foreign_item(&mut self, foreign_item: &'hir ForeignItem) {
         self.insert(foreign_item.id, NodeForeignItem(foreign_item));
 
         self.with_parent(foreign_item.id, |this| {
@@ -112,7 +112,7 @@ fn visit_foreign_item(&mut self, foreign_item: &'ast ForeignItem) {
         });
     }
 
-    fn visit_generics(&mut self, generics: &'ast Generics) {
+    fn visit_generics(&mut self, generics: &'hir Generics) {
         for ty_param in generics.ty_params.iter() {
             self.insert(ty_param.id, NodeTyParam(ty_param));
         }
@@ -120,7 +120,7 @@ fn visit_generics(&mut self, generics: &'ast Generics) {
         intravisit::walk_generics(self, generics);
     }
 
-    fn visit_trait_item(&mut self, ti: &'ast TraitItem) {
+    fn visit_trait_item(&mut self, ti: &'hir TraitItem) {
         self.insert(ti.id, NodeTraitItem(ti));
 
         self.with_parent(ti.id, |this| {
@@ -128,7 +128,7 @@ fn visit_trait_item(&mut self, ti: &'ast TraitItem) {
         });
     }
 
-    fn visit_impl_item(&mut self, ii: &'ast ImplItem) {
+    fn visit_impl_item(&mut self, ii: &'hir ImplItem) {
         self.insert(ii.id, NodeImplItem(ii));
 
         self.with_parent(ii.id, |this| {
@@ -136,7 +136,7 @@ fn visit_impl_item(&mut self, ii: &'ast ImplItem) {
         });
     }
 
-    fn visit_pat(&mut self, pat: &'ast Pat) {
+    fn visit_pat(&mut self, pat: &'hir Pat) {
         let node = if let PatKind::Binding(..) = pat.node {
             NodeLocal(pat)
         } else {
@@ -149,7 +149,7 @@ fn visit_pat(&mut self, pat: &'ast Pat) {
         });
     }
 
-    fn visit_expr(&mut self, expr: &'ast Expr) {
+    fn visit_expr(&mut self, expr: &'hir Expr) {
         self.insert(expr.id, NodeExpr(expr));
 
         self.with_parent(expr.id, |this| {
@@ -157,7 +157,7 @@ fn visit_expr(&mut self, expr: &'ast Expr) {
         });
     }
 
-    fn visit_stmt(&mut self, stmt: &'ast Stmt) {
+    fn visit_stmt(&mut self, stmt: &'hir Stmt) {
         let id = stmt.node.id();
         self.insert(id, NodeStmt(stmt));
 
@@ -166,7 +166,7 @@ fn visit_stmt(&mut self, stmt: &'ast Stmt) {
         });
     }
 
-    fn visit_ty(&mut self, ty: &'ast Ty) {
+    fn visit_ty(&mut self, ty: &'hir Ty) {
         self.insert(ty.id, NodeTy(ty));
 
         self.with_parent(ty.id, |this| {
@@ -174,7 +174,7 @@ fn visit_ty(&mut self, ty: &'ast Ty) {
         });
     }
 
-    fn visit_trait_ref(&mut self, tr: &'ast TraitRef) {
+    fn visit_trait_ref(&mut self, tr: &'hir TraitRef) {
         self.insert(tr.ref_id, NodeTraitRef(tr));
 
         self.with_parent(tr.ref_id, |this| {
@@ -182,24 +182,24 @@ fn visit_trait_ref(&mut self, tr: &'ast TraitRef) {
         });
     }
 
-    fn visit_fn(&mut self, fk: intravisit::FnKind<'ast>, fd: &'ast FnDecl,
+    fn visit_fn(&mut self, fk: intravisit::FnKind<'hir>, fd: &'hir FnDecl,
                 b: BodyId, s: Span, id: NodeId) {
         assert_eq!(self.parent_node, id);
         intravisit::walk_fn(self, fk, fd, b, s, id);
     }
 
-    fn visit_block(&mut self, block: &'ast Block) {
+    fn visit_block(&mut self, block: &'hir Block) {
         self.insert(block.id, NodeBlock(block));
         self.with_parent(block.id, |this| {
             intravisit::walk_block(this, block);
         });
     }
 
-    fn visit_lifetime(&mut self, lifetime: &'ast Lifetime) {
+    fn visit_lifetime(&mut self, lifetime: &'hir Lifetime) {
         self.insert(lifetime.id, NodeLifetime(lifetime));
     }
 
-    fn visit_vis(&mut self, visibility: &'ast Visibility) {
+    fn visit_vis(&mut self, visibility: &'hir Visibility) {
         match *visibility {
             Visibility::Public |
             Visibility::Crate |
@@ -213,11 +213,11 @@ fn visit_vis(&mut self, visibility: &'ast Visibility) {
         }
     }
 
-    fn visit_macro_def(&mut self, macro_def: &'ast MacroDef) {
+    fn visit_macro_def(&mut self, macro_def: &'hir MacroDef) {
         self.insert_entry(macro_def.id, NotPresent);
     }
 
-    fn visit_variant(&mut self, v: &'ast Variant, g: &'ast Generics, item_id: NodeId) {
+    fn visit_variant(&mut self, v: &'hir Variant, g: &'hir Generics, item_id: NodeId) {
         let id = v.node.data.id();
         self.insert(id, NodeVariant(v));
         self.with_parent(id, |this| {
@@ -225,7 +225,7 @@ fn visit_variant(&mut self, v: &'ast Variant, g: &'ast Generics, item_id: NodeId
         });
     }
 
-    fn visit_struct_field(&mut self, field: &'ast StructField) {
+    fn visit_struct_field(&mut self, field: &'hir StructField) {
         self.insert(field.id, NodeField(field));
         self.with_parent(field.id, |this| {
             intravisit::walk_struct_field(this, field);
index 7c0621279fd6f607f26e0675ec4484c8886db298..9f31b5b456b9f27c7446d88fc636cd240b96610a 100644 (file)
 pub mod definitions;
 
 #[derive(Copy, Clone, Debug)]
-pub enum Node<'ast> {
-    NodeItem(&'ast Item),
-    NodeForeignItem(&'ast ForeignItem),
-    NodeTraitItem(&'ast TraitItem),
-    NodeImplItem(&'ast ImplItem),
-    NodeVariant(&'ast Variant),
-    NodeField(&'ast StructField),
-    NodeExpr(&'ast Expr),
-    NodeStmt(&'ast Stmt),
-    NodeTy(&'ast Ty),
-    NodeTraitRef(&'ast TraitRef),
-    NodeLocal(&'ast Pat),
-    NodePat(&'ast Pat),
-    NodeBlock(&'ast Block),
+pub enum Node<'hir> {
+    NodeItem(&'hir Item),
+    NodeForeignItem(&'hir ForeignItem),
+    NodeTraitItem(&'hir TraitItem),
+    NodeImplItem(&'hir ImplItem),
+    NodeVariant(&'hir Variant),
+    NodeField(&'hir StructField),
+    NodeExpr(&'hir Expr),
+    NodeStmt(&'hir Stmt),
+    NodeTy(&'hir Ty),
+    NodeTraitRef(&'hir TraitRef),
+    NodeLocal(&'hir Pat),
+    NodePat(&'hir Pat),
+    NodeBlock(&'hir Block),
 
     /// NodeStructCtor represents a tuple struct.
-    NodeStructCtor(&'ast VariantData),
+    NodeStructCtor(&'hir VariantData),
 
-    NodeLifetime(&'ast Lifetime),
-    NodeTyParam(&'ast TyParam),
-    NodeVisibility(&'ast Visibility),
+    NodeLifetime(&'hir Lifetime),
+    NodeTyParam(&'hir TyParam),
+    NodeVisibility(&'hir Visibility),
 }
 
 /// Represents an entry and its parent NodeID.
 /// The odd layout is to bring down the total size.
 #[derive(Copy, Debug)]
-enum MapEntry<'ast> {
+enum MapEntry<'hir> {
     /// Placeholder for holes in the map.
     NotPresent,
 
     /// All the node types, with a parent ID.
-    EntryItem(NodeId, &'ast Item),
-    EntryForeignItem(NodeId, &'ast ForeignItem),
-    EntryTraitItem(NodeId, &'ast TraitItem),
-    EntryImplItem(NodeId, &'ast ImplItem),
-    EntryVariant(NodeId, &'ast Variant),
-    EntryField(NodeId, &'ast StructField),
-    EntryExpr(NodeId, &'ast Expr),
-    EntryStmt(NodeId, &'ast Stmt),
-    EntryTy(NodeId, &'ast Ty),
-    EntryTraitRef(NodeId, &'ast TraitRef),
-    EntryLocal(NodeId, &'ast Pat),
-    EntryPat(NodeId, &'ast Pat),
-    EntryBlock(NodeId, &'ast Block),
-    EntryStructCtor(NodeId, &'ast VariantData),
-    EntryLifetime(NodeId, &'ast Lifetime),
-    EntryTyParam(NodeId, &'ast TyParam),
-    EntryVisibility(NodeId, &'ast Visibility),
+    EntryItem(NodeId, &'hir Item),
+    EntryForeignItem(NodeId, &'hir ForeignItem),
+    EntryTraitItem(NodeId, &'hir TraitItem),
+    EntryImplItem(NodeId, &'hir ImplItem),
+    EntryVariant(NodeId, &'hir Variant),
+    EntryField(NodeId, &'hir StructField),
+    EntryExpr(NodeId, &'hir Expr),
+    EntryStmt(NodeId, &'hir Stmt),
+    EntryTy(NodeId, &'hir Ty),
+    EntryTraitRef(NodeId, &'hir TraitRef),
+    EntryLocal(NodeId, &'hir Pat),
+    EntryPat(NodeId, &'hir Pat),
+    EntryBlock(NodeId, &'hir Block),
+    EntryStructCtor(NodeId, &'hir VariantData),
+    EntryLifetime(NodeId, &'hir Lifetime),
+    EntryTyParam(NodeId, &'hir TyParam),
+    EntryVisibility(NodeId, &'hir Visibility),
 
     /// Roots for node trees.
     RootCrate,
 }
 
-impl<'ast> Clone for MapEntry<'ast> {
-    fn clone(&self) -> MapEntry<'ast> {
+impl<'hir> Clone for MapEntry<'hir> {
+    fn clone(&self) -> MapEntry<'hir> {
         *self
     }
 }
 
-impl<'ast> MapEntry<'ast> {
-    fn from_node(p: NodeId, node: Node<'ast>) -> MapEntry<'ast> {
+impl<'hir> MapEntry<'hir> {
+    fn from_node(p: NodeId, node: Node<'hir>) -> MapEntry<'hir> {
         match node {
             NodeItem(n) => EntryItem(p, n),
             NodeForeignItem(n) => EntryForeignItem(p, n),
@@ -145,7 +145,7 @@ fn parent_node(self) -> Option<NodeId> {
         })
     }
 
-    fn to_node(self) -> Option<Node<'ast>> {
+    fn to_node(self) -> Option<Node<'hir>> {
         Some(match self {
             EntryItem(_, n) => NodeItem(n),
             EntryForeignItem(_, n) => NodeForeignItem(n),
@@ -225,7 +225,7 @@ pub fn new(krate: Crate, dep_graph: &DepGraph) -> Forest {
         }
     }
 
-    pub fn krate<'ast>(&'ast self) -> &'ast Crate {
+    pub fn krate<'hir>(&'hir self) -> &'hir Crate {
         self.dep_graph.read(DepNode::Krate);
         &self.krate
     }
@@ -234,9 +234,9 @@ pub fn krate<'ast>(&'ast self) -> &'ast Crate {
 /// Represents a mapping from Node IDs to AST elements and their parent
 /// Node IDs
 #[derive(Clone)]
-pub struct Map<'ast> {
+pub struct Map<'hir> {
     /// The backing storage for all the AST nodes.
-    pub forest: &'ast Forest,
+    pub forest: &'hir Forest,
 
     /// Same as the dep_graph in forest, just available with one fewer
     /// deref. This is a gratuitious micro-optimization.
@@ -251,15 +251,15 @@ pub struct Map<'ast> {
     ///
     /// Also, indexing is pretty quick when you've got a vector and
     /// plain old integers.
-    map: Vec<MapEntry<'ast>>,
+    map: Vec<MapEntry<'hir>>,
 
     definitions: Definitions,
 
     /// Bodies inlined from other crates are cached here.
-    inlined_bodies: RefCell<DefIdMap<&'ast Body>>,
+    inlined_bodies: RefCell<DefIdMap<&'hir Body>>,
 }
 
-impl<'ast> Map<'ast> {
+impl<'hir> Map<'hir> {
     /// Registers a read in the dependency graph of the AST node with
     /// the given `id`. This needs to be called each time a public
     /// function returns the HIR for a node -- in other words, when it
@@ -388,15 +388,15 @@ fn entry_count(&self) -> usize {
         self.map.len()
     }
 
-    fn find_entry(&self, id: NodeId) -> Option<MapEntry<'ast>> {
+    fn find_entry(&self, id: NodeId) -> Option<MapEntry<'hir>> {
         self.map.get(id.as_usize()).cloned()
     }
 
-    pub fn krate(&self) -> &'ast Crate {
+    pub fn krate(&self) -> &'hir Crate {
         self.forest.krate()
     }
 
-    pub fn trait_item(&self, id: TraitItemId) -> &'ast TraitItem {
+    pub fn trait_item(&self, id: TraitItemId) -> &'hir TraitItem {
         self.read(id.node_id);
 
         // NB: intentionally bypass `self.forest.krate()` so that we
@@ -404,7 +404,7 @@ pub fn trait_item(&self, id: TraitItemId) -> &'ast TraitItem {
         self.forest.krate.trait_item(id)
     }
 
-    pub fn impl_item(&self, id: ImplItemId) -> &'ast ImplItem {
+    pub fn impl_item(&self, id: ImplItemId) -> &'hir ImplItem {
         self.read(id.node_id);
 
         // NB: intentionally bypass `self.forest.krate()` so that we
@@ -412,7 +412,7 @@ pub fn impl_item(&self, id: ImplItemId) -> &'ast ImplItem {
         self.forest.krate.impl_item(id)
     }
 
-    pub fn body(&self, id: BodyId) -> &'ast Body {
+    pub fn body(&self, id: BodyId) -> &'hir Body {
         self.read(id.node_id);
 
         // NB: intentionally bypass `self.forest.krate()` so that we
@@ -440,7 +440,7 @@ pub fn body_owner_def_id(&self, id: BodyId) -> DefId {
     /// Get the attributes on the krate. This is preferable to
     /// invoking `krate.attrs` because it registers a tighter
     /// dep-graph access.
-    pub fn krate_attrs(&self) -> &'ast [ast::Attribute] {
+    pub fn krate_attrs(&self) -> &'hir [ast::Attribute] {
         let crate_root_def_id = DefId::local(CRATE_DEF_INDEX);
         self.dep_graph.read(DepNode::Hir(crate_root_def_id));
         &self.forest.krate.attrs
@@ -448,20 +448,20 @@ pub fn krate_attrs(&self) -> &'ast [ast::Attribute] {
 
     /// Retrieve the Node corresponding to `id`, panicking if it cannot
     /// be found.
-    pub fn get(&self, id: NodeId) -> Node<'ast> {
+    pub fn get(&self, id: NodeId) -> Node<'hir> {
         match self.find(id) {
             Some(node) => node, // read recorded by `find`
             None => bug!("couldn't find node id {} in the AST map", id)
         }
     }
 
-    pub fn get_if_local(&self, id: DefId) -> Option<Node<'ast>> {
+    pub fn get_if_local(&self, id: DefId) -> Option<Node<'hir>> {
         self.as_local_node_id(id).map(|id| self.get(id)) // read recorded by `get`
     }
 
     /// Retrieve the Node corresponding to `id`, returning None if
     /// cannot be found.
-    pub fn find(&self, id: NodeId) -> Option<Node<'ast>> {
+    pub fn find(&self, id: NodeId) -> Option<Node<'hir>> {
         let result = self.find_entry(id).and_then(|x| x.to_node());
         if result.is_some() {
             self.read(id);
@@ -508,7 +508,7 @@ pub fn is_argument(&self, id: NodeId) -> bool {
     /// is not an error, since items in the crate module have the crate root as
     /// parent.
     fn walk_parent_nodes<F>(&self, start_id: NodeId, found: F) -> Result<NodeId, NodeId>
-        where F: Fn(&Node<'ast>) -> bool
+        where F: Fn(&Node<'hir>) -> bool
     {
         let mut id = start_id;
         loop {
@@ -611,28 +611,28 @@ pub fn get_foreign_abi(&self, id: NodeId) -> Abi {
         }
     }
 
-    pub fn expect_item(&self, id: NodeId) -> &'ast Item {
+    pub fn expect_item(&self, id: NodeId) -> &'hir Item {
         match self.find(id) { // read recorded by `find`
             Some(NodeItem(item)) => item,
             _ => bug!("expected item, found {}", self.node_to_string(id))
         }
     }
 
-    pub fn expect_impl_item(&self, id: NodeId) -> &'ast ImplItem {
+    pub fn expect_impl_item(&self, id: NodeId) -> &'hir ImplItem {
         match self.find(id) {
             Some(NodeImplItem(item)) => item,
             _ => bug!("expected impl item, found {}", self.node_to_string(id))
         }
     }
 
-    pub fn expect_trait_item(&self, id: NodeId) -> &'ast TraitItem {
+    pub fn expect_trait_item(&self, id: NodeId) -> &'hir TraitItem {
         match self.find(id) {
             Some(NodeTraitItem(item)) => item,
             _ => bug!("expected trait item, found {}", self.node_to_string(id))
         }
     }
 
-    pub fn expect_variant_data(&self, id: NodeId) -> &'ast VariantData {
+    pub fn expect_variant_data(&self, id: NodeId) -> &'hir VariantData {
         match self.find(id) {
             Some(NodeItem(i)) => {
                 match i.node {
@@ -653,35 +653,35 @@ pub fn expect_variant_data(&self, id: NodeId) -> &'ast VariantData {
         }
     }
 
-    pub fn expect_variant(&self, id: NodeId) -> &'ast Variant {
+    pub fn expect_variant(&self, id: NodeId) -> &'hir Variant {
         match self.find(id) {
             Some(NodeVariant(variant)) => variant,
             _ => bug!("expected variant, found {}", self.node_to_string(id)),
         }
     }
 
-    pub fn expect_foreign_item(&self, id: NodeId) -> &'ast ForeignItem {
+    pub fn expect_foreign_item(&self, id: NodeId) -> &'hir ForeignItem {
         match self.find(id) {
             Some(NodeForeignItem(item)) => item,
             _ => bug!("expected foreign item, found {}", self.node_to_string(id))
         }
     }
 
-    pub fn expect_expr(&self, id: NodeId) -> &'ast Expr {
+    pub fn expect_expr(&self, id: NodeId) -> &'hir Expr {
         match self.find(id) { // read recorded by find
             Some(NodeExpr(expr)) => expr,
             _ => bug!("expected expr, found {}", self.node_to_string(id))
         }
     }
 
-    pub fn get_inlined_body(&self, def_id: DefId) -> Option<&'ast Body> {
+    pub fn get_inlined_body(&self, def_id: DefId) -> Option<&'hir Body> {
         self.inlined_bodies.borrow().get(&def_id).map(|&body| {
             self.dep_graph.read(DepNode::MetaData(def_id));
             body
         })
     }
 
-    pub fn intern_inlined_body(&self, def_id: DefId, body: Body) -> &'ast Body {
+    pub fn intern_inlined_body(&self, def_id: DefId, body: Body) -> &'hir Body {
         let body = self.forest.inlined_bodies.alloc(body);
         self.inlined_bodies.borrow_mut().insert(def_id, body);
         body
@@ -706,7 +706,7 @@ pub fn name(&self, id: NodeId) -> Name {
 
     /// Given a node ID, get a list of attributes associated with the AST
     /// corresponding to the Node ID
-    pub fn attrs(&self, id: NodeId) -> &'ast [ast::Attribute] {
+    pub fn attrs(&self, id: NodeId) -> &'hir [ast::Attribute] {
         self.read(id); // reveals attributes on the node
         let attrs = match self.find(id) {
             Some(NodeItem(i)) => Some(&i.attrs[..]),
@@ -735,7 +735,7 @@ pub fn attrs(&self, id: NodeId) -> &'ast [ast::Attribute] {
     /// such as `foo::bar::quux`, `bar::quux`, `other::bar::quux`, and
     /// any other such items it can find in the map.
     pub fn nodes_matching_suffix<'a>(&'a self, parts: &'a [String])
-                                 -> NodesMatchingSuffix<'a, 'ast> {
+                                 -> NodesMatchingSuffix<'a, 'hir> {
         NodesMatchingSuffix {
             map: self,
             item_name: parts.last().unwrap(),
@@ -790,14 +790,14 @@ pub fn node_to_pretty_string(&self, id: NodeId) -> String {
     }
 }
 
-pub struct NodesMatchingSuffix<'a, 'ast:'a> {
-    map: &'a Map<'ast>,
+pub struct NodesMatchingSuffix<'a, 'hir:'a> {
+    map: &'a Map<'hir>,
     item_name: &'a String,
     in_which: &'a [String],
     idx: NodeId,
 }
 
-impl<'a, 'ast> NodesMatchingSuffix<'a, 'ast> {
+impl<'a, 'hir> NodesMatchingSuffix<'a, 'hir> {
     /// Returns true only if some suffix of the module path for parent
     /// matches `self.in_which`.
     ///
@@ -853,7 +853,7 @@ fn matches_names(&self, parent_of_n: NodeId, name: Name) -> bool {
     }
 }
 
-impl<'a, 'ast> Iterator for NodesMatchingSuffix<'a, 'ast> {
+impl<'a, 'hir> Iterator for NodesMatchingSuffix<'a, 'hir> {
     type Item = NodeId;
 
     fn next(&mut self) -> Option<NodeId> {
@@ -892,9 +892,9 @@ impl Named for StructField { fn name(&self) -> Name { self.name } }
 impl Named for TraitItem { fn name(&self) -> Name { self.name } }
 impl Named for ImplItem { fn name(&self) -> Name { self.name } }
 
-pub fn map_crate<'ast>(forest: &'ast mut Forest,
+pub fn map_crate<'hir>(forest: &'hir mut Forest,
                        definitions: Definitions)
-                       -> Map<'ast> {
+                       -> Map<'hir> {
     let mut collector = NodeCollector::root(&forest.krate);
     intravisit::walk_crate(&mut collector, &forest.krate);
     let map = collector.map;
@@ -926,7 +926,7 @@ pub fn map_crate<'ast>(forest: &'ast mut Forest,
 
 /// Identical to the `PpAnn` implementation for `hir::Crate`,
 /// except it avoids creating a dependency on the whole crate.
-impl<'ast> print::PpAnn for Map<'ast> {
+impl<'hir> print::PpAnn for Map<'hir> {
     fn nested(&self, state: &mut print::State, nested: print::Nested) -> io::Result<()> {
         match nested {
             Nested::Item(id) => state.print_item(self.expect_item(id.id)),
@@ -966,7 +966,7 @@ pub fn print_node(&mut self, node: Node) -> io::Result<()> {
             NodeTyParam(_)     => bug!("cannot print TyParam"),
             NodeField(_)       => bug!("cannot print StructField"),
             // these cases do not carry enough information in the
-            // ast_map to reconstruct their full structure for pretty
+            // hir_map to reconstruct their full structure for pretty
             // printing.
             NodeStructCtor(_)  => bug!("cannot print isolated StructCtor"),
         }
index d859a8b44db0c2af41723e3889427d3042cede3c..23106d2bdc7d36f8373f77ec5651a46562cb7dd9 100644 (file)
@@ -73,7 +73,7 @@
 
 use std::collections::HashSet;
 
-use hir::map as ast_map;
+use hir::map as hir_map;
 use hir;
 
 use lint;
@@ -144,16 +144,16 @@ fn explain_span<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>,
                     format!("{}unknown scope: {:?}{}.  Please report a bug.",
                             prefix, scope, suffix)
                 };
-                let span = match scope.span(&self.region_maps, &self.map) {
+                let span = match scope.span(&self.region_maps, &self.hir) {
                     Some(s) => s,
                     None => {
                         err.note(&unknown_scope());
                         return;
                     }
                 };
-                let tag = match self.map.find(scope.node_id(&self.region_maps)) {
-                    Some(ast_map::NodeBlock(_)) => "block",
-                    Some(ast_map::NodeExpr(expr)) => match expr.node {
+                let tag = match self.hir.find(scope.node_id(&self.region_maps)) {
+                    Some(hir_map::NodeBlock(_)) => "block",
+                    Some(hir_map::NodeExpr(expr)) => match expr.node {
                         hir::ExprCall(..) => "call",
                         hir::ExprMethodCall(..) => "method call",
                         hir::ExprMatch(.., hir::MatchSource::IfLetDesugar { .. }) => "if let",
@@ -162,10 +162,10 @@ fn explain_span<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>,
                         hir::ExprMatch(..) => "match",
                         _ => "expression",
                     },
-                    Some(ast_map::NodeStmt(_)) => "statement",
-                    Some(ast_map::NodeItem(it)) => item_scope_tag(&it),
-                    Some(ast_map::NodeTraitItem(it)) => trait_item_scope_tag(&it),
-                    Some(ast_map::NodeImplItem(it)) => impl_item_scope_tag(&it),
+                    Some(hir_map::NodeStmt(_)) => "statement",
+                    Some(hir_map::NodeItem(it)) => item_scope_tag(&it),
+                    Some(hir_map::NodeTraitItem(it)) => trait_item_scope_tag(&it),
+                    Some(hir_map::NodeImplItem(it)) => impl_item_scope_tag(&it),
                     Some(_) | None => {
                         err.span_note(span, &unknown_scope());
                         return;
@@ -206,19 +206,19 @@ fn explain_span<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>,
 
                 let node = fr.scope.node_id(&self.region_maps);
                 let unknown;
-                let tag = match self.map.find(node) {
-                    Some(ast_map::NodeBlock(_)) |
-                    Some(ast_map::NodeExpr(_)) => "body",
-                    Some(ast_map::NodeItem(it)) => item_scope_tag(&it),
-                    Some(ast_map::NodeTraitItem(it)) => trait_item_scope_tag(&it),
-                    Some(ast_map::NodeImplItem(it)) => impl_item_scope_tag(&it),
+                let tag = match self.hir.find(node) {
+                    Some(hir_map::NodeBlock(_)) |
+                    Some(hir_map::NodeExpr(_)) => "body",
+                    Some(hir_map::NodeItem(it)) => item_scope_tag(&it),
+                    Some(hir_map::NodeTraitItem(it)) => trait_item_scope_tag(&it),
+                    Some(hir_map::NodeImplItem(it)) => impl_item_scope_tag(&it),
 
                     // this really should not happen, but it does:
                     // FIXME(#27942)
                     Some(_) => {
                         unknown = format!("unexpected node ({}) for scope {:?}.  \
                                            Please report a bug.",
-                                          self.map.node_to_string(node), fr.scope);
+                                          self.hir.node_to_string(node), fr.scope);
                         &unknown
                     }
                     None => {
@@ -227,7 +227,7 @@ fn explain_span<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>,
                         &unknown
                     }
                 };
-                let (msg, opt_span) = explain_span(self, tag, self.map.span(node));
+                let (msg, opt_span) = explain_span(self, tag, self.hir.span(node));
                 (format!("{} {}", prefix, msg), opt_span)
             }
 
@@ -467,18 +467,18 @@ fn free_regions_from_same_fn<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>,
                 },
                 _ => return None
             };
-            let parent = tcx.map.get_parent(scope_id);
-            let parent_node = tcx.map.find(parent);
+            let parent = tcx.hir.get_parent(scope_id);
+            let parent_node = tcx.hir.find(parent);
             match parent_node {
                 Some(node) => match node {
-                    ast_map::NodeItem(item) => match item.node {
+                    hir_map::NodeItem(item) => match item.node {
                         hir::ItemFn(..) => {
                             Some(FreeRegionsFromSameFn::new(fr1, fr2, scope_id))
                         },
                         _ => None
                     },
-                    ast_map::NodeImplItem(..) |
-                    ast_map::NodeTraitItem(..) => {
+                    hir_map::NodeImplItem(..) |
+                    hir_map::NodeTraitItem(..) => {
                         Some(FreeRegionsFromSameFn::new(fr1, fr2, scope_id))
                     },
                     _ => None
@@ -1071,13 +1071,13 @@ fn report_processed_errors(&self,
 
     fn give_suggestion(&self, err: &mut DiagnosticBuilder, same_regions: &[SameRegions]) {
         let scope_id = same_regions[0].scope_id;
-        let parent = self.tcx.map.get_parent(scope_id);
-        let parent_node = self.tcx.map.find(parent);
+        let parent = self.tcx.hir.get_parent(scope_id);
+        let parent_node = self.tcx.hir.find(parent);
         let taken = lifetimes_in_scope(self.tcx, scope_id);
         let life_giver = LifeGiver::with_taken(&taken[..]);
         let node_inner = match parent_node {
             Some(ref node) => match *node {
-                ast_map::NodeItem(ref item) => {
+                hir_map::NodeItem(ref item) => {
                     match item.node {
                         hir::ItemFn(ref fn_decl, unsafety, constness, _, ref gen, body) => {
                             Some((fn_decl, gen, unsafety, constness, item.name, item.span, body))
@@ -1085,9 +1085,9 @@ fn give_suggestion(&self, err: &mut DiagnosticBuilder, same_regions: &[SameRegio
                         _ => None,
                     }
                 }
-                ast_map::NodeImplItem(item) => {
-                    let id = self.tcx.map.get_parent(item.id);
-                    if let Some(ast_map::NodeItem(parent_scope)) = self.tcx.map.find(id) {
+                hir_map::NodeImplItem(item) => {
+                    let id = self.tcx.hir.get_parent(item.id);
+                    if let Some(hir_map::NodeItem(parent_scope)) = self.tcx.hir.find(id) {
                         if let hir::ItemImpl(_, _, _, None, _, _) = parent_scope.node {
                             // this impl scope implements a trait, do not recomend
                             // using explicit lifetimes (#37363)
@@ -1106,7 +1106,7 @@ fn give_suggestion(&self, err: &mut DiagnosticBuilder, same_regions: &[SameRegio
                         None
                     }
                 },
-                ast_map::NodeTraitItem(item) => {
+                hir_map::NodeTraitItem(item) => {
                     match item.node {
                         hir::TraitItemKind::Method(ref sig, hir::TraitMethod::Provided(body)) => {
                             Some((&sig.decl,
@@ -1657,7 +1657,7 @@ fn give_expl_lifetime_param(&self,
                                 generics: &hir::Generics,
                                 span: Span,
                                 body: hir::BodyId) {
-        let s = hir::print::to_string(&self.tcx.map, |s| {
+        let s = hir::print::to_string(&self.tcx.hir, |s| {
             use syntax::abi::Abi;
             use syntax::print::pprust::PrintState;
 
@@ -1894,17 +1894,17 @@ fn lifetimes_in_scope<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>,
                                       scope_id: ast::NodeId)
                                       -> Vec<hir::LifetimeDef> {
     let mut taken = Vec::new();
-    let parent = tcx.map.get_parent(scope_id);
-    let method_id_opt = match tcx.map.find(parent) {
+    let parent = tcx.hir.get_parent(scope_id);
+    let method_id_opt = match tcx.hir.find(parent) {
         Some(node) => match node {
-            ast_map::NodeItem(item) => match item.node {
+            hir_map::NodeItem(item) => match item.node {
                 hir::ItemFn(.., ref gen, _) => {
                     taken.extend_from_slice(&gen.lifetimes);
                     None
                 },
                 _ => None
             },
-            ast_map::NodeImplItem(ii) => {
+            hir_map::NodeImplItem(ii) => {
                 match ii.node {
                     hir::ImplItemKind::Method(ref sig, _) => {
                         taken.extend_from_slice(&sig.generics.lifetimes);
@@ -1918,10 +1918,10 @@ fn lifetimes_in_scope<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>,
         None => None
     };
     if let Some(method_id) = method_id_opt {
-        let parent = tcx.map.get_parent(method_id);
-        if let Some(node) = tcx.map.find(parent) {
+        let parent = tcx.hir.get_parent(method_id);
+        if let Some(node) = tcx.hir.find(parent) {
             match node {
-                ast_map::NodeItem(item) => match item.node {
+                hir_map::NodeItem(item) => match item.node {
                     hir::ItemImpl(_, _, ref gen, ..) => {
                         taken.extend_from_slice(&gen.lifetimes);
                     }
index 4e64dda1a3044f619b86c55c25419864ef5ffa26..45a58333f781f1c5b340ae58e2e59df6d2d3436b 100644 (file)
@@ -453,8 +453,8 @@ fn to_parts(self, tcx: TyCtxt<'a, 'tcx, 'tcx>)
                 -> (Option<&'a ty::TypeckTables<'tcx>>,
                     Option<ty::TypeckTables<'tcx>>,
                     Option<ty::ParameterEnvironment<'tcx>>) {
-        let item_id = tcx.map.body_owner(self);
-        (Some(tcx.item_tables(tcx.map.local_def_id(item_id))),
+        let item_id = tcx.hir.body_owner(self);
+        (Some(tcx.item_tables(tcx.hir.local_def_id(item_id))),
          None,
          Some(ty::ParameterEnvironment::for_item(tcx, item_id)))
     }
@@ -1269,7 +1269,7 @@ pub fn node_type(&self, id: ast::NodeId) -> Ty<'tcx> {
                 self.tcx.types.err,
             None => {
                 bug!("no type for node {}: {} in fcx",
-                     id, self.tcx.map.node_to_string(id));
+                     id, self.tcx.hir.node_to_string(id));
             }
         }
     }
@@ -1639,7 +1639,7 @@ pub fn closure_kind(&self,
                         -> Option<ty::ClosureKind>
     {
         if let InferTables::InProgress(tables) = self.tables {
-            if let Some(id) = self.tcx.map.as_local_node_id(def_id) {
+            if let Some(id) = self.tcx.hir.as_local_node_id(def_id) {
                 return tables.borrow().closure_kinds.get(&id).cloned();
             }
         }
@@ -1657,7 +1657,7 @@ pub fn closure_type(&self,
                         -> ty::ClosureTy<'tcx>
     {
         if let InferTables::InProgress(tables) = self.tables {
-            if let Some(id) = self.tcx.map.as_local_node_id(def_id) {
+            if let Some(id) = self.tcx.hir.as_local_node_id(def_id) {
                 if let Some(ty) = tables.borrow().closure_tys.get(&id) {
                     return ty.subst(self.tcx, substs.substs);
                 }
index 5ac000923e071ff4ba86501e0901a9c20ab85acf..3506a9c067ca6ddcce00fb6b3c870ddae5507651 100644 (file)
@@ -768,7 +768,7 @@ impl<'a, 'tcx> hir_visit::Visitor<'tcx> for LateContext<'a, 'tcx> {
     /// items in the context of the outer item, so enable
     /// deep-walking.
     fn nested_visit_map<'this>(&'this mut self) -> hir_visit::NestedVisitorMap<'this, 'tcx> {
-        hir_visit::NestedVisitorMap::All(&self.tcx.map)
+        hir_visit::NestedVisitorMap::All(&self.tcx.hir)
     }
 
     // Output any lints that were previously added to the session.
@@ -784,7 +784,7 @@ fn visit_id(&mut self, id: ast::NodeId) {
     fn visit_nested_body(&mut self, body: hir::BodyId) {
         let old_tables = self.tables;
         self.tables = self.tcx.body_tables(body);
-        let body = self.tcx.map.body(body);
+        let body = self.tcx.hir.body(body);
         self.visit_body(body);
         self.tables = old_tables;
     }
@@ -834,7 +834,7 @@ fn visit_fn(&mut self, fk: hir_visit::FnKind<'tcx>, decl: &'tcx hir::FnDecl,
         // in order for `check_fn` to be able to use them.
         let old_tables = self.tables;
         self.tables = self.tcx.body_tables(body_id);
-        let body = self.tcx.map.body(body_id);
+        let body = self.tcx.hir.body(body_id);
         run_lints!(self, check_fn, late_passes, fk, decl, body, span, id);
         hir_visit::walk_fn(self, fk, decl, body_id, span, id);
         run_lints!(self, check_fn_post, late_passes, fk, decl, body, span, id);
@@ -1206,7 +1206,7 @@ pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
                              access_levels: &AccessLevels) {
     let _task = tcx.dep_graph.in_task(DepNode::LateLintCheck);
 
-    let krate = tcx.map.krate();
+    let krate = tcx.hir.krate();
 
     // We want to own the lint store, so move it out of the session.
     let lint_store = mem::replace(&mut *tcx.sess.lint_store.borrow_mut(), LintStore::new());
@@ -1236,7 +1236,7 @@ pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
         for early_lint in v {
             span_bug!(early_lint.diagnostic.span.clone(),
                       "unprocessed lint {:?} at {}",
-                      early_lint, tcx.map.node_to_string(*id));
+                      early_lint, tcx.hir.node_to_string(*id));
         }
     }
 
index dfcb5cb7b79fee81b4c21224ba1c0ed9c77f7c8d..7d62103e386c41bba88c14f993652d4a04a79370 100644 (file)
@@ -109,7 +109,7 @@ fn has_bitset_for_nodeid(&self, n: ast::NodeId) -> bool {
 
 impl<'a, 'tcx, O:DataFlowOperator> pprust::PpAnn for DataFlowContext<'a, 'tcx, O> {
     fn nested(&self, state: &mut pprust::State, nested: pprust::Nested) -> io::Result<()> {
-        pprust::PpAnn::nested(&self.tcx.map, state, nested)
+        pprust::PpAnn::nested(&self.tcx.hir, state, nested)
     }
     fn pre(&self,
            ps: &mut pprust::State,
index 38fbe650a89bd64b776fc57b5b049a3b92add95d..ae349667f9dc67826d36c80692865dc46a187836 100644 (file)
@@ -13,7 +13,7 @@
 // from live codes are live, and everything else is dead.
 
 use dep_graph::DepNode;
-use hir::map as ast_map;
+use hir::map as hir_map;
 use hir::{self, PatKind};
 use hir::intravisit::{self, Visitor, NestedVisitorMap};
 use hir::itemlikevisit::ItemLikeVisitor;
 // may need to be marked as live.
 fn should_explore<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
                             node_id: ast::NodeId) -> bool {
-    match tcx.map.find(node_id) {
-        Some(ast_map::NodeItem(..)) |
-        Some(ast_map::NodeImplItem(..)) |
-        Some(ast_map::NodeForeignItem(..)) |
-        Some(ast_map::NodeTraitItem(..)) =>
+    match tcx.hir.find(node_id) {
+        Some(hir_map::NodeItem(..)) |
+        Some(hir_map::NodeImplItem(..)) |
+        Some(hir_map::NodeForeignItem(..)) |
+        Some(hir_map::NodeTraitItem(..)) =>
             true,
         _ =>
             false
@@ -59,7 +59,7 @@ struct MarkSymbolVisitor<'a, 'tcx: 'a> {
 
 impl<'a, 'tcx> MarkSymbolVisitor<'a, 'tcx> {
     fn check_def_id(&mut self, def_id: DefId) {
-        if let Some(node_id) = self.tcx.map.as_local_node_id(def_id) {
+        if let Some(node_id) = self.tcx.hir.as_local_node_id(def_id) {
             if should_explore(self.tcx, node_id) {
                 self.worklist.push(node_id);
             }
@@ -68,7 +68,7 @@ fn check_def_id(&mut self, def_id: DefId) {
     }
 
     fn insert_def_id(&mut self, def_id: DefId) {
-        if let Some(node_id) = self.tcx.map.as_local_node_id(def_id) {
+        if let Some(node_id) = self.tcx.hir.as_local_node_id(def_id) {
             debug_assert!(!should_explore(self.tcx, node_id));
             self.live_symbols.insert(node_id);
         }
@@ -143,20 +143,20 @@ fn mark_live_symbols(&mut self) {
             }
             scanned.insert(id);
 
-            if let Some(ref node) = self.tcx.map.find(id) {
+            if let Some(ref node) = self.tcx.hir.find(id) {
                 self.live_symbols.insert(id);
                 self.visit_node(node);
             }
         }
     }
 
-    fn visit_node(&mut self, node: &ast_map::Node<'tcx>) {
+    fn visit_node(&mut self, node: &hir_map::Node<'tcx>) {
         let had_extern_repr = self.struct_has_extern_repr;
         self.struct_has_extern_repr = false;
         let had_inherited_pub_visibility = self.inherited_pub_visibility;
         self.inherited_pub_visibility = false;
         match *node {
-            ast_map::NodeItem(item) => {
+            hir_map::NodeItem(item) => {
                 match item.node {
                     hir::ItemStruct(..) | hir::ItemUnion(..) => {
                         self.struct_has_extern_repr = item.attrs.iter().any(|attr| {
@@ -179,13 +179,13 @@ fn visit_node(&mut self, node: &ast_map::Node<'tcx>) {
                     _ => ()
                 }
             }
-            ast_map::NodeTraitItem(trait_item) => {
+            hir_map::NodeTraitItem(trait_item) => {
                 intravisit::walk_trait_item(self, trait_item);
             }
-            ast_map::NodeImplItem(impl_item) => {
+            hir_map::NodeImplItem(impl_item) => {
                 intravisit::walk_impl_item(self, impl_item);
             }
-            ast_map::NodeForeignItem(foreign_item) => {
+            hir_map::NodeForeignItem(foreign_item) => {
                 intravisit::walk_foreign_item(self, &foreign_item);
             }
             _ => ()
@@ -203,7 +203,7 @@ fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
     fn visit_nested_body(&mut self, body: hir::BodyId) {
         let old_tables = self.tables;
         self.tables = self.tcx.body_tables(body);
-        let body = self.tcx.map.body(body);
+        let body = self.tcx.hir.body(body);
         self.visit_body(body);
         self.tables = old_tables;
     }
@@ -434,7 +434,7 @@ fn should_warn_about_item(&mut self, item: &hir::Item) -> bool {
     }
 
     fn should_warn_about_field(&mut self, field: &hir::StructField) -> bool {
-        let field_type = self.tcx.item_type(self.tcx.map.local_def_id(field.id));
+        let field_type = self.tcx.item_type(self.tcx.hir.local_def_id(field.id));
         let is_marker_field = match field_type.ty_to_def_id() {
             Some(def_id) => self.tcx.lang_items.items().iter().any(|item| *item == Some(def_id)),
             _ => false
@@ -478,10 +478,10 @@ fn symbol_is_live(&mut self,
         // method of a private type is used, but the type itself is never
         // called directly.
         if let Some(impl_list) =
-                self.tcx.inherent_impls.borrow().get(&self.tcx.map.local_def_id(id)) {
+                self.tcx.inherent_impls.borrow().get(&self.tcx.hir.local_def_id(id)) {
             for &impl_did in impl_list.iter() {
                 for &item_did in &self.tcx.associated_item_def_ids(impl_did)[..] {
-                    if let Some(item_node_id) = self.tcx.map.as_local_node_id(item_did) {
+                    if let Some(item_node_id) = self.tcx.hir.as_local_node_id(item_did) {
                         if self.live_symbols.contains(&item_node_id) {
                             return true;
                         }
@@ -514,7 +514,7 @@ impl<'a, 'tcx> Visitor<'tcx> for DeadVisitor<'a, 'tcx> {
     /// an error. We could do this also by checking the parents, but
     /// this is how the code is setup and it seems harmless enough.
     fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
-        NestedVisitorMap::All(&self.tcx.map)
+        NestedVisitorMap::All(&self.tcx.hir)
     }
 
     fn visit_item(&mut self, item: &'tcx hir::Item) {
@@ -596,7 +596,7 @@ fn visit_trait_item(&mut self, trait_item: &'tcx hir::TraitItem) {
 pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
                              access_levels: &privacy::AccessLevels) {
     let _task = tcx.dep_graph.in_task(DepNode::DeadCheck);
-    let krate = tcx.map.krate();
+    let krate = tcx.hir.krate();
     let live_symbols = find_live(tcx, access_levels, krate);
     let mut visitor = DeadVisitor { tcx: tcx, live_symbols: live_symbols };
     intravisit::walk_crate(&mut visitor, krate);
index f90d9143e9d5776ffb7117ec68206327145f222c..ab33c3843aae5d6c0a9a1db6fe8b3726dfc19888 100644 (file)
@@ -101,7 +101,7 @@ fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
     fn visit_nested_body(&mut self, body: hir::BodyId) {
         let old_tables = self.tables;
         self.tables = self.tcx.body_tables(body);
-        let body = self.tcx.map.body(body);
+        let body = self.tcx.hir.body(body);
         self.visit_body(body);
         self.tables = old_tables;
     }
@@ -203,7 +203,7 @@ fn visit_expr(&mut self, expr: &'tcx hir::Expr) {
                 if let Def::Static(def_id, mutbl) = path.def {
                     if mutbl {
                         self.require_unsafe(expr.span, "use of mutable static");
-                    } else if match self.tcx.map.get_if_local(def_id) {
+                    } else if match self.tcx.hir.get_if_local(def_id) {
                         Some(hir::map::NodeForeignItem(..)) => true,
                         Some(..) => false,
                         None => self.tcx.sess.cstore.is_foreign_item(def_id),
@@ -249,5 +249,5 @@ pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
         unsafe_context: UnsafeContext::new(SafeContext),
     };
 
-    tcx.map.krate().visit_all_item_likes(&mut visitor.as_deep_visitor());
+    tcx.hir.krate().visit_all_item_likes(&mut visitor.as_deep_visitor());
 }
index f2e46d4cbc96ba6c0831179db41b23e66e51fd29..ff7adfb327ad45308c3f5c303e079c7d0128da1e 100644 (file)
@@ -10,7 +10,7 @@
 
 
 use dep_graph::DepNode;
-use hir::map as ast_map;
+use hir::map as hir_map;
 use hir::def_id::{CRATE_DEF_INDEX};
 use session::{config, Session};
 use syntax::ast::NodeId;
@@ -23,7 +23,7 @@
 struct EntryContext<'a, 'tcx: 'a> {
     session: &'a Session,
 
-    map: &'a ast_map::Map<'tcx>,
+    map: &'a hir_map::Map<'tcx>,
 
     // The top-level function called 'main'
     main_fn: Option<(NodeId, Span)>,
@@ -56,8 +56,8 @@ fn visit_impl_item(&mut self, _impl_item: &'tcx ImplItem) {
     }
 }
 
-pub fn find_entry_point(session: &Session, ast_map: &ast_map::Map) {
-    let _task = ast_map.dep_graph.in_task(DepNode::EntryPoint);
+pub fn find_entry_point(session: &Session, hir_map: &hir_map::Map) {
+    let _task = hir_map.dep_graph.in_task(DepNode::EntryPoint);
 
     let any_exe = session.crate_types.borrow().iter().any(|ty| {
         *ty == config::CrateTypeExecutable
@@ -68,21 +68,21 @@ pub fn find_entry_point(session: &Session, ast_map: &ast_map::Map) {
     }
 
     // If the user wants no main function at all, then stop here.
-    if attr::contains_name(&ast_map.krate().attrs, "no_main") {
+    if attr::contains_name(&hir_map.krate().attrs, "no_main") {
         session.entry_type.set(Some(config::EntryNone));
         return
     }
 
     let mut ctxt = EntryContext {
         session: session,
-        map: ast_map,
+        map: hir_map,
         main_fn: None,
         attr_main_fn: None,
         start_fn: None,
         non_main_fns: Vec::new(),
     };
 
-    ast_map.krate().visit_all_item_likes(&mut ctxt);
+    hir_map.krate().visit_all_item_likes(&mut ctxt);
 
     configure_main(&mut ctxt);
 }
index 0eacbba3fdd446ec4d100b4c3a7f80b5ec298cb2..738bd0009abae636b395a0c9f6f6ec3b61c035fe 100644 (file)
@@ -1020,7 +1020,7 @@ fn walk_captures(&mut self, closure_expr: &hir::Expr, fn_decl_span: Span) {
         self.tcx().with_freevars(closure_expr.id, |freevars| {
             for freevar in freevars {
                 let def_id = freevar.def.def_id();
-                let id_var = self.tcx().map.as_local_node_id(def_id).unwrap();
+                let id_var = self.tcx().hir.as_local_node_id(def_id).unwrap();
                 let upvar_id = ty::UpvarId { var_id: id_var,
                                              closure_expr_id: closure_expr.id };
                 let upvar_capture = self.mc.infcx.upvar_capture(upvar_id).unwrap();
@@ -1052,7 +1052,7 @@ fn cat_captured_var(&mut self,
                         -> mc::McResult<mc::cmt<'tcx>> {
         // Create the cmt for the variable being borrowed, from the
         // caller's perspective
-        let var_id = self.tcx().map.as_local_node_id(upvar_def.def_id()).unwrap();
+        let var_id = self.tcx().hir.as_local_node_id(upvar_def.def_id()).unwrap();
         let var_ty = self.mc.infcx.node_ty(var_id)?;
         self.mc.cat_def(closure_id, closure_span, var_ty, upvar_def)
     }
index d42b866d47209c5663692c12570a6c78e95158e0..05be35df959915f79434d403ad137ecd4fb84c14 100644 (file)
@@ -110,7 +110,7 @@ fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
     }
 
     fn visit_nested_body(&mut self, body_id: hir::BodyId) {
-        let body = self.tcx.map.body(body_id);
+        let body = self.tcx.hir.body(body_id);
         self.tcx.infer_ctxt(body_id, Reveal::All).enter(|infcx| {
             let mut visitor = ExprVisitor {
                 infcx: &infcx
index cd7859af8ee7b526a96e1d1776d4ef4a3641f89a..b9f1611f62bafd2344a8291bd02c820949f0de51 100644 (file)
@@ -117,7 +117,7 @@ pub fn $method(&self) -> Option<DefId> {
 struct LanguageItemCollector<'a, 'tcx: 'a> {
     items: LanguageItems,
 
-    ast_map: &'a hir_map::Map<'tcx>,
+    hir_map: &'a hir_map::Map<'tcx>,
 
     session: &'a Session,
 
@@ -130,9 +130,9 @@ fn visit_item(&mut self, item: &hir::Item) {
             let item_index = self.item_refs.get(&*value.as_str()).cloned();
 
             if let Some(item_index) = item_index {
-                self.collect_item(item_index, self.ast_map.local_def_id(item.id))
+                self.collect_item(item_index, self.hir_map.local_def_id(item.id))
             } else {
-                let span = self.ast_map.span(item.id);
+                let span = self.hir_map.span(item.id);
                 span_err!(self.session, span, E0522,
                           "definition of an unknown language item: `{}`.",
                           value);
@@ -150,7 +150,7 @@ fn visit_impl_item(&mut self, _impl_item: &hir::ImplItem) {
 }
 
 impl<'a, 'tcx> LanguageItemCollector<'a, 'tcx> {
-    pub fn new(session: &'a Session, ast_map: &'a hir_map::Map<'tcx>)
+    pub fn new(session: &'a Session, hir_map: &'a hir_map::Map<'tcx>)
                -> LanguageItemCollector<'a, 'tcx> {
         let mut item_refs = FxHashMap();
 
@@ -158,7 +158,7 @@ pub fn new(session: &'a Session, ast_map: &'a hir_map::Map<'tcx>)
 
         LanguageItemCollector {
             session: session,
-            ast_map: ast_map,
+            hir_map: hir_map,
             items: LanguageItems::new(),
             item_refs: item_refs,
         }
@@ -171,7 +171,7 @@ pub fn collect_item(&mut self, item_index: usize,
             Some(original_def_id) if original_def_id != item_def_id => {
                 let cstore = &self.session.cstore;
                 let name = LanguageItems::item_name(item_index);
-                let mut err = match self.ast_map.span_if_local(item_def_id) {
+                let mut err = match self.hir_map.span_if_local(item_def_id) {
                     Some(span) => struct_span_err!(
                         self.session,
                         span,
@@ -183,7 +183,7 @@ pub fn collect_item(&mut self, item_index: usize,
                             cstore.crate_name(item_def_id.krate),
                             name)),
                 };
-                if let Some(span) = self.ast_map.span_if_local(original_def_id) {
+                if let Some(span) = self.hir_map.span_if_local(original_def_id) {
                     span_note!(&mut err, span,
                                "first defined here.");
                 } else {
index e0521f98416bc02a6a989139efc99c00302bc2f3..7fa3365694c269967868deb358faa7be9bd75250 100644 (file)
@@ -183,7 +183,7 @@ fn live_node_kind_to_string(lnk: LiveNodeKind, tcx: TyCtxt) -> String {
 
 impl<'a, 'tcx> Visitor<'tcx> for IrMaps<'a, 'tcx> {
     fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
-        NestedVisitorMap::OnlyBodies(&self.tcx.map)
+        NestedVisitorMap::OnlyBodies(&self.tcx.hir)
     }
 
     fn visit_fn(&mut self, fk: FnKind<'tcx>, fd: &'tcx hir::FnDecl,
@@ -197,7 +197,7 @@ fn visit_fn(&mut self, fk: FnKind<'tcx>, fd: &'tcx hir::FnDecl,
 
 pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
     let _task = tcx.dep_graph.in_task(DepNode::Liveness);
-    tcx.map.krate().visit_all_item_likes(&mut IrMaps::new(tcx).as_deep_visitor());
+    tcx.hir.krate().visit_all_item_likes(&mut IrMaps::new(tcx).as_deep_visitor());
     tcx.sess.abort_if_errors();
 }
 
@@ -364,7 +364,7 @@ fn visit_fn<'a, 'tcx: 'a>(ir: &mut IrMaps<'a, 'tcx>,
 
     debug!("creating fn_maps: {:?}", &fn_maps as *const IrMaps);
 
-    let body = ir.tcx.map.body(body_id);
+    let body = ir.tcx.hir.body(body_id);
 
     for arg in &body.arguments {
         arg.pat.each_binding(|_bm, arg_id, _x, path1| {
@@ -440,7 +440,7 @@ fn visit_expr<'a, 'tcx>(ir: &mut IrMaps<'a, 'tcx>, expr: &'tcx Expr) {
         ir.tcx.with_freevars(expr.id, |freevars| {
             for fv in freevars {
                 if let Def::Local(def_id) = fv.def {
-                    let rv = ir.tcx.map.as_local_node_id(def_id).unwrap();
+                    let rv = ir.tcx.hir.as_local_node_id(def_id).unwrap();
                     let fv_ln = ir.add_live_node(FreeVarNode(fv.span));
                     call_caps.push(CaptureInfo {ln: fv_ln,
                                                 var_nid: rv});
@@ -807,7 +807,7 @@ fn compute(&mut self, body: &hir::Expr) -> LiveNode {
         // effectively a return---this only occurs in `for` loops,
         // where the body is really a closure.
 
-        debug!("compute: using id for body, {}", self.ir.tcx.map.node_to_pretty_string(body.id));
+        debug!("compute: using id for body, {}", self.ir.tcx.hir.node_to_pretty_string(body.id));
 
         let exit_ln = self.s.exit_ln;
         let entry_ln: LiveNode = self.with_loop_nodes(body.id, exit_ln, exit_ln, |this| {
@@ -900,7 +900,7 @@ fn propagate_through_opt_expr(&mut self,
 
     fn propagate_through_expr(&mut self, expr: &Expr, succ: LiveNode)
                               -> LiveNode {
-        debug!("propagate_through_expr: {}", self.ir.tcx.map.node_to_pretty_string(expr.id));
+        debug!("propagate_through_expr: {}", self.ir.tcx.hir.node_to_pretty_string(expr.id));
 
         match expr.node {
           // Interesting cases with control flow or which gen/kill
@@ -919,7 +919,7 @@ fn propagate_through_expr(&mut self, expr: &Expr, succ: LiveNode)
 
           hir::ExprClosure(.., blk_id, _) => {
               debug!("{} is an ExprClosure",
-                     self.ir.tcx.map.node_to_pretty_string(expr.id));
+                     self.ir.tcx.hir.node_to_pretty_string(expr.id));
 
               /*
               The next-node for a break is the successor of the entire
@@ -1241,7 +1241,7 @@ fn access_path(&mut self, id: NodeId, path: &hir::Path, succ: LiveNode, acc: u32
                    -> LiveNode {
         match path.def {
           Def::Local(def_id) => {
-            let nid = self.ir.tcx.map.as_local_node_id(def_id).unwrap();
+            let nid = self.ir.tcx.hir.as_local_node_id(def_id).unwrap();
             let ln = self.live_node(id, path.span);
             if acc != 0 {
                 self.init_from_succ(ln, succ);
@@ -1295,7 +1295,7 @@ fn propagate_through_loop(&mut self,
             }
         }
         debug!("propagate_through_loop: using id for loop body {} {}",
-               expr.id, self.ir.tcx.map.node_to_pretty_string(body.id));
+               expr.id, self.ir.tcx.hir.node_to_pretty_string(body.id));
 
         let cond_ln = match kind {
             LoopLoop => ln,
@@ -1440,7 +1440,7 @@ fn check_ret(&self,
                  entry_ln: LiveNode,
                  body: &hir::Body)
     {
-        let fn_ty = self.ir.tcx.item_type(self.ir.tcx.map.local_def_id(id));
+        let fn_ty = self.ir.tcx.item_type(self.ir.tcx.hir.local_def_id(id));
         let fn_ret = match fn_ty.sty {
             ty::TyClosure(closure_def_id, substs) =>
                 self.ir.tcx.closure_type(closure_def_id, substs).sig.output(),
@@ -1477,7 +1477,7 @@ fn check_lvalue(&mut self, expr: &'tcx Expr) {
                     // if there is no later assignment. If this local is actually
                     // mutable, then check for a reassignment to flag the mutability
                     // as being used.
-                    let nid = self.ir.tcx.map.as_local_node_id(def_id).unwrap();
+                    let nid = self.ir.tcx.hir.as_local_node_id(def_id).unwrap();
                     let ln = self.live_node(expr.id, expr.span);
                     let var = self.variable(nid, expr.span);
                     self.warn_about_dead_assign(expr.span, expr.id, ln, var);
index 92e69d7d729578092ed1b927f5ffd1a31ae42db3..126d43aa6900e79b87eb24c6e15420b88121819f 100644 (file)
@@ -71,7 +71,7 @@
 use self::Aliasability::*;
 
 use hir::def_id::DefId;
-use hir::map as ast_map;
+use hir::map as hir_map;
 use infer::InferCtxt;
 use hir::def::{Def, CtorKind};
 use ty::adjustment;
@@ -268,8 +268,8 @@ fn from_pointer_kind(base_mutbl: MutabilityCategory,
     }
 
     fn from_local(tcx: TyCtxt, id: ast::NodeId) -> MutabilityCategory {
-        let ret = match tcx.map.get(id) {
-            ast_map::NodeLocal(p) => match p.node {
+        let ret = match tcx.hir.get(id) {
+            hir_map::NodeLocal(p) => match p.node {
                 PatKind::Binding(bind_mode, ..) => {
                     if bind_mode == hir::BindByValue(hir::MutMutable) {
                         McDeclared
@@ -279,7 +279,7 @@ fn from_local(tcx: TyCtxt, id: ast::NodeId) -> MutabilityCategory {
                 }
                 _ => span_bug!(p.span, "expected identifier pattern")
             },
-            _ => span_bug!(tcx.map.span(id), "expected identifier pattern")
+            _ => span_bug!(tcx.hir.span(id), "expected identifier pattern")
         };
         debug!("MutabilityCategory::{}(tcx, id={:?}) => {:?}",
                "from_local", id, ret);
@@ -539,7 +539,7 @@ pub fn cat_def(&self,
           }
 
           Def::Upvar(def_id, _, fn_node_id) => {
-              let var_id = self.tcx().map.as_local_node_id(def_id).unwrap();
+              let var_id = self.tcx().hir.as_local_node_id(def_id).unwrap();
               let ty = self.node_ty(fn_node_id)?;
               match ty.sty {
                   ty::TyClosure(closure_id, _) => {
@@ -576,7 +576,7 @@ pub fn cat_def(&self,
           }
 
           Def::Local(def_id) => {
-            let vid = self.tcx().map.as_local_node_id(def_id).unwrap();
+            let vid = self.tcx().hir.as_local_node_id(def_id).unwrap();
             Ok(Rc::new(cmt_ {
                 id: id,
                 span: span,
@@ -698,8 +698,8 @@ fn env_deref(&self,
         // Look up the node ID of the closure body so we can construct
         // a free region within it
         let fn_body_id = {
-            let fn_expr = match self.tcx().map.find(upvar_id.closure_expr_id) {
-                Some(ast_map::NodeExpr(e)) => e,
+            let fn_expr = match self.tcx().hir.find(upvar_id.closure_expr_id) {
+                Some(hir_map::NodeExpr(e)) => e,
                 _ => bug!()
             };
 
@@ -1313,7 +1313,7 @@ pub fn descriptive_string(&self, tcx: TyCtxt) -> String {
                 "non-lvalue".to_string()
             }
             Categorization::Local(vid) => {
-                if tcx.map.is_argument(vid) {
+                if tcx.hir.is_argument(vid) {
                     "argument".to_string()
                 } else {
                     "local variable".to_string()
index 385dd3d9bf764a98b7e320453a9a62ee02a7a349..4ec43e368a60dc9036e7ca96c9675ecbd3612c2e 100644 (file)
@@ -16,7 +16,7 @@
 // reachable as well.
 
 use dep_graph::DepNode;
-use hir::map as ast_map;
+use hir::map as hir_map;
 use hir::def::Def;
 use hir::def_id::DefId;
 use ty::{self, TyCtxt};
@@ -63,9 +63,9 @@ fn method_might_be_inlined<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
         generics_require_inlining(&sig.generics) {
         return true
     }
-    if let Some(impl_node_id) = tcx.map.as_local_node_id(impl_src) {
-        match tcx.map.find(impl_node_id) {
-            Some(ast_map::NodeItem(item)) =>
+    if let Some(impl_node_id) = tcx.hir.as_local_node_id(impl_src) {
+        match tcx.hir.find(impl_node_id) {
+            Some(hir_map::NodeItem(item)) =>
                 item_might_be_inlined(&item),
             Some(..) | None =>
                 span_bug!(impl_item.span, "impl did is not an item")
@@ -97,7 +97,7 @@ fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
     fn visit_nested_body(&mut self, body: hir::BodyId) {
         let old_tables = self.tables;
         self.tables = self.tcx.body_tables(body);
-        let body = self.tcx.map.body(body);
+        let body = self.tcx.hir.body(body);
         self.visit_body(body);
         self.tables = old_tables;
     }
@@ -117,7 +117,7 @@ fn visit_expr(&mut self, expr: &'tcx hir::Expr) {
 
         if let Some(def) = def {
             let def_id = def.def_id();
-            if let Some(node_id) = self.tcx.map.as_local_node_id(def_id) {
+            if let Some(node_id) = self.tcx.hir.as_local_node_id(def_id) {
                 if self.def_id_represents_local_inlined_item(def_id) {
                     self.worklist.push(node_id);
                 } else {
@@ -147,19 +147,19 @@ impl<'a, 'tcx> ReachableContext<'a, 'tcx> {
     // Returns true if the given def ID represents a local item that is
     // eligible for inlining and false otherwise.
     fn def_id_represents_local_inlined_item(&self, def_id: DefId) -> bool {
-        let node_id = match self.tcx.map.as_local_node_id(def_id) {
+        let node_id = match self.tcx.hir.as_local_node_id(def_id) {
             Some(node_id) => node_id,
             None => { return false; }
         };
 
-        match self.tcx.map.find(node_id) {
-            Some(ast_map::NodeItem(item)) => {
+        match self.tcx.hir.find(node_id) {
+            Some(hir_map::NodeItem(item)) => {
                 match item.node {
                     hir::ItemFn(..) => item_might_be_inlined(&item),
                     _ => false,
                 }
             }
-            Some(ast_map::NodeTraitItem(trait_method)) => {
+            Some(hir_map::NodeTraitItem(trait_method)) => {
                 match trait_method.node {
                     hir::TraitItemKind::Const(_, ref default) => default.is_some(),
                     hir::TraitItemKind::Method(_, hir::TraitMethod::Provided(_)) => true,
@@ -167,7 +167,7 @@ fn def_id_represents_local_inlined_item(&self, def_id: DefId) -> bool {
                     hir::TraitItemKind::Type(..) => false,
                 }
             }
-            Some(ast_map::NodeImplItem(impl_item)) => {
+            Some(hir_map::NodeImplItem(impl_item)) => {
                 match impl_item.node {
                     hir::ImplItemKind::Const(..) => true,
                     hir::ImplItemKind::Method(ref sig, _) => {
@@ -176,13 +176,13 @@ fn def_id_represents_local_inlined_item(&self, def_id: DefId) -> bool {
                             true
                         } else {
                             let impl_did = self.tcx
-                                               .map
+                                               .hir
                                                .get_parent_did(node_id);
                             // Check the impl. If the generics on the self
                             // type of the impl require inlining, this method
                             // does too.
-                            let impl_node_id = self.tcx.map.as_local_node_id(impl_did).unwrap();
-                            match self.tcx.map.expect_item(impl_node_id).node {
+                            let impl_node_id = self.tcx.hir.as_local_node_id(impl_did).unwrap();
+                            match self.tcx.hir.expect_item(impl_node_id).node {
                                 hir::ItemImpl(_, _, ref generics, ..) => {
                                     generics_require_inlining(generics)
                                 }
@@ -210,18 +210,18 @@ fn propagate(&mut self) {
                 continue
             }
 
-            if let Some(ref item) = self.tcx.map.find(search_item) {
+            if let Some(ref item) = self.tcx.hir.find(search_item) {
                 self.propagate_node(item, search_item);
             }
         }
     }
 
-    fn propagate_node(&mut self, node: &ast_map::Node<'tcx>,
+    fn propagate_node(&mut self, node: &hir_map::Node<'tcx>,
                       search_item: ast::NodeId) {
         if !self.any_library {
             // If we are building an executable, only explicitly extern
             // types need to be exported.
-            if let ast_map::NodeItem(item) = *node {
+            if let hir_map::NodeItem(item) = *node {
                 let reachable = if let hir::ItemFn(.., abi, _, _) = item.node {
                     abi != Abi::Rust
                 } else {
@@ -242,7 +242,7 @@ fn propagate_node(&mut self, node: &ast_map::Node<'tcx>,
         }
 
         match *node {
-            ast_map::NodeItem(item) => {
+            hir_map::NodeItem(item) => {
                 match item.node {
                     hir::ItemFn(.., body) => {
                         if item_might_be_inlined(&item) {
@@ -268,7 +268,7 @@ fn propagate_node(&mut self, node: &ast_map::Node<'tcx>,
                     hir::ItemUnion(..) | hir::ItemDefaultImpl(..) => {}
                 }
             }
-            ast_map::NodeTraitItem(trait_method) => {
+            hir_map::NodeTraitItem(trait_method) => {
                 match trait_method.node {
                     hir::TraitItemKind::Const(_, None) |
                     hir::TraitItemKind::Method(_, hir::TraitMethod::Required(_)) => {
@@ -281,13 +281,13 @@ fn propagate_node(&mut self, node: &ast_map::Node<'tcx>,
                     hir::TraitItemKind::Type(..) => {}
                 }
             }
-            ast_map::NodeImplItem(impl_item) => {
+            hir_map::NodeImplItem(impl_item) => {
                 match impl_item.node {
                     hir::ImplItemKind::Const(_, body) => {
                         self.visit_nested_body(body);
                     }
                     hir::ImplItemKind::Method(ref sig, body) => {
-                        let did = self.tcx.map.get_parent_did(search_item);
+                        let did = self.tcx.hir.get_parent_did(search_item);
                         if method_might_be_inlined(self.tcx, sig, impl_item, did) {
                             self.visit_nested_body(body)
                         }
@@ -296,14 +296,14 @@ fn propagate_node(&mut self, node: &ast_map::Node<'tcx>,
                 }
             }
             // Nothing to recurse on for these
-            ast_map::NodeForeignItem(_) |
-            ast_map::NodeVariant(_) |
-            ast_map::NodeStructCtor(_) |
-            ast_map::NodeField(_) |
-            ast_map::NodeTy(_) => {}
+            hir_map::NodeForeignItem(_) |
+            hir_map::NodeVariant(_) |
+            hir_map::NodeStructCtor(_) |
+            hir_map::NodeField(_) |
+            hir_map::NodeTy(_) => {}
             _ => {
                 bug!("found unexpected thingy in worklist: {}",
-                     self.tcx.map.node_to_string(search_item))
+                     self.tcx.hir.node_to_string(search_item))
             }
         }
     }
@@ -343,7 +343,7 @@ fn visit_item(&mut self, item: &hir::Item) {
 
                 for default_method in self.tcx.provided_trait_methods(trait_def_id) {
                     let node_id = self.tcx
-                                      .map
+                                      .hir
                                       .as_local_node_id(default_method.def_id)
                                       .unwrap();
                     self.worklist.push(node_id);
@@ -386,7 +386,7 @@ pub fn find_reachable<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
     }
     for item in tcx.lang_items.items().iter() {
         if let Some(did) = *item {
-            if let Some(node_id) = tcx.map.as_local_node_id(did) {
+            if let Some(node_id) = tcx.hir.as_local_node_id(did) {
                 reachable_context.worklist.push(node_id);
             }
         }
@@ -397,7 +397,7 @@ pub fn find_reachable<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
             access_levels: access_levels,
             worklist: &mut reachable_context.worklist,
         };
-        tcx.map.krate().visit_all_item_likes(&mut collect_private_impl_items);
+        tcx.hir.krate().visit_all_item_likes(&mut collect_private_impl_items);
     }
 
     // Step 2: Mark all symbols that the symbols on the worklist touch.
index faf4a448b7a84e5b20ea8d0ba53384044bc74a78..7337c03795b6d4a006e762027b009d80daa8c398 100644 (file)
@@ -17,7 +17,7 @@
 //! `middle/infer/region_inference/README.md`
 
 use dep_graph::DepNode;
-use hir::map as ast_map;
+use hir::map as hir_map;
 use session::Session;
 use util::nodemap::{FxHashMap, NodeMap, NodeSet};
 use ty;
@@ -217,9 +217,9 @@ pub fn node_id(&self, region_maps: &RegionMaps) -> ast::NodeId {
     /// Returns the span of this CodeExtent.  Note that in general the
     /// returned span may not correspond to the span of any node id in
     /// the AST.
-    pub fn span(&self, region_maps: &RegionMaps, ast_map: &ast_map::Map) -> Option<Span> {
-        match ast_map.find(self.node_id(region_maps)) {
-            Some(ast_map::NodeBlock(ref blk)) => {
+    pub fn span(&self, region_maps: &RegionMaps, hir_map: &hir_map::Map) -> Option<Span> {
+        match hir_map.find(self.node_id(region_maps)) {
+            Some(hir_map::NodeBlock(ref blk)) => {
                 match region_maps.code_extent_data(*self) {
                     CodeExtentData::CallSiteScope { .. } |
                     CodeExtentData::ParameterScope { .. } |
@@ -240,9 +240,9 @@ pub fn span(&self, region_maps: &RegionMaps, ast_map: &ast_map::Map) -> Option<S
                     }
                 }
             }
-            Some(ast_map::NodeExpr(ref expr)) => Some(expr.span),
-            Some(ast_map::NodeStmt(ref stmt)) => Some(stmt.span),
-            Some(ast_map::NodeItem(ref item)) => Some(item.span),
+            Some(hir_map::NodeExpr(ref expr)) => Some(expr.span),
+            Some(hir_map::NodeStmt(ref stmt)) => Some(stmt.span),
+            Some(hir_map::NodeItem(ref item)) => Some(item.span),
             Some(_) | None => None,
          }
     }
@@ -302,7 +302,7 @@ pub struct Context {
     parent: CodeExtent
 }
 
-struct RegionResolutionVisitor<'ast: 'a, 'a> {
+struct RegionResolutionVisitor<'hir: 'a, 'a> {
     sess: &'a Session,
 
     // Generated maps:
@@ -310,7 +310,7 @@ struct RegionResolutionVisitor<'ast: 'a, 'a> {
 
     cx: Context,
 
-    map: &'a ast_map::Map<'ast>,
+    map: &'a hir_map::Map<'hir>,
 
     /// `terminating_scopes` is a set containing the ids of each
     /// statement, or conditional/repeating expression. These scopes
@@ -1137,7 +1137,7 @@ fn resolve_fn<'a, 'tcx>(visitor: &mut RegionResolutionVisitor<'tcx, 'a>,
     visitor.terminating_scopes = outer_ts;
 }
 
-impl<'ast, 'a> RegionResolutionVisitor<'ast, 'a> {
+impl<'hir, 'a> RegionResolutionVisitor<'hir, 'a> {
     /// Records the current parent (if any) as the parent of `child_scope`.
     fn new_code_extent(&mut self, child_scope: CodeExtentData) -> CodeExtent {
         self.region_maps.intern_code_extent(child_scope, self.cx.parent)
@@ -1173,49 +1173,49 @@ fn create_item_scope_if_needed(&mut self, id: ast::NodeId) {
     }
 }
 
-impl<'ast, 'a> Visitor<'ast> for RegionResolutionVisitor<'ast, 'a> {
-    fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'ast> {
+impl<'hir, 'a> Visitor<'hir> for RegionResolutionVisitor<'hir, 'a> {
+    fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'hir> {
         NestedVisitorMap::OnlyBodies(&self.map)
     }
 
-    fn visit_block(&mut self, b: &'ast Block) {
+    fn visit_block(&mut self, b: &'hir Block) {
         resolve_block(self, b);
     }
 
-    fn visit_item(&mut self, i: &'ast Item) {
+    fn visit_item(&mut self, i: &'hir Item) {
         resolve_item_like(self, i.id, |this| intravisit::walk_item(this, i));
     }
 
-    fn visit_impl_item(&mut self, ii: &'ast hir::ImplItem) {
+    fn visit_impl_item(&mut self, ii: &'hir hir::ImplItem) {
         resolve_item_like(self, ii.id, |this| intravisit::walk_impl_item(this, ii));
     }
 
-    fn visit_trait_item(&mut self, ti: &'ast hir::TraitItem) {
+    fn visit_trait_item(&mut self, ti: &'hir hir::TraitItem) {
         resolve_item_like(self, ti.id, |this| intravisit::walk_trait_item(this, ti));
     }
 
-    fn visit_fn(&mut self, fk: FnKind<'ast>, fd: &'ast FnDecl,
+    fn visit_fn(&mut self, fk: FnKind<'hir>, fd: &'hir FnDecl,
                 b: hir::BodyId, s: Span, n: NodeId) {
         resolve_fn(self, fk, fd, b, s, n);
     }
-    fn visit_arm(&mut self, a: &'ast Arm) {
+    fn visit_arm(&mut self, a: &'hir Arm) {
         resolve_arm(self, a);
     }
-    fn visit_pat(&mut self, p: &'ast Pat) {
+    fn visit_pat(&mut self, p: &'hir Pat) {
         resolve_pat(self, p);
     }
-    fn visit_stmt(&mut self, s: &'ast Stmt) {
+    fn visit_stmt(&mut self, s: &'hir Stmt) {
         resolve_stmt(self, s);
     }
-    fn visit_expr(&mut self, ex: &'ast Expr) {
+    fn visit_expr(&mut self, ex: &'hir Expr) {
         resolve_expr(self, ex);
     }
-    fn visit_local(&mut self, l: &'ast Local) {
+    fn visit_local(&mut self, l: &'hir Local) {
         resolve_local(self, l);
     }
 }
 
-pub fn resolve_crate(sess: &Session, map: &ast_map::Map) -> RegionMaps {
+pub fn resolve_crate(sess: &Session, map: &hir_map::Map) -> RegionMaps {
     let _task = map.dep_graph.in_task(DepNode::RegionResolveCrate);
     let krate = map.krate();
 
index e6c9d2c36d013fa9d9677e260534b0148605d1be..487e13b47fec2755effb15a351d6cd056cd592ad 100644 (file)
@@ -178,7 +178,7 @@ fn annotate<F>(&mut self, id: NodeId, attrs: &[Attribute],
                     }
                 }
 
-                let def_id = self.tcx.map.local_def_id(id);
+                let def_id = self.tcx.hir.local_def_id(id);
                 self.index.stab_map.insert(def_id, Some(stab));
 
                 let orig_parent_stab = replace(&mut self.parent_stab, Some(stab));
@@ -188,7 +188,7 @@ fn annotate<F>(&mut self, id: NodeId, attrs: &[Attribute],
                 debug!("annotate: not found, parent = {:?}", self.parent_stab);
                 if let Some(stab) = self.parent_stab {
                     if stab.level.is_unstable() {
-                        let def_id = self.tcx.map.local_def_id(id);
+                        let def_id = self.tcx.hir.local_def_id(id);
                         self.index.stab_map.insert(def_id, Some(stab));
                     }
                 }
@@ -211,7 +211,7 @@ fn annotate<F>(&mut self, id: NodeId, attrs: &[Attribute],
                 }
 
                 // `Deprecation` is just two pointers, no need to intern it
-                let def_id = self.tcx.map.local_def_id(id);
+                let def_id = self.tcx.hir.local_def_id(id);
                 let depr_entry = Some(DeprecationEntry::local(depr, def_id));
                 self.index.depr_map.insert(def_id, depr_entry.clone());
 
@@ -219,7 +219,7 @@ fn annotate<F>(&mut self, id: NodeId, attrs: &[Attribute],
                 visit_children(self);
                 self.parent_depr = orig_parent_depr;
             } else if let parent_depr @ Some(_) = self.parent_depr.clone() {
-                let def_id = self.tcx.map.local_def_id(id);
+                let def_id = self.tcx.hir.local_def_id(id);
                 self.index.depr_map.insert(def_id, parent_depr);
                 visit_children(self);
             } else {
@@ -234,7 +234,7 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> {
     /// nested items in the context of the outer item, so enable
     /// deep-walking.
     fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
-        NestedVisitorMap::All(&self.tcx.map)
+        NestedVisitorMap::All(&self.tcx.hir)
     }
 
     fn visit_item(&mut self, i: &'tcx Item) {
@@ -313,7 +313,7 @@ struct MissingStabilityAnnotations<'a, 'tcx: 'a> {
 
 impl<'a, 'tcx: 'a> MissingStabilityAnnotations<'a, 'tcx> {
     fn check_missing_stability(&self, id: NodeId, span: Span) {
-        let def_id = self.tcx.map.local_def_id(id);
+        let def_id = self.tcx.hir.local_def_id(id);
         let is_error = !self.tcx.sess.opts.test &&
                         !self.tcx.stability.borrow().stab_map.contains_key(&def_id) &&
                         self.access_levels.is_reachable(id);
@@ -325,7 +325,7 @@ fn check_missing_stability(&self, id: NodeId, span: Span) {
 
 impl<'a, 'tcx> Visitor<'tcx> for MissingStabilityAnnotations<'a, 'tcx> {
     fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
-        NestedVisitorMap::OnlyBodies(&self.tcx.map)
+        NestedVisitorMap::OnlyBodies(&self.tcx.hir)
     }
 
     fn visit_item(&mut self, i: &'tcx Item) {
@@ -348,7 +348,7 @@ fn visit_trait_item(&mut self, ti: &'tcx hir::TraitItem) {
     }
 
     fn visit_impl_item(&mut self, ii: &'tcx hir::ImplItem) {
-        let impl_def_id = self.tcx.map.local_def_id(self.tcx.map.get_parent(ii.id));
+        let impl_def_id = self.tcx.hir.local_def_id(self.tcx.hir.get_parent(ii.id));
         if self.tcx.impl_trait_ref(impl_def_id).is_none() {
             self.check_missing_stability(ii.id, ii.span);
         }
@@ -384,7 +384,7 @@ pub fn build(&mut self, tcx: TyCtxt<'a, 'tcx, 'tcx>) {
         self.active_features = active_lib_features.iter().map(|&(ref s, _)| s.clone()).collect();
 
         let _task = tcx.dep_graph.in_task(DepNode::StabilityIndex);
-        let krate = tcx.map.krate();
+        let krate = tcx.hir.krate();
         let mut annotator = Annotator {
             tcx: tcx,
             index: self,
@@ -484,7 +484,7 @@ pub fn check_stability(self, def_id: DefId, id: NodeId, span: Span) {
             let skip = if id == ast::DUMMY_NODE_ID {
                 true
             } else {
-                let parent_def_id = self.map.local_def_id(self.map.get_parent(id));
+                let parent_def_id = self.hir.local_def_id(self.hir.get_parent(id));
                 self.lookup_deprecation_entry(parent_def_id).map_or(false, |parent_depr| {
                     parent_depr.same_origin(&depr_entry)
                 })
@@ -555,7 +555,7 @@ impl<'a, 'tcx> Visitor<'tcx> for Checker<'a, 'tcx> {
     /// nested items in the context of the outer item, so enable
     /// deep-walking.
     fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
-        NestedVisitorMap::OnlyBodies(&self.tcx.map)
+        NestedVisitorMap::OnlyBodies(&self.tcx.hir)
     }
 
     fn visit_item(&mut self, item: &'tcx hir::Item) {
@@ -578,7 +578,7 @@ fn visit_item(&mut self, item: &'tcx hir::Item) {
             hir::ItemImpl(.., Some(ref t), _, ref impl_item_refs) => {
                 if let Def::Trait(trait_did) = t.path.def {
                     for impl_item_ref in impl_item_refs {
-                        let impl_item = self.tcx.map.impl_item(impl_item_ref.id);
+                        let impl_item = self.tcx.hir.impl_item(impl_item_ref.id);
                         let trait_item_def_id = self.tcx.associated_items(trait_did)
                             .find(|item| item.name == impl_item.name).map(|item| item.def_id);
                         if let Some(def_id) = trait_item_def_id {
@@ -658,7 +658,7 @@ pub fn check_unused_or_stable_features<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
 
     if tcx.stability.borrow().staged_api[&LOCAL_CRATE] && tcx.sess.features.borrow().staged_api {
         let _task = tcx.dep_graph.in_task(DepNode::StabilityIndex);
-        let krate = tcx.map.krate();
+        let krate = tcx.hir.krate();
         let mut missing = MissingStabilityAnnotations {
             tcx: tcx,
             access_levels: access_levels,
index 5bae0e347f7c40cc7369070d2bbd773735f55325..6e9091cf31728cef9f5f7d1a31ebcebdbfd9b37c 100644 (file)
@@ -1163,14 +1163,14 @@ fn fmt_tuple(fmt: &mut Formatter, lvs: &[Operand]) -> fmt::Result {
                     }
 
                     AggregateKind::Closure(def_id, _) => ty::tls::with(|tcx| {
-                        if let Some(node_id) = tcx.map.as_local_node_id(def_id) {
-                            let name = format!("[closure@{:?}]", tcx.map.span(node_id));
+                        if let Some(node_id) = tcx.hir.as_local_node_id(def_id) {
+                            let name = format!("[closure@{:?}]", tcx.hir.span(node_id));
                             let mut struct_fmt = fmt.debug_struct(&name);
 
                             tcx.with_freevars(node_id, |freevars| {
                                 for (freevar, lv) in freevars.iter().zip(lvs) {
                                     let def_id = freevar.def.def_id();
-                                    let var_id = tcx.map.as_local_node_id(def_id).unwrap();
+                                    let var_id = tcx.hir.as_local_node_id(def_id).unwrap();
                                     let var_name = tcx.local_var_name_str(var_id);
                                     struct_fmt.field(&var_name, lv);
                                 }
index 3c5a91f4ff04c8dae35599a94bbf7d9964032d2e..652fef76f288a486b6ab6df8ef82bd4c15c1f16a 100644 (file)
@@ -40,13 +40,13 @@ pub fn from_node(tcx: TyCtxt<'a, 'tcx, 'tcx>, id: NodeId) -> MirSource {
         use hir::*;
 
         // Handle constants in enum discriminants, types, and repeat expressions.
-        let def_id = tcx.map.local_def_id(id);
+        let def_id = tcx.hir.local_def_id(id);
         let def_key = tcx.def_key(def_id);
         if def_key.disambiguated_data.data == DefPathData::Initializer {
             return MirSource::Const(id);
         }
 
-        match tcx.map.get(id) {
+        match tcx.hir.get(id) {
             map::NodeItem(&Item { node: ItemConst(..), .. }) |
             map::NodeTraitItem(&TraitItem { node: TraitItemKind::Const(..), .. }) |
             map::NodeImplItem(&ImplItem { node: ImplItemKind::Const(..), .. }) => {
@@ -124,7 +124,7 @@ fn run_pass<'a>(&mut self,
             let mir = &mut tcx.mir_map.borrow()[&def_id].borrow_mut();
             tcx.dep_graph.write(DepNode::Mir(def_id));
 
-            let id = tcx.map.as_local_node_id(def_id).unwrap();
+            let id = tcx.hir.as_local_node_id(def_id).unwrap();
             let src = MirSource::from_node(tcx, id);
 
             for hook in &mut *hooks {
index 5cc9875e8018b8500ecf5422e9f99f081cf98044..1658efb03235a2405f6c6a153c5a10c1a249c65d 100644 (file)
@@ -441,7 +441,7 @@ pub fn report_extra_impl_obligation(&self,
                              E0276,
                              "impl has stricter requirements than trait");
 
-        if let Some(trait_item_span) = self.tcx.map.span_if_local(trait_item_def_id) {
+        if let Some(trait_item_span) = self.tcx.hir.span_if_local(trait_item_def_id) {
             err.span_label(trait_item_span,
                            &format!("definition of `{}` from trait", item_name));
         }
@@ -594,7 +594,7 @@ pub fn report_selection_error(&self,
 
                         ty::Predicate::ClosureKind(closure_def_id, kind) => {
                             let found_kind = self.closure_kind(closure_def_id).unwrap();
-                            let closure_span = self.tcx.map.span_if_local(closure_def_id).unwrap();
+                            let closure_span = self.tcx.hir.span_if_local(closure_def_id).unwrap();
                             let mut err = struct_span_err!(
                                 self.tcx.sess, closure_span, E0525,
                                 "expected a closure that implements the `{}` trait, \
@@ -653,7 +653,7 @@ pub fn recursive_type_with_infinite_size_error(self,
                                                    -> DiagnosticBuilder<'tcx>
     {
         assert!(type_def_id.is_local());
-        let span = self.map.span_if_local(type_def_id).unwrap();
+        let span = self.hir.span_if_local(type_def_id).unwrap();
         let mut err = struct_span_err!(self.sess, span, E0072,
                                        "recursive type `{}` has infinite size",
                                        self.item_path_str(type_def_id));
index c32e40c6cef2219f73872688478928dffed1c551..c78ba3b8a9bbfdec606c7e0c2597f6a2fdc62848 100644 (file)
@@ -16,7 +16,7 @@
 use hir::TraitMap;
 use hir::def::Def;
 use hir::def_id::{CrateNum, DefId, LOCAL_CRATE};
-use hir::map as ast_map;
+use hir::map as hir_map;
 use hir::map::DisambiguatedDefPathData;
 use middle::free_region::FreeRegionMap;
 use middle::region::RegionMaps;
@@ -265,7 +265,7 @@ pub fn node_id_to_type(&self, id: NodeId) -> Ty<'tcx> {
             Some(ty) => ty,
             None => {
                 bug!("node_id_to_type: no type for node `{}`",
-                     tls::with(|tcx| tcx.map.node_to_string(id)))
+                     tls::with(|tcx| tcx.hir.node_to_string(id)))
             }
         }
     }
@@ -428,7 +428,7 @@ pub struct GlobalCtxt<'tcx> {
     /// additional acyclicity requirements).
     pub super_predicates: RefCell<DepTrackingMap<maps::Predicates<'tcx>>>,
 
-    pub map: ast_map::Map<'tcx>,
+    pub hir: hir_map::Map<'tcx>,
 
     /// Maps from the def-id of a function/method or const/static
     /// to its MIR. Mutation is done at an item granularity to
@@ -628,7 +628,7 @@ pub fn retrace_path(self,
         debug!("retrace_path(path={:?}, krate={:?})", path_data, self.crate_name(krate));
 
         if krate == LOCAL_CRATE {
-            self.map
+            self.hir
                 .definitions()
                 .def_path_table()
                 .retrace_path(path_data)
@@ -730,7 +730,7 @@ pub fn create_and_enter<F, R>(s: &'tcx Session,
                                   arena: &'tcx DroplessArena,
                                   resolutions: ty::Resolutions,
                                   named_region_map: resolve_lifetime::NamedRegionMap,
-                                  map: ast_map::Map<'tcx>,
+                                  hir: hir_map::Map<'tcx>,
                                   region_maps: RegionMaps,
                                   lang_items: middle::lang_items::LanguageItems,
                                   stability: stability::Index<'tcx>,
@@ -741,7 +741,7 @@ pub fn create_and_enter<F, R>(s: &'tcx Session,
         let data_layout = TargetDataLayout::parse(s);
         let interners = CtxtInterners::new(arena);
         let common_types = CommonTypes::new(&interners);
-        let dep_graph = map.dep_graph.clone();
+        let dep_graph = hir.dep_graph.clone();
         let fulfilled_predicates = traits::GlobalFulfilledPredicates::new(dep_graph.clone());
         tls::enter_global(GlobalCtxt {
             specializes_cache: RefCell::new(traits::SpecializesCache::new()),
@@ -765,7 +765,7 @@ pub fn create_and_enter<F, R>(s: &'tcx Session,
             predicates: RefCell::new(DepTrackingMap::new(dep_graph.clone())),
             super_predicates: RefCell::new(DepTrackingMap::new(dep_graph.clone())),
             fulfilled_predicates: RefCell::new(fulfilled_predicates),
-            map: map,
+            hir: hir,
             mir_map: RefCell::new(DepTrackingMap::new(dep_graph.clone())),
             freevars: RefCell::new(resolutions.freevars),
             maybe_unused_trait_imports: resolutions.maybe_unused_trait_imports,
index e95ce97e13577f19d36573988b739e2e0aa6ae85..91087a3dcecd084dcb7b6b2d99acc3b5c4ba3bd2 100644 (file)
@@ -283,7 +283,7 @@ pub fn note_and_explain_type_err(self,
                                           expected.ty,
                                           found.ty));
 
-                match self.map.span_if_local(expected.def_id) {
+                match self.hir.span_if_local(expected.def_id) {
                     Some(span) => {
                         db.span_note(span, "a default was defined here...");
                     }
@@ -297,7 +297,7 @@ pub fn note_and_explain_type_err(self,
                     expected.origin_span,
                     "...that was applied to an unconstrained type variable here");
 
-                match self.map.span_if_local(found.def_id) {
+                match self.hir.span_if_local(found.def_id) {
                     Some(span) => {
                         db.span_note(span, "a second default was defined here...");
                     }
index 16bc65603f1353188b082cf02114d4f45fef31ee..6801e82fe74769d2831625871eb6a1faa9ebd6b4 100644 (file)
@@ -43,7 +43,7 @@ pub fn empty() -> DefIdForest {
     /// crate.
     #[inline]
     pub fn full(tcx: TyCtxt<'a, 'gcx, 'tcx>) -> DefIdForest {
-        let crate_id = tcx.map.local_def_id(CRATE_NODE_ID);
+        let crate_id = tcx.hir.local_def_id(CRATE_NODE_ID);
         DefIdForest::from_id(crate_id)
     }
 
index 0e4c14029e9b9860b3cc86942ab023c7c0ad96d2..d488cd1c42711469419c45561ffd06cad105d602 100644 (file)
@@ -52,7 +52,7 @@ pub fn item_path_str(self, def_id: DefId) -> String {
 
     /// Returns a string identifying this local node-id.
     pub fn node_path_str(self, id: ast::NodeId) -> String {
-        self.item_path_str(self.map.local_def_id(id))
+        self.item_path_str(self.hir.local_def_id(id))
     }
 
     /// Returns a string identifying this def-id. This string is
@@ -286,8 +286,8 @@ fn push_impl_path_fallback<T>(self,
         // only occur very early in the compiler pipeline.
         let parent_def_id = self.parent_def_id(impl_def_id).unwrap();
         self.push_item_path(buffer, parent_def_id);
-        let node_id = self.map.as_local_node_id(impl_def_id).unwrap();
-        let item = self.map.expect_item(node_id);
+        let node_id = self.hir.as_local_node_id(impl_def_id).unwrap();
+        let item = self.hir.expect_item(node_id);
         let span_str = self.sess.codemap().span_to_string(item.span);
         buffer.push(&format!("<impl at {}>", span_str));
     }
index 697ab6ee491d43960632a0beb14824557ed43e92..5681e8c7766231c2201c591a13cc694fb73aba38 100644 (file)
@@ -17,7 +17,7 @@
 pub use self::fold::TypeFoldable;
 
 use dep_graph::{self, DepNode};
-use hir::{map as ast_map, FreevarMap, TraitMap};
+use hir::{map as hir_map, FreevarMap, TraitMap};
 use middle;
 use hir::def::{Def, CtorKind, ExportMap};
 use hir::def_id::{CrateNum, DefId, CRATE_DEF_INDEX, LOCAL_CRATE};
@@ -261,7 +261,7 @@ pub fn from_hir(visibility: &hir::Visibility, id: NodeId, tcx: TyCtxt) -> Self {
                 def => Visibility::Restricted(def.def_id()),
             },
             hir::Inherited => {
-                Visibility::Restricted(tcx.map.local_def_id(tcx.map.get_module_parent(id)))
+                Visibility::Restricted(tcx.hir.local_def_id(tcx.hir.get_module_parent(id)))
             }
         }
     }
@@ -1198,14 +1198,14 @@ pub fn with_caller_bounds(&self,
     /// Construct a parameter environment given an item, impl item, or trait item
     pub fn for_item(tcx: TyCtxt<'a, 'tcx, 'tcx>, id: NodeId)
                     -> ParameterEnvironment<'tcx> {
-        match tcx.map.find(id) {
-            Some(ast_map::NodeImplItem(ref impl_item)) => {
+        match tcx.hir.find(id) {
+            Some(hir_map::NodeImplItem(ref impl_item)) => {
                 match impl_item.node {
                     hir::ImplItemKind::Type(_) | hir::ImplItemKind::Const(..) => {
                         // associated types don't have their own entry (for some reason),
                         // so for now just grab environment for the impl
-                        let impl_id = tcx.map.get_parent(id);
-                        let impl_def_id = tcx.map.local_def_id(impl_id);
+                        let impl_id = tcx.hir.get_parent(id);
+                        let impl_def_id = tcx.hir.local_def_id(impl_id);
                         tcx.construct_parameter_environment(impl_item.span,
                                                             impl_def_id,
                                                             tcx.region_maps.item_extent(id))
@@ -1213,18 +1213,18 @@ pub fn for_item(tcx: TyCtxt<'a, 'tcx, 'tcx>, id: NodeId)
                     hir::ImplItemKind::Method(_, ref body) => {
                         tcx.construct_parameter_environment(
                             impl_item.span,
-                            tcx.map.local_def_id(id),
+                            tcx.hir.local_def_id(id),
                             tcx.region_maps.call_site_extent(id, body.node_id))
                     }
                 }
             }
-            Some(ast_map::NodeTraitItem(trait_item)) => {
+            Some(hir_map::NodeTraitItem(trait_item)) => {
                 match trait_item.node {
                     hir::TraitItemKind::Type(..) | hir::TraitItemKind::Const(..) => {
                         // associated types don't have their own entry (for some reason),
                         // so for now just grab environment for the trait
-                        let trait_id = tcx.map.get_parent(id);
-                        let trait_def_id = tcx.map.local_def_id(trait_id);
+                        let trait_id = tcx.hir.get_parent(id);
+                        let trait_def_id = tcx.hir.local_def_id(trait_id);
                         tcx.construct_parameter_environment(trait_item.span,
                                                             trait_def_id,
                                                             tcx.region_maps.item_extent(id))
@@ -1242,16 +1242,16 @@ pub fn for_item(tcx: TyCtxt<'a, 'tcx, 'tcx>, id: NodeId)
                         };
                         tcx.construct_parameter_environment(
                             trait_item.span,
-                            tcx.map.local_def_id(id),
+                            tcx.hir.local_def_id(id),
                             extent)
                     }
                 }
             }
-            Some(ast_map::NodeItem(item)) => {
+            Some(hir_map::NodeItem(item)) => {
                 match item.node {
                     hir::ItemFn(.., body_id) => {
                         // We assume this is a function.
-                        let fn_def_id = tcx.map.local_def_id(id);
+                        let fn_def_id = tcx.hir.local_def_id(id);
 
                         tcx.construct_parameter_environment(
                             item.span,
@@ -1265,13 +1265,13 @@ pub fn for_item(tcx: TyCtxt<'a, 'tcx, 'tcx>, id: NodeId)
                     hir::ItemImpl(..) |
                     hir::ItemConst(..) |
                     hir::ItemStatic(..) => {
-                        let def_id = tcx.map.local_def_id(id);
+                        let def_id = tcx.hir.local_def_id(id);
                         tcx.construct_parameter_environment(item.span,
                                                             def_id,
                                                             tcx.region_maps.item_extent(id))
                     }
                     hir::ItemTrait(..) => {
-                        let def_id = tcx.map.local_def_id(id);
+                        let def_id = tcx.hir.local_def_id(id);
                         tcx.construct_parameter_environment(item.span,
                                                             def_id,
                                                             tcx.region_maps.item_extent(id))
@@ -1284,10 +1284,10 @@ pub fn for_item(tcx: TyCtxt<'a, 'tcx, 'tcx>, id: NodeId)
                     }
                 }
             }
-            Some(ast_map::NodeExpr(expr)) => {
+            Some(hir_map::NodeExpr(expr)) => {
                 // This is a convenience to allow closures to work.
                 if let hir::ExprClosure(.., body, _) = expr.node {
-                    let def_id = tcx.map.local_def_id(id);
+                    let def_id = tcx.hir.local_def_id(id);
                     let base_def_id = tcx.closure_base_def_id(def_id);
                     tcx.construct_parameter_environment(
                         expr.span,
@@ -1297,8 +1297,8 @@ pub fn for_item(tcx: TyCtxt<'a, 'tcx, 'tcx>, id: NodeId)
                     tcx.empty_parameter_environment()
                 }
             }
-            Some(ast_map::NodeForeignItem(item)) => {
-                let def_id = tcx.map.local_def_id(id);
+            Some(hir_map::NodeForeignItem(item)) => {
+                let def_id = tcx.hir.local_def_id(id);
                 tcx.construct_parameter_environment(item.span,
                                                     def_id,
                                                     ROOT_CODE_EXTENT)
@@ -1306,7 +1306,7 @@ pub fn for_item(tcx: TyCtxt<'a, 'tcx, 'tcx>, id: NodeId)
             _ => {
                 bug!("ParameterEnvironment::from_item(): \
                       `{}` is not an item",
-                     tcx.map.node_to_string(id))
+                     tcx.hir.node_to_string(id))
             }
         }
     }
@@ -1918,7 +1918,7 @@ pub fn to_user_str(&self) -> &'static str {
 
 impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
     pub fn body_tables(self, body: hir::BodyId) -> &'gcx TypeckTables<'gcx> {
-        self.item_tables(self.map.body_owner_def_id(body))
+        self.item_tables(self.hir.body_owner_def_id(body))
     }
 
     pub fn item_tables(self, def_id: DefId) -> &'gcx TypeckTables<'gcx> {
@@ -1944,8 +1944,8 @@ pub fn item_tables(self, def_id: DefId) -> &'gcx TypeckTables<'gcx> {
     }
 
     pub fn expr_span(self, id: NodeId) -> Span {
-        match self.map.find(id) {
-            Some(ast_map::NodeExpr(e)) => {
+        match self.hir.find(id) {
+            Some(hir_map::NodeExpr(e)) => {
                 e.span
             }
             Some(f) => {
@@ -1958,8 +1958,8 @@ pub fn expr_span(self, id: NodeId) -> Span {
     }
 
     pub fn local_var_name_str(self, id: NodeId) -> InternedString {
-        match self.map.find(id) {
-            Some(ast_map::NodeLocal(pat)) => {
+        match self.hir.find(id) {
+            Some(hir_map::NodeLocal(pat)) => {
                 match pat.node {
                     hir::PatKind::Binding(_, _, ref path1, _) => path1.node.as_str(),
                     _ => {
@@ -2031,8 +2031,8 @@ pub fn provided_trait_methods(self, id: DefId) -> Vec<AssociatedItem> {
     }
 
     pub fn trait_impl_polarity(self, id: DefId) -> hir::ImplPolarity {
-        if let Some(id) = self.map.as_local_node_id(id) {
-            match self.map.expect_item(id).node {
+        if let Some(id) = self.hir.as_local_node_id(id) {
+            match self.hir.expect_item(id).node {
                 hir::ItemImpl(_, polarity, ..) => polarity,
                 ref item => bug!("trait_impl_polarity: {:?} not an impl", item)
             }
@@ -2077,10 +2077,10 @@ pub fn associated_item(self, def_id: DefId) -> AssociatedItem {
             // those tasks that just need to scan the names of items
             // and so forth.
 
-            let id = self.map.as_local_node_id(def_id).unwrap();
-            let parent_id = self.map.get_parent(id);
-            let parent_def_id = self.map.local_def_id(parent_id);
-            let parent_item = self.map.expect_item(parent_id);
+            let id = self.hir.as_local_node_id(def_id).unwrap();
+            let parent_id = self.hir.get_parent(id);
+            let parent_def_id = self.hir.local_def_id(parent_id);
+            let parent_item = self.hir.expect_item(parent_id);
             match parent_item.node {
                 hir::ItemImpl(.., ref impl_trait_ref, _, ref impl_item_refs) => {
                     for impl_item_ref in impl_item_refs {
@@ -2115,7 +2115,7 @@ fn associated_item_from_trait_item_ref(self,
                                            parent_def_id: DefId,
                                            trait_item_ref: &hir::TraitItemRef)
                                            -> AssociatedItem {
-        let def_id = self.map.local_def_id(trait_item_ref.id.node_id);
+        let def_id = self.hir.local_def_id(trait_item_ref.id.node_id);
         let (kind, has_self) = match trait_item_ref.kind {
             hir::AssociatedItemKind::Const => (ty::AssociatedKind::Const, false),
             hir::AssociatedItemKind::Method { has_self } => {
@@ -2140,7 +2140,7 @@ fn associated_item_from_impl_item_ref(self,
                                           from_trait_impl: bool,
                                           impl_item_ref: &hir::ImplItemRef)
                                           -> AssociatedItem {
-        let def_id = self.map.local_def_id(impl_item_ref.id.node_id);
+        let def_id = self.hir.local_def_id(impl_item_ref.id.node_id);
         let (kind, has_self) = match impl_item_ref.kind {
             hir::AssociatedItemKind::Const => (ty::AssociatedKind::Const, false),
             hir::AssociatedItemKind::Method { has_self } => {
@@ -2170,19 +2170,19 @@ pub fn associated_item_def_ids(self, def_id: DefId) -> Rc<Vec<DefId>> {
                 return Rc::new(self.sess.cstore.associated_item_def_ids(def_id));
             }
 
-            let id = self.map.as_local_node_id(def_id).unwrap();
-            let item = self.map.expect_item(id);
+            let id = self.hir.as_local_node_id(def_id).unwrap();
+            let item = self.hir.expect_item(id);
             let vec: Vec<_> = match item.node {
                 hir::ItemTrait(.., ref trait_item_refs) => {
                     trait_item_refs.iter()
                                    .map(|trait_item_ref| trait_item_ref.id)
-                                   .map(|id| self.map.local_def_id(id.node_id))
+                                   .map(|id| self.hir.local_def_id(id.node_id))
                                    .collect()
                 }
                 hir::ItemImpl(.., ref impl_item_refs) => {
                     impl_item_refs.iter()
                                   .map(|impl_item_ref| impl_item_ref.id)
-                                  .map(|id| self.map.local_def_id(id.node_id))
+                                  .map(|id| self.hir.local_def_id(id.node_id))
                                   .collect()
                 }
                 _ => span_bug!(item.span, "associated_item_def_ids: not impl or trait")
@@ -2225,9 +2225,9 @@ pub fn expect_variant_def(self, def: Def) -> &'tcx VariantDef {
         }
     }
 
-    pub fn def_key(self, id: DefId) -> ast_map::DefKey {
+    pub fn def_key(self, id: DefId) -> hir_map::DefKey {
         if id.is_local() {
-            self.map.def_key(id)
+            self.hir.def_key(id)
         } else {
             self.sess.cstore.def_key(id)
         }
@@ -2238,35 +2238,35 @@ pub fn def_key(self, id: DefId) -> ast_map::DefKey {
     ///
     /// Note that if `id` is not local to this crate, the result will
     //  be a non-local `DefPath`.
-    pub fn def_path(self, id: DefId) -> ast_map::DefPath {
+    pub fn def_path(self, id: DefId) -> hir_map::DefPath {
         if id.is_local() {
-            self.map.def_path(id)
+            self.hir.def_path(id)
         } else {
             self.sess.cstore.def_path(id)
         }
     }
 
     pub fn def_span(self, def_id: DefId) -> Span {
-        if let Some(id) = self.map.as_local_node_id(def_id) {
-            self.map.span(id)
+        if let Some(id) = self.hir.as_local_node_id(def_id) {
+            self.hir.span(id)
         } else {
             self.sess.cstore.def_span(&self.sess, def_id)
         }
     }
 
     pub fn vis_is_accessible_from(self, vis: Visibility, block: NodeId) -> bool {
-        vis.is_accessible_from(self.map.local_def_id(self.map.get_module_parent(block)), self)
+        vis.is_accessible_from(self.hir.local_def_id(self.hir.get_module_parent(block)), self)
     }
 
     pub fn item_name(self, id: DefId) -> ast::Name {
-        if let Some(id) = self.map.as_local_node_id(id) {
-            self.map.name(id)
+        if let Some(id) = self.hir.as_local_node_id(id) {
+            self.hir.name(id)
         } else if id.index == CRATE_DEF_INDEX {
             self.sess.cstore.original_crate_name(id.krate)
         } else {
             let def_key = self.sess.cstore.def_key(id);
             // The name of a StructCtor is that of its struct parent.
-            if let ast_map::DefPathData::StructCtor = def_key.disambiguated_data.data {
+            if let hir_map::DefPathData::StructCtor = def_key.disambiguated_data.data {
                 self.item_name(DefId {
                     krate: id.krate,
                     index: def_key.parent.unwrap()
@@ -2372,8 +2372,8 @@ pub fn type_needs_drop_given_env(self,
 
     /// Get the attributes of a definition.
     pub fn get_attrs(self, did: DefId) -> Cow<'gcx, [ast::Attribute]> {
-        if let Some(id) = self.map.as_local_node_id(did) {
-            Cow::Borrowed(self.map.attrs(id))
+        if let Some(id) = self.hir.as_local_node_id(did) {
+            Cow::Borrowed(self.hir.attrs(id))
         } else {
             Cow::Owned(self.sess.cstore.item_attrs(did))
         }
@@ -2656,8 +2656,8 @@ pub fn visit_all_item_likes_in_krate<V,F>(self,
     /// with the name of the crate containing the impl.
     pub fn span_of_impl(self, impl_did: DefId) -> Result<Span, Symbol> {
         if impl_did.is_local() {
-            let node_id = self.map.as_local_node_id(impl_did).unwrap();
-            Ok(self.map.span(node_id))
+            let node_id = self.hir.as_local_node_id(impl_did).unwrap();
+            Ok(self.hir.span(node_id))
         } else {
             Err(self.sess.cstore.crate_name(impl_did.krate))
         }
index 65bec9ecdaf959ffa3b7bef709284ebffaa0bdb4..c05375c47b03a1bc6c7fbadc4d9731da842dab8e 100644 (file)
@@ -13,7 +13,7 @@
 use hir::def_id::DefId;
 use hir::map::DefPathData;
 use infer::InferCtxt;
-use hir::map as ast_map;
+use hir::map as hir_map;
 use traits::{self, Reveal};
 use ty::{self, Ty, TyCtxt, TypeAndMut, TypeFlags, TypeFoldable};
 use ty::{Disr, ParameterEnvironment};
@@ -429,7 +429,7 @@ fn def_id(&mut self, did: DefId) {
         self.def_path(&path)
     }
 
-    pub fn def_path(&mut self, def_path: &ast_map::DefPath) {
+    pub fn def_path(&mut self, def_path: &hir_map::DefPath) {
         def_path.deterministic_hash_to(self.tcx, &mut self.state);
     }
 }
index 38b38e5b49764b5bcf4c4d59b90b3bb089125d35..e90e1a94be951facdb3225e0ac0c93c7452813d2 100644 (file)
@@ -285,7 +285,7 @@ fn in_binder<'a, 'gcx, 'tcx, T, U>(f: &mut fmt::Formatter,
             ty::BrEnv => {
                 let name = Symbol::intern("'r");
                 let _ = write!(f, "{}", name);
-                ty::BrNamed(tcx.map.local_def_id(CRATE_NODE_ID),
+                ty::BrNamed(tcx.hir.local_def_id(CRATE_NODE_ID),
                             name,
                             ty::Issue32330::WontChange)
             }
@@ -833,13 +833,13 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
                 let upvar_tys = substs.upvar_tys(did, tcx);
                 write!(f, "[closure")?;
 
-                if let Some(node_id) = tcx.map.as_local_node_id(did) {
-                    write!(f, "@{:?}", tcx.map.span(node_id))?;
+                if let Some(node_id) = tcx.hir.as_local_node_id(did) {
+                    write!(f, "@{:?}", tcx.hir.span(node_id))?;
                     let mut sep = " ";
                     tcx.with_freevars(node_id, |freevars| {
                         for (freevar, upvar_ty) in freevars.iter().zip(upvar_tys) {
                             let def_id = freevar.def.def_id();
-                            let node_id = tcx.map.as_local_node_id(def_id).unwrap();
+                            let node_id = tcx.hir.as_local_node_id(def_id).unwrap();
                             write!(f,
                                         "{}{}:{}",
                                         sep,
index 0605644d497db4c2927ca47433571ef7e4dd05ee..e3dec97472a481af97aa6b6e87b4ffe1495e16d2 100644 (file)
@@ -460,7 +460,7 @@ pub fn report_error_if_loan_conflicts_with_restriction(&self,
             // 3. Where does old loan expire.
 
             let previous_end_span =
-                self.tcx().map.span(old_loan.kill_scope.node_id(&self.tcx().region_maps))
+                self.tcx().hir.span(old_loan.kill_scope.node_id(&self.tcx().region_maps))
                               .end_point();
 
             let mut err = match (new_loan.kind, old_loan.kind) {
@@ -704,7 +704,7 @@ pub fn analyze_restrictions_on_use(&self,
                                        borrow_kind: ty::BorrowKind)
                                        -> UseError<'tcx> {
         debug!("analyze_restrictions_on_use(expr_id={}, use_path={:?})",
-               self.tcx().map.node_to_string(expr_id),
+               self.tcx().hir.node_to_string(expr_id),
                use_path);
 
         let mut ret = UseOk;
index b0a1b3498545fad7ba47b133cab54bdde9862c67..285f3ab9047c85c5379abf9171f886cbfb7aab56 100644 (file)
@@ -132,7 +132,7 @@ pub fn build_unfragmented_map(this: &mut borrowck::BorrowckCtxt,
     }
 
     let mut fraginfo_map = this.tcx.fragment_infos.borrow_mut();
-    let fn_did = this.tcx.map.local_def_id(id);
+    let fn_did = this.tcx.hir.local_def_id(id);
     let prev = fraginfo_map.insert(fn_did, fragment_infos);
     assert!(prev.is_none());
 }
@@ -202,7 +202,7 @@ pub fn instrument_move_fragments<'a, 'tcx>(this: &MoveData<'tcx>,
                                            tcx: TyCtxt<'a, 'tcx, 'tcx>,
                                            sp: Span,
                                            id: ast::NodeId) {
-    let span_err = tcx.map.attrs(id).iter()
+    let span_err = tcx.hir.attrs(id).iter()
                           .any(|a| a.check_name("rustc_move_fragments"));
     let print = tcx.sess.opts.debugging_opts.print_move_fragments;
 
@@ -496,7 +496,7 @@ fn add_fragment_siblings_for_extension<'a, 'tcx>(this: &MoveData<'tcx>,
         },
 
         ref ty => {
-            let span = origin_id.map_or(DUMMY_SP, |id| tcx.map.span(id));
+            let span = origin_id.map_or(DUMMY_SP, |id| tcx.hir.span(id));
             span_bug!(span,
                       "type {:?} ({:?}) is not fragmentable",
                       parent_ty, ty);
index 7101d843b4ce3798558469d1f5883bcceeecda5f..7f7f73d9a9678e45ab6e39c44087428b5836c78c 100644 (file)
@@ -53,7 +53,7 @@ pub fn gather_loans_in_fn<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>,
         move_error_collector: move_error::MoveErrorCollector::new(),
     };
 
-    let body = glcx.bccx.tcx.map.body(body);
+    let body = glcx.bccx.tcx.hir.body(body);
     euv::ExprUseVisitor::new(&mut glcx, &infcx).consume_body(body);
 
     glcx.report_potential_errors();
@@ -553,6 +553,6 @@ pub fn gather_loans_in_static_initializer(bccx: &mut BorrowckCtxt, body: hir::Bo
         body_id: body
     };
 
-    let body = sicx.bccx.tcx.map.body(body);
+    let body = sicx.bccx.tcx.hir.body(body);
     sicx.visit_body(body);
 }
index c7bd5b7ed0461c2c7bd0ef3340a4b7304ee5ba96..372eb1d5d64f018bad60a3a82fa940cebf125690 100644 (file)
@@ -57,7 +57,7 @@ pub fn borrowck_mir(bcx: &mut BorrowckCtxt,
                     id: ast::NodeId,
                     attributes: &[ast::Attribute]) {
     let tcx = bcx.tcx;
-    let def_id = tcx.map.local_def_id(id);
+    let def_id = tcx.hir.local_def_id(id);
     debug!("borrowck_mir({}) UNIMPLEMENTED", tcx.item_path_str(def_id));
 
     let mir = &tcx.item_mir(def_id);
index c0e038d183dad59e2d91e30401ab9cbe161a61b5..3464f1fa89a27c0e121459aee810c38fa273722b 100644 (file)
@@ -64,7 +64,7 @@
 
 impl<'a, 'tcx> Visitor<'tcx> for BorrowckCtxt<'a, 'tcx> {
     fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
-        NestedVisitorMap::OnlyBodies(&self.tcx.map)
+        NestedVisitorMap::OnlyBodies(&self.tcx.hir)
     }
 
     fn visit_fn(&mut self, fk: FnKind<'tcx>, fd: &'tcx hir::FnDecl,
@@ -167,7 +167,7 @@ fn borrowck_fn<'a, 'tcx>(this: &mut BorrowckCtxt<'a, 'tcx>,
                          attributes: &[ast::Attribute]) {
     debug!("borrowck_fn(id={})", id);
 
-    let body = this.tcx.map.body(body_id);
+    let body = this.tcx.hir.body(body_id);
 
     if attributes.iter().any(|item| item.check_name("rustc_mir_borrowck")) {
         this.with_temp_region_map(id, |this| {
@@ -201,9 +201,9 @@ fn build_borrowck_dataflow_data<'a, 'tcx>(this: &mut BorrowckCtxt<'a, 'tcx>,
 {
     // Check the body of fn items.
     let tcx = this.tcx;
-    let body = tcx.map.body(body_id);
+    let body = tcx.hir.body(body_id);
     let id_range = {
-        let mut visitor = intravisit::IdRangeComputingVisitor::new(&tcx.map);
+        let mut visitor = intravisit::IdRangeComputingVisitor::new(&tcx.hir);
         visitor.visit_body(body);
         visitor.result()
     };
@@ -398,7 +398,7 @@ pub enum LoanPathElem<'tcx> {
 
 pub fn closure_to_block(closure_id: ast::NodeId,
                         tcx: TyCtxt) -> ast::NodeId {
-    match tcx.map.get(closure_id) {
+    match tcx.hir.get(closure_id) {
         hir_map::NodeExpr(expr) => match expr.node {
             hir::ExprClosure(.., body_id, _) => {
                 body_id.node_id
@@ -685,10 +685,10 @@ pub fn report_use_of_moved_value(&self,
 
             move_data::MoveExpr |
             move_data::MovePat =>
-                (self.tcx.map.span(the_move.id), ""),
+                (self.tcx.hir.span(the_move.id), ""),
 
             move_data::Captured =>
-                (match self.tcx.map.expect_expr(the_move.id).node {
+                (match self.tcx.hir.expect_expr(the_move.id).node {
                     hir::ExprClosure(.., fn_decl_span) => fn_decl_span,
                     ref r => bug!("Captured({}) maps to non-closure: {:?}",
                                   the_move.id, r),
@@ -882,10 +882,10 @@ pub fn report_aliasability_violation(&self,
                     // happen for nested closures, so we know the enclosing
                     // closure incorrectly accepts an `Fn` while it needs to
                     // be `FnMut`.
-                    span_help!(&mut err, self.tcx.map.span(id),
+                    span_help!(&mut err, self.tcx.hir.span(id),
                            "consider changing this to accept closures that implement `FnMut`");
                 } else {
-                    span_help!(&mut err, self.tcx.map.span(id),
+                    span_help!(&mut err, self.tcx.hir.span(id),
                            "consider changing this closure to take self by mutable reference");
                 }
                 err
@@ -948,7 +948,7 @@ fn report_out_of_scope_escaping_closure_capture(&self,
     fn region_end_span(&self, region: &'tcx ty::Region) -> Option<Span> {
         match *region {
             ty::ReScope(scope) => {
-                match scope.span(&self.tcx.region_maps, &self.tcx.map) {
+                match scope.span(&self.tcx.region_maps, &self.tcx.hir) {
                     Some(s) => {
                         Some(s.end_point())
                     }
@@ -1097,7 +1097,7 @@ fn note_and_explain_mutbl_error(&self, db: &mut DiagnosticBuilder, err: &BckErro
                     _ => bug!()
                 };
                 if kind == ty::ClosureKind::Fn {
-                    db.span_help(self.tcx.map.span(upvar_id.closure_expr_id),
+                    db.span_help(self.tcx.hir.span(upvar_id.closure_expr_id),
                                  "consider changing this closure to take \
                                  self by mutable reference");
                 }
@@ -1105,10 +1105,10 @@ fn note_and_explain_mutbl_error(&self, db: &mut DiagnosticBuilder, err: &BckErro
             _ => {
                 if let Categorization::Deref(ref inner_cmt, ..) = err.cmt.cat {
                     if let Categorization::Local(local_id) = inner_cmt.cat {
-                        let parent = self.tcx.map.get_parent_node(local_id);
+                        let parent = self.tcx.hir.get_parent_node(local_id);
 
-                        if let Some(fn_like) = FnLikeNode::from_node(self.tcx.map.get(parent)) {
-                            if let Some(i) = self.tcx.map.body(fn_like.body()).arguments.iter()
+                        if let Some(fn_like) = FnLikeNode::from_node(self.tcx.hir.get(parent)) {
+                            if let Some(i) = self.tcx.hir.body(fn_like.body()).arguments.iter()
                                                      .position(|arg| arg.pat.id == local_id) {
                                 let arg_ty = &fn_like.decl().inputs[i];
                                 if let hir::TyRptr(
@@ -1141,7 +1141,7 @@ fn note_and_explain_mutbl_error(&self, db: &mut DiagnosticBuilder, err: &BckErro
                         }
                     }
                 } else if let Categorization::Local(local_id) = err.cmt.cat {
-                    let span = self.tcx.map.span(local_id);
+                    let span = self.tcx.hir.span(local_id);
                     if let Ok(snippet) = self.tcx.sess.codemap().span_to_snippet(span) {
                         if snippet.starts_with("ref mut ") || snippet.starts_with("&mut ") {
                             db.span_label(*error_span, &format!("cannot reborrow mutably"));
@@ -1253,7 +1253,7 @@ pub fn cmt_to_path_or_string(&self, cmt: &mc::cmt<'tcx>) -> String {
 fn statement_scope_span(tcx: TyCtxt, region: &ty::Region) -> Option<Span> {
     match *region {
         ty::ReScope(scope) => {
-            match tcx.map.find(scope.node_id(&tcx.region_maps)) {
+            match tcx.hir.find(scope.node_id(&tcx.region_maps)) {
                 Some(hir_map::NodeStmt(stmt)) => Some(stmt.span),
                 _ => None
             }
@@ -1302,11 +1302,11 @@ 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.map.node_to_string(id)))
+                write!(f, "$({})", ty::tls::with(|tcx| tcx.hir.node_to_string(id)))
             }
 
             LpUpvar(ty::UpvarId{ var_id, closure_expr_id }) => {
-                let s = ty::tls::with(|tcx| tcx.map.node_to_string(var_id));
+                let s = ty::tls::with(|tcx| tcx.hir.node_to_string(var_id));
                 write!(f, "$({} captured by id={})", s, closure_expr_id)
             }
 
@@ -1334,11 +1334,11 @@ impl<'tcx> fmt::Display for LoanPath<'tcx> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         match self.kind {
             LpVar(id) => {
-                write!(f, "$({})", ty::tls::with(|tcx| tcx.map.node_to_user_string(id)))
+                write!(f, "$({})", ty::tls::with(|tcx| tcx.hir.node_to_user_string(id)))
             }
 
             LpUpvar(ty::UpvarId{ var_id, closure_expr_id: _ }) => {
-                let s = ty::tls::with(|tcx| tcx.map.node_to_user_string(var_id));
+                let s = ty::tls::with(|tcx| tcx.hir.node_to_user_string(var_id));
                 write!(f, "$({} captured by closure)", s)
             }
 
index a02aba7208c7fe4be3c6975eb1ac8d24a266e4d6..2047a58f8ed85a24da6f28fd2ae7ae9d64c65d0b 100644 (file)
@@ -490,7 +490,7 @@ fn add_assignment_helper(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>,
     /// Adds a new record for a match of `base_lp`, downcast to
     /// variant `lp`, that occurs at location `pattern_id`.  (One
     /// should be able to recover the span info from the
-    /// `pattern_id` and the ast_map, I think.)
+    /// `pattern_id` and the hir_map, I think.)
     pub fn add_variant_match(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>,
                              lp: Rc<LoanPath<'tcx>>,
                              pattern_id: ast::NodeId,
index a6452a3f0310ad4eb02eaf197aae7a4f6c0d7c0a..0b1f2465a4d5921daee9beced54ea09dde65bd53 100644 (file)
@@ -42,7 +42,7 @@ struct OuterVisitor<'a, 'tcx: 'a> { tcx: TyCtxt<'a, 'tcx, 'tcx> }
 
 impl<'a, 'tcx> Visitor<'tcx> for OuterVisitor<'a, 'tcx> {
     fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
-        NestedVisitorMap::OnlyBodies(&self.tcx.map)
+        NestedVisitorMap::OnlyBodies(&self.tcx.hir)
     }
 
     fn visit_fn(&mut self, fk: FnKind<'tcx>, fd: &'tcx hir::FnDecl,
@@ -53,7 +53,7 @@ fn visit_fn(&mut self, fk: FnKind<'tcx>, fd: &'tcx hir::FnDecl,
             tcx: self.tcx,
             tables: self.tcx.body_tables(b),
             param_env: &ty::ParameterEnvironment::for_item(self.tcx, id)
-        }.visit_body(self.tcx.map.body(b));
+        }.visit_body(self.tcx.hir.body(b));
     }
 }
 
@@ -152,7 +152,7 @@ fn check_match(
             }
         }
 
-        let module = self.tcx.map.local_def_id(self.tcx.map.get_module_parent(scrut.id));
+        let module = self.tcx.hir.local_def_id(self.tcx.hir.get_module_parent(scrut.id));
         MatchCheckCtxt::create_and_enter(self.tcx, module, |ref mut cx| {
             let mut have_errors = false;
 
@@ -195,7 +195,7 @@ fn check_irrefutable(&self, pat: &Pat, is_fn_arg: bool) {
             "local binding"
         };
 
-        let module = self.tcx.map.local_def_id(self.tcx.map.get_module_parent(pat.id));
+        let module = self.tcx.hir.local_def_id(self.tcx.hir.get_module_parent(pat.id));
         MatchCheckCtxt::create_and_enter(self.tcx, module, |ref mut cx| {
             let mut patcx = PatternContext::new(self.tcx, self.tables);
             let pattern = patcx.lower_pattern(pat);
index 2325c37bc40501f51352a642648d852bd033f2d7..a9dcb1ed8961330a9573435ec8382fed4181bddc 100644 (file)
@@ -15,7 +15,7 @@
 use self::ErrKind::*;
 use self::EvalHint::*;
 
-use rustc::hir::map as ast_map;
+use rustc::hir::map as hir_map;
 use rustc::hir::map::blocks::FnLikeNode;
 use rustc::traits;
 use rustc::hir::def::Def;
@@ -53,15 +53,15 @@ macro_rules! math {
 fn lookup_variant_by_id<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
                                   variant_def: DefId)
                                   -> Option<(&'tcx Expr, Option<&'a ty::TypeckTables<'tcx>>)> {
-    if let Some(variant_node_id) = tcx.map.as_local_node_id(variant_def) {
-        let enum_node_id = tcx.map.get_parent(variant_node_id);
-        if let Some(ast_map::NodeItem(it)) = tcx.map.find(enum_node_id) {
+    if let Some(variant_node_id) = tcx.hir.as_local_node_id(variant_def) {
+        let enum_node_id = tcx.hir.get_parent(variant_node_id);
+        if let Some(hir_map::NodeItem(it)) = tcx.hir.find(enum_node_id) {
             if let hir::ItemEnum(ref edef, _) = it.node {
                 for variant in &edef.variants {
                     if variant.node.data.id() == variant_node_id {
                         return variant.node.disr_expr.map(|e| {
-                            let def_id = tcx.map.body_owner_def_id(e);
-                            (&tcx.map.body(e).value,
+                            let def_id = tcx.hir.body_owner_def_id(e);
+                            (&tcx.hir.body(e).value,
                              tcx.tables.borrow().get(&def_id).cloned())
                         });
                     }
@@ -83,29 +83,29 @@ pub fn lookup_const_by_id<'a, 'tcx: 'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
                                         -> Option<(&'tcx Expr,
                                                    Option<&'a ty::TypeckTables<'tcx>>,
                                                    Option<ty::Ty<'tcx>>)> {
-    if let Some(node_id) = tcx.map.as_local_node_id(def_id) {
-        match tcx.map.find(node_id) {
+    if let Some(node_id) = tcx.hir.as_local_node_id(def_id) {
+        match tcx.hir.find(node_id) {
             None => None,
-            Some(ast_map::NodeItem(&hir::Item {
+            Some(hir_map::NodeItem(&hir::Item {
                 node: hir::ItemConst(ref ty, body), ..
             })) |
-            Some(ast_map::NodeImplItem(&hir::ImplItem {
+            Some(hir_map::NodeImplItem(&hir::ImplItem {
                 node: hir::ImplItemKind::Const(ref ty, body), ..
             })) => {
-                Some((&tcx.map.body(body).value,
+                Some((&tcx.hir.body(body).value,
                       tcx.tables.borrow().get(&def_id).cloned(),
                       tcx.ast_ty_to_prim_ty(ty)))
             }
-            Some(ast_map::NodeTraitItem(ti)) => match ti.node {
+            Some(hir_map::NodeTraitItem(ti)) => match ti.node {
                 hir::TraitItemKind::Const(ref ty, default) => {
                     if let Some(substs) = substs {
                         // If we have a trait item and the substitutions for it,
                         // `resolve_trait_associated_const` will select an impl
                         // or the default.
-                        let trait_id = tcx.map.get_parent(node_id);
-                        let trait_id = tcx.map.local_def_id(trait_id);
+                        let trait_id = tcx.hir.get_parent(node_id);
+                        let trait_id = tcx.hir.local_def_id(trait_id);
                         let default_value = default.map(|body| {
-                            (&tcx.map.body(body).value,
+                            (&tcx.hir.body(body).value,
                              tcx.tables.borrow().get(&def_id).cloned(),
                              tcx.ast_ty_to_prim_ty(ty))
                         });
@@ -156,10 +156,10 @@ pub fn lookup_const_by_id<'a, 'tcx: 'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
 fn lookup_const_fn_by_id<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId)
                                    -> Option<(&'tcx hir::Body, Option<&'a ty::TypeckTables<'tcx>>)>
 {
-    if let Some(node_id) = tcx.map.as_local_node_id(def_id) {
-        FnLikeNode::from_node(tcx.map.get(node_id)).and_then(|fn_like| {
+    if let Some(node_id) = tcx.hir.as_local_node_id(def_id) {
+        FnLikeNode::from_node(tcx.hir.get(node_id)).and_then(|fn_like| {
             if fn_like.constness() == hir::Constness::Const {
-                Some((tcx.map.body(fn_like.body()),
+                Some((tcx.hir.body(fn_like.body()),
                       tcx.tables.borrow().get(&def_id).cloned()))
             } else {
                 None
@@ -232,7 +232,7 @@ pub struct ConstContext<'a, 'tcx: 'a> {
 
 impl<'a, 'tcx> ConstContext<'a, 'tcx> {
     pub fn new(tcx: TyCtxt<'a, 'tcx, 'tcx>, body: hir::BodyId) -> Self {
-        let def_id = tcx.map.body_owner_def_id(body);
+        let def_id = tcx.hir.body_owner_def_id(body);
         ConstContext {
             tcx: tcx,
             tables: tcx.tables.borrow().get(&def_id).cloned(),
@@ -808,7 +808,7 @@ fn eval_const_expr_partial<'a, 'tcx>(cx: &ConstContext<'a, 'tcx>,
                 _ => bug!()
             }
           } else {
-            let n = &tcx.map.body(count).value;
+            let n = &tcx.hir.body(count).value;
             match ConstContext::new(tcx, count).eval(n, len_hint)? {
                 Integral(Usize(i)) => i.as_u64(tcx.sess.target.uint_type),
                 Integral(_) => signal!(e, RepeatCountNotNatural),
@@ -1203,7 +1203,7 @@ pub fn eval_length<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
                              -> Result<usize, ErrorReported>
 {
     let hint = UncheckedExprHint(tcx.types.usize);
-    let count_expr = &tcx.map.body(count).value;
+    let count_expr = &tcx.hir.body(count).value;
     match ConstContext::new(tcx, count).eval(count_expr, hint) {
         Ok(Integral(Usize(count))) => {
             let val = count.as_u64(tcx.sess.target.uint_type);
@@ -1227,7 +1227,7 @@ pub fn eval_length<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
             if let hir::ExprPath(hir::QPath::Resolved(None, ref path)) = count_expr.node {
                 if let Def::Local(..) = path.def {
                     diag.note(&format!("`{}` is a variable",
-                                       tcx.map.node_to_pretty_string(count_expr.id)));
+                                       tcx.hir.node_to_pretty_string(count_expr.id)));
                 }
             }
 
index 24c795befa3c848701cba8bbfe8626b4f4dd00b8..a3b80ebddcf00d15472f7e6d7a7627fb462f9455 100644 (file)
@@ -360,7 +360,7 @@ pub fn lower_pattern(&mut self, pat: &hir::Pat) -> Pattern<'tcx> {
             }
 
             PatKind::Binding(bm, def_id, ref ident, ref sub) => {
-                let id = self.tcx.map.as_local_node_id(def_id).unwrap();
+                let id = self.tcx.hir.as_local_node_id(def_id).unwrap();
                 let var_ty = self.tables.node_id_to_type(pat.id);
                 let region = match var_ty.sty {
                     ty::TyRef(r, _) => Some(r),
index 83dec4b0b77ab3967efcb6b32292ec98d05d19bb..a7188f6da1ff9a9faee6ed93ef7bd1d1f8979e17 100644 (file)
@@ -181,7 +181,7 @@ macro_rules! controller_entry_point {
                                                                    outdir,
                                                                    output,
                                                                    opt_crate,
-                                                                   tcx.map.krate(),
+                                                                   tcx.hir.krate(),
                                                                    &analysis,
                                                                    tcx,
                                                                    &crate_name);
@@ -340,7 +340,7 @@ pub struct CompileState<'a, 'tcx: 'a> {
     pub arenas: Option<&'tcx GlobalArenas<'tcx>>,
     pub expanded_crate: Option<&'a ast::Crate>,
     pub hir_crate: Option<&'a hir::Crate>,
-    pub ast_map: Option<&'a hir_map::Map<'tcx>>,
+    pub hir_map: Option<&'a hir_map::Map<'tcx>>,
     pub resolutions: Option<&'a Resolutions>,
     pub analysis: Option<&'a ty::CrateAnalysis<'tcx>>,
     pub tcx: Option<TyCtxt<'a, 'tcx, 'tcx>>,
@@ -366,7 +366,7 @@ fn empty(input: &'a Input,
             output_filenames: None,
             expanded_crate: None,
             hir_crate: None,
-            ast_map: None,
+            hir_map: None,
             resolutions: None,
             analysis: None,
             tcx: None,
@@ -427,7 +427,7 @@ fn state_after_hir_lowering(input: &'a Input,
             arena: Some(arena),
             arenas: Some(arenas),
             cstore: Some(cstore),
-            ast_map: Some(hir_map),
+            hir_map: Some(hir_map),
             analysis: Some(analysis),
             resolutions: Some(resolutions),
             expanded_crate: Some(krate),
index ad2aefbb79539c60b4ffa943ee4bc357142c4364..7fd4fa44ca45dff0ad42b8577283e3df38663cf3 100644 (file)
@@ -454,7 +454,7 @@ fn build_controller(&mut self,
                 };
                 control.after_hir_lowering.callback = box move |state| {
                     pretty::print_after_hir_lowering(state.session,
-                                                     state.ast_map.unwrap(),
+                                                     state.hir_map.unwrap(),
                                                      state.analysis.unwrap(),
                                                      state.resolutions.unwrap(),
                                                      state.input,
index c5e0e8fb45f64ab9164a53acf1858b4ff4958312..21fe13997b787d05e5c765b065aa910c5370e9b8 100644 (file)
@@ -167,7 +167,7 @@ impl PpSourceMode {
     /// Constructs a `PrinterSupport` object and passes it to `f`.
     fn call_with_pp_support<'tcx, A, B, F>(&self,
                                            sess: &'tcx Session,
-                                           ast_map: Option<&hir_map::Map<'tcx>>,
+                                           hir_map: Option<&hir_map::Map<'tcx>>,
                                            payload: B,
                                            f: F)
                                            -> A
@@ -177,7 +177,7 @@ fn call_with_pp_support<'tcx, A, B, F>(&self,
             PpmNormal | PpmEveryBodyLoops | PpmExpanded => {
                 let annotation = NoAnn {
                     sess: sess,
-                    ast_map: ast_map.map(|m| m.clone()),
+                    hir_map: hir_map.map(|m| m.clone()),
                 };
                 f(&annotation, payload)
             }
@@ -185,14 +185,13 @@ fn call_with_pp_support<'tcx, A, B, F>(&self,
             PpmIdentified | PpmExpandedIdentified => {
                 let annotation = IdentifiedAnnotation {
                     sess: sess,
-                    ast_map: ast_map.map(|m| m.clone()),
+                    hir_map: hir_map.map(|m| m.clone()),
                 };
                 f(&annotation, payload)
             }
             PpmExpandedHygiene => {
                 let annotation = HygieneAnnotation {
                     sess: sess,
-                    ast_map: ast_map.map(|m| m.clone()),
                 };
                 f(&annotation, payload)
             }
@@ -201,7 +200,7 @@ fn call_with_pp_support<'tcx, A, B, F>(&self,
     }
     fn call_with_pp_support_hir<'tcx, A, B, F>(&self,
                                                sess: &'tcx Session,
-                                               ast_map: &hir_map::Map<'tcx>,
+                                               hir_map: &hir_map::Map<'tcx>,
                                                analysis: &ty::CrateAnalysis<'tcx>,
                                                resolutions: &Resolutions,
                                                arena: &'tcx DroplessArena,
@@ -216,21 +215,21 @@ fn call_with_pp_support_hir<'tcx, A, B, F>(&self,
             PpmNormal => {
                 let annotation = NoAnn {
                     sess: sess,
-                    ast_map: Some(ast_map.clone()),
+                    hir_map: Some(hir_map.clone()),
                 };
-                f(&annotation, payload, ast_map.forest.krate())
+                f(&annotation, payload, hir_map.forest.krate())
             }
 
             PpmIdentified => {
                 let annotation = IdentifiedAnnotation {
                     sess: sess,
-                    ast_map: Some(ast_map.clone()),
+                    hir_map: Some(hir_map.clone()),
                 };
-                f(&annotation, payload, ast_map.forest.krate())
+                f(&annotation, payload, hir_map.forest.krate())
             }
             PpmTyped => {
                 abort_on_err(driver::phase_3_run_analysis_passes(sess,
-                                                                 ast_map.clone(),
+                                                                 hir_map.clone(),
                                                                  analysis.clone(),
                                                                  resolutions.clone(),
                                                                  arena,
@@ -243,7 +242,7 @@ fn call_with_pp_support_hir<'tcx, A, B, F>(&self,
                         tables: Cell::new(&empty_tables)
                     };
                     let _ignore = tcx.dep_graph.in_ignore();
-                    f(&annotation, payload, ast_map.forest.krate())
+                    f(&annotation, payload, hir_map.forest.krate())
                 }),
                              sess)
             }
@@ -252,15 +251,11 @@ fn call_with_pp_support_hir<'tcx, A, B, F>(&self,
     }
 }
 
-trait PrinterSupport<'ast>: pprust::PpAnn {
+trait PrinterSupport: pprust::PpAnn {
     /// Provides a uniform interface for re-extracting a reference to a
     /// `Session` from a value that now owns it.
     fn sess<'a>(&'a self) -> &'a Session;
 
-    /// Provides a uniform interface for re-extracting a reference to an
-    /// `hir_map::Map` from a value that now owns it.
-    fn ast_map<'a>(&'a self) -> Option<&'a hir_map::Map<'ast>>;
-
     /// Produces the pretty-print annotation object.
     ///
     /// (Rust does not yet support upcasting from a trait object to
@@ -268,14 +263,14 @@ trait PrinterSupport<'ast>: pprust::PpAnn {
     fn pp_ann<'a>(&'a self) -> &'a pprust::PpAnn;
 }
 
-trait HirPrinterSupport<'ast>: pprust_hir::PpAnn {
+trait HirPrinterSupport<'hir>: pprust_hir::PpAnn {
     /// Provides a uniform interface for re-extracting a reference to a
     /// `Session` from a value that now owns it.
     fn sess<'a>(&'a self) -> &'a Session;
 
     /// Provides a uniform interface for re-extracting a reference to an
     /// `hir_map::Map` from a value that now owns it.
-    fn ast_map<'a>(&'a self) -> Option<&'a hir_map::Map<'ast>>;
+    fn hir_map<'a>(&'a self) -> Option<&'a hir_map::Map<'hir>>;
 
     /// Produces the pretty-print annotation object.
     ///
@@ -285,7 +280,7 @@ trait HirPrinterSupport<'ast>: pprust_hir::PpAnn {
 
     /// Computes an user-readable representation of a path, if possible.
     fn node_path(&self, id: ast::NodeId) -> Option<String> {
-        self.ast_map().and_then(|map| map.def_path_from_id(id)).map(|path| {
+        self.hir_map().and_then(|map| map.def_path_from_id(id)).map(|path| {
             path.data
                 .into_iter()
                 .map(|elem| elem.data.to_string())
@@ -295,32 +290,28 @@ fn node_path(&self, id: ast::NodeId) -> Option<String> {
     }
 }
 
-struct NoAnn<'ast> {
-    sess: &'ast Session,
-    ast_map: Option<hir_map::Map<'ast>>,
+struct NoAnn<'hir> {
+    sess: &'hir Session,
+    hir_map: Option<hir_map::Map<'hir>>,
 }
 
-impl<'ast> PrinterSupport<'ast> for NoAnn<'ast> {
+impl<'hir> PrinterSupport for NoAnn<'hir> {
     fn sess<'a>(&'a self) -> &'a Session {
         self.sess
     }
 
-    fn ast_map<'a>(&'a self) -> Option<&'a hir_map::Map<'ast>> {
-        self.ast_map.as_ref()
-    }
-
     fn pp_ann<'a>(&'a self) -> &'a pprust::PpAnn {
         self
     }
 }
 
-impl<'ast> HirPrinterSupport<'ast> for NoAnn<'ast> {
+impl<'hir> HirPrinterSupport<'hir> for NoAnn<'hir> {
     fn sess<'a>(&'a self) -> &'a Session {
         self.sess
     }
 
-    fn ast_map<'a>(&'a self) -> Option<&'a hir_map::Map<'ast>> {
-        self.ast_map.as_ref()
+    fn hir_map<'a>(&'a self) -> Option<&'a hir_map::Map<'hir>> {
+        self.hir_map.as_ref()
     }
 
     fn pp_ann<'a>(&'a self) -> &'a pprust_hir::PpAnn {
@@ -328,11 +319,11 @@ fn pp_ann<'a>(&'a self) -> &'a pprust_hir::PpAnn {
     }
 }
 
-impl<'ast> pprust::PpAnn for NoAnn<'ast> {}
-impl<'ast> pprust_hir::PpAnn for NoAnn<'ast> {
+impl<'hir> pprust::PpAnn for NoAnn<'hir> {}
+impl<'hir> pprust_hir::PpAnn for NoAnn<'hir> {
     fn nested(&self, state: &mut pprust_hir::State, nested: pprust_hir::Nested)
               -> io::Result<()> {
-        if let Some(ref map) = self.ast_map {
+        if let Some(ref map) = self.hir_map {
             pprust_hir::PpAnn::nested(map, state, nested)
         } else {
             Ok(())
@@ -340,26 +331,22 @@ fn nested(&self, state: &mut pprust_hir::State, nested: pprust_hir::Nested)
     }
 }
 
-struct IdentifiedAnnotation<'ast> {
-    sess: &'ast Session,
-    ast_map: Option<hir_map::Map<'ast>>,
+struct IdentifiedAnnotation<'hir> {
+    sess: &'hir Session,
+    hir_map: Option<hir_map::Map<'hir>>,
 }
 
-impl<'ast> PrinterSupport<'ast> for IdentifiedAnnotation<'ast> {
+impl<'hir> PrinterSupport for IdentifiedAnnotation<'hir> {
     fn sess<'a>(&'a self) -> &'a Session {
         self.sess
     }
 
-    fn ast_map<'a>(&'a self) -> Option<&'a hir_map::Map<'ast>> {
-        self.ast_map.as_ref()
-    }
-
     fn pp_ann<'a>(&'a self) -> &'a pprust::PpAnn {
         self
     }
 }
 
-impl<'ast> pprust::PpAnn for IdentifiedAnnotation<'ast> {
+impl<'hir> pprust::PpAnn for IdentifiedAnnotation<'hir> {
     fn pre(&self, s: &mut pprust::State, node: pprust::AnnNode) -> io::Result<()> {
         match node {
             pprust::NodeExpr(_) => s.popen(),
@@ -396,13 +383,13 @@ fn post(&self, s: &mut pprust::State, node: pprust::AnnNode) -> io::Result<()> {
     }
 }
 
-impl<'ast> HirPrinterSupport<'ast> for IdentifiedAnnotation<'ast> {
+impl<'hir> HirPrinterSupport<'hir> for IdentifiedAnnotation<'hir> {
     fn sess<'a>(&'a self) -> &'a Session {
         self.sess
     }
 
-    fn ast_map<'a>(&'a self) -> Option<&'a hir_map::Map<'ast>> {
-        self.ast_map.as_ref()
+    fn hir_map<'a>(&'a self) -> Option<&'a hir_map::Map<'hir>> {
+        self.hir_map.as_ref()
     }
 
     fn pp_ann<'a>(&'a self) -> &'a pprust_hir::PpAnn {
@@ -410,10 +397,10 @@ fn pp_ann<'a>(&'a self) -> &'a pprust_hir::PpAnn {
     }
 }
 
-impl<'ast> pprust_hir::PpAnn for IdentifiedAnnotation<'ast> {
+impl<'hir> pprust_hir::PpAnn for IdentifiedAnnotation<'hir> {
     fn nested(&self, state: &mut pprust_hir::State, nested: pprust_hir::Nested)
               -> io::Result<()> {
-        if let Some(ref map) = self.ast_map {
+        if let Some(ref map) = self.hir_map {
             pprust_hir::PpAnn::nested(map, state, nested)
         } else {
             Ok(())
@@ -453,26 +440,21 @@ fn post(&self, s: &mut pprust_hir::State, node: pprust_hir::AnnNode) -> io::Resu
     }
 }
 
-struct HygieneAnnotation<'ast> {
-    sess: &'ast Session,
-    ast_map: Option<hir_map::Map<'ast>>,
+struct HygieneAnnotation<'a> {
+    sess: &'a Session
 }
 
-impl<'ast> PrinterSupport<'ast> for HygieneAnnotation<'ast> {
-    fn sess<'a>(&'a self) -> &'a Session {
+impl<'a> PrinterSupport for HygieneAnnotation<'a> {
+    fn sess(&self) -> &Session {
         self.sess
     }
 
-    fn ast_map<'a>(&'a self) -> Option<&'a hir_map::Map<'ast>> {
-        self.ast_map.as_ref()
-    }
-
-    fn pp_ann<'a>(&'a self) -> &'a pprust::PpAnn {
+    fn pp_ann(&self) -> &pprust::PpAnn {
         self
     }
 }
 
-impl<'ast> pprust::PpAnn for HygieneAnnotation<'ast> {
+impl<'a> pprust::PpAnn for HygieneAnnotation<'a> {
     fn post(&self, s: &mut pprust::State, node: pprust::AnnNode) -> io::Result<()> {
         match node {
             pprust::NodeIdent(&ast::Ident { name, ctxt }) => {
@@ -501,8 +483,8 @@ fn sess<'a>(&'a self) -> &'a Session {
         &self.tcx.sess
     }
 
-    fn ast_map<'a>(&'a self) -> Option<&'a hir_map::Map<'tcx>> {
-        Some(&self.tcx.map)
+    fn hir_map<'a>(&'a self) -> Option<&'a hir_map::Map<'tcx>> {
+        Some(&self.tcx.hir)
     }
 
     fn pp_ann<'a>(&'a self) -> &'a pprust_hir::PpAnn {
@@ -521,7 +503,7 @@ fn nested(&self, state: &mut pprust_hir::State, nested: pprust_hir::Nested)
         if let pprust_hir::Nested::Body(id) = nested {
             self.tables.set(self.tcx.body_tables(id));
         }
-        pprust_hir::PpAnn::nested(&self.tcx.map, state, nested)?;
+        pprust_hir::PpAnn::nested(&self.tcx.hir, state, nested)?;
         self.tables.set(old_tables);
         Ok(())
     }
@@ -579,12 +561,12 @@ fn from_str(s: &str) -> Result<UserIdentifiedItem, ()> {
     }
 }
 
-enum NodesMatchingUII<'a, 'ast: 'a> {
+enum NodesMatchingUII<'a, 'hir: 'a> {
     NodesMatchingDirect(option::IntoIter<ast::NodeId>),
-    NodesMatchingSuffix(hir_map::NodesMatchingSuffix<'a, 'ast>),
+    NodesMatchingSuffix(hir_map::NodesMatchingSuffix<'a, 'hir>),
 }
 
-impl<'a, 'ast> Iterator for NodesMatchingUII<'a, 'ast> {
+impl<'a, 'hir> Iterator for NodesMatchingUII<'a, 'hir> {
     type Item = ast::NodeId;
 
     fn next(&mut self) -> Option<ast::NodeId> {
@@ -603,9 +585,9 @@ fn reconstructed_input(&self) -> String {
         }
     }
 
-    fn all_matching_node_ids<'a, 'ast>(&'a self,
-                                       map: &'a hir_map::Map<'ast>)
-                                       -> NodesMatchingUII<'a, 'ast> {
+    fn all_matching_node_ids<'a, 'hir>(&'a self,
+                                       map: &'a hir_map::Map<'hir>)
+                                       -> NodesMatchingUII<'a, 'hir> {
         match *self {
             ItemViaNode(node_id) => NodesMatchingDirect(Some(node_id).into_iter()),
             ItemViaPath(ref parts) => NodesMatchingSuffix(map.nodes_matching_suffix(&parts[..])),
@@ -739,13 +721,13 @@ fn print_flowgraph<'a, 'tcx, W: Write>(variants: Vec<borrowck_dot::Variant>,
     let cfg = match code {
         blocks::Code::Expr(expr) => cfg::CFG::new(tcx, expr),
         blocks::Code::FnLike(fn_like) => {
-            let body = tcx.map.body(fn_like.body());
+            let body = tcx.hir.body(fn_like.body());
             cfg::CFG::new(tcx, &body.value)
         },
     };
     let labelled_edges = mode != PpFlowGraphMode::UnlabelledEdges;
     let lcfg = LabelledCFG {
-        ast_map: &tcx.map,
+        hir_map: &tcx.hir,
         cfg: &cfg,
         name: format!("node_{}", code.id()),
         labelled_edges: labelled_edges,
@@ -855,7 +837,7 @@ pub fn print_after_parsing(sess: &Session,
 }
 
 pub fn print_after_hir_lowering<'tcx, 'a: 'tcx>(sess: &'a Session,
-                                                ast_map: &hir_map::Map<'tcx>,
+                                                hir_map: &hir_map::Map<'tcx>,
                                                 analysis: &ty::CrateAnalysis<'tcx>,
                                                 resolutions: &Resolutions,
                                                 input: &Input,
@@ -871,7 +853,7 @@ pub fn print_after_hir_lowering<'tcx, 'a: 'tcx>(sess: &'a Session,
 
     if ppm.needs_analysis() {
         print_with_analysis(sess,
-                            ast_map,
+                            hir_map,
                             analysis,
                             resolutions,
                             crate_name,
@@ -892,7 +874,7 @@ pub fn print_after_hir_lowering<'tcx, 'a: 'tcx>(sess: &'a Session,
             (PpmSource(s), _) => {
                 // Silently ignores an identified node.
                 let out: &mut Write = &mut out;
-                s.call_with_pp_support(sess, Some(ast_map), box out, |annotation, out| {
+                s.call_with_pp_support(sess, Some(hir_map), box out, |annotation, out| {
                     debug!("pretty printing source code {:?}", s);
                     let sess = annotation.sess();
                     pprust::print_crate(sess.codemap(),
@@ -909,7 +891,7 @@ pub fn print_after_hir_lowering<'tcx, 'a: 'tcx>(sess: &'a Session,
             (PpmHir(s), None) => {
                 let out: &mut Write = &mut out;
                 s.call_with_pp_support_hir(sess,
-                                           ast_map,
+                                           hir_map,
                                            analysis,
                                            resolutions,
                                            arena,
@@ -933,7 +915,7 @@ pub fn print_after_hir_lowering<'tcx, 'a: 'tcx>(sess: &'a Session,
             (PpmHir(s), Some(uii)) => {
                 let out: &mut Write = &mut out;
                 s.call_with_pp_support_hir(sess,
-                                           ast_map,
+                                           hir_map,
                                            analysis,
                                            resolutions,
                                            arena,
@@ -943,7 +925,7 @@ pub fn print_after_hir_lowering<'tcx, 'a: 'tcx>(sess: &'a Session,
                                            |annotation, (out, uii), _| {
                     debug!("pretty printing source code {:?}", s);
                     let sess = annotation.sess();
-                    let ast_map = annotation.ast_map().expect("--unpretty missing HIR map");
+                    let hir_map = annotation.hir_map().expect("--unpretty missing HIR map");
                     let mut pp_state = pprust_hir::State::new_from_input(sess.codemap(),
                                                                          &sess.parse_sess,
                                                                          src_name.to_string(),
@@ -951,8 +933,8 @@ pub fn print_after_hir_lowering<'tcx, 'a: 'tcx>(sess: &'a Session,
                                                                          box out,
                                                                          annotation.pp_ann(),
                                                                          true);
-                    for node_id in uii.all_matching_node_ids(ast_map) {
-                        let node = ast_map.get(node_id);
+                    for node_id in uii.all_matching_node_ids(hir_map) {
+                        let node = hir_map.get(node_id);
                         pp_state.print_node(node)?;
                         pp::space(&mut pp_state.s)?;
                         let path = annotation.node_path(node_id)
@@ -975,7 +957,7 @@ pub fn print_after_hir_lowering<'tcx, 'a: 'tcx>(sess: &'a Session,
 // with a different callback than the standard driver, so that isn't easy.
 // Instead, we call that function ourselves.
 fn print_with_analysis<'tcx, 'a: 'tcx>(sess: &'a Session,
-                                       ast_map: &hir_map::Map<'tcx>,
+                                       hir_map: &hir_map::Map<'tcx>,
                                        analysis: &ty::CrateAnalysis<'tcx>,
                                        resolutions: &Resolutions,
                                        crate_name: &str,
@@ -986,7 +968,7 @@ fn print_with_analysis<'tcx, 'a: 'tcx>(sess: &'a Session,
                                        ofile: Option<&Path>) {
     let nodeid = if let Some(uii) = uii {
         debug!("pretty printing for {:?}", uii);
-        Some(uii.to_one_node_id("--unpretty", sess, &ast_map))
+        Some(uii.to_one_node_id("--unpretty", sess, &hir_map))
     } else {
         debug!("pretty printing for whole crate");
         None
@@ -995,7 +977,7 @@ fn print_with_analysis<'tcx, 'a: 'tcx>(sess: &'a Session,
     let mut out = Vec::new();
 
     abort_on_err(driver::phase_3_run_analysis_passes(sess,
-                                                     ast_map.clone(),
+                                                     hir_map.clone(),
                                                      analysis.clone(),
                                                      resolutions.clone(),
                                                      arena,
@@ -1005,7 +987,7 @@ fn print_with_analysis<'tcx, 'a: 'tcx>(sess: &'a Session,
         match ppm {
             PpmMir | PpmMirCFG => {
                 if let Some(nodeid) = nodeid {
-                    let def_id = tcx.map.local_def_id(nodeid);
+                    let def_id = tcx.hir.local_def_id(nodeid);
                     match ppm {
                         PpmMir => write_mir_pretty(tcx, iter::once(def_id), &mut out),
                         PpmMirCFG => write_mir_graphviz(tcx, iter::once(def_id), &mut out),
@@ -1030,11 +1012,11 @@ fn print_with_analysis<'tcx, 'a: 'tcx>(sess: &'a Session,
                 let nodeid =
                     nodeid.expect("`pretty flowgraph=..` needs NodeId (int) or unique path \
                                    suffix (b::c::d)");
-                let node = tcx.map.find(nodeid).unwrap_or_else(|| {
+                let node = tcx.hir.find(nodeid).unwrap_or_else(|| {
                     tcx.sess.fatal(&format!("--pretty flowgraph couldn't find id: {}", nodeid))
                 });
 
-                match blocks::Code::from_node(&tcx.map, nodeid) {
+                match blocks::Code::from_node(&tcx.hir, nodeid) {
                     Some(code) => {
                         let variants = gather_flowgraph_variants(tcx.sess);
 
@@ -1047,7 +1029,7 @@ fn print_with_analysis<'tcx, 'a: 'tcx>(sess: &'a Session,
                                                got {:?}",
                                               node);
 
-                        tcx.sess.span_fatal(tcx.map.span(nodeid), &message)
+                        tcx.sess.span_fatal(tcx.hir.span(nodeid), &message)
                     }
                 }
             }
index 4ce5f96f171ed33222845fb9d66774d2eaef2f14..59f6889ba4d94af645732e8af68cf004b56d0f30 100644 (file)
@@ -131,19 +131,19 @@ fn test_env<F>(source_string: &str,
 
     let arena = DroplessArena::new();
     let arenas = ty::GlobalArenas::new();
-    let ast_map = hir_map::map_crate(&mut hir_forest, defs);
+    let hir_map = hir_map::map_crate(&mut hir_forest, defs);
 
     // run just enough stuff to build a tcx:
-    let lang_items = lang_items::collect_language_items(&sess, &ast_map);
-    let named_region_map = resolve_lifetime::krate(&sess, &ast_map);
-    let region_map = region::resolve_crate(&sess, &ast_map);
-    let index = stability::Index::new(&ast_map);
+    let lang_items = lang_items::collect_language_items(&sess, &hir_map);
+    let named_region_map = resolve_lifetime::krate(&sess, &hir_map);
+    let region_map = region::resolve_crate(&sess, &hir_map);
+    let index = stability::Index::new(&hir_map);
     TyCtxt::create_and_enter(&sess,
                              &arenas,
                              &arena,
                              resolutions,
                              named_region_map.unwrap(),
-                             ast_map,
+                             hir_map,
                              region_map,
                              lang_items,
                              index,
@@ -197,7 +197,7 @@ pub fn create_simple_region_hierarchy(&self) {
 
     #[allow(dead_code)] // this seems like it could be useful, even if we don't use it now
     pub fn lookup_item(&self, names: &[String]) -> ast::NodeId {
-        return match search_mod(self, &self.infcx.tcx.map.krate().module, 0, names) {
+        return match search_mod(self, &self.infcx.tcx.hir.krate().module, 0, names) {
             Some(id) => id,
             None => {
                 panic!("no item found: `{}`", names.join("::"));
@@ -211,7 +211,7 @@ fn search_mod(this: &Env,
                       -> Option<ast::NodeId> {
             assert!(idx < names.len());
             for item in &m.item_ids {
-                let item = this.infcx.tcx.map.expect_item(item.id);
+                let item = this.infcx.tcx.hir.expect_item(item.id);
                 if item.name.to_string() == names[idx] {
                     return search(this, item, idx + 1, names);
                 }
index b5fe158f158cac7aead2d5fe5d8144a75243b3fa..287ee7dd13e4e5729328aa74d6c6ade039035b91 100644 (file)
@@ -79,8 +79,8 @@ pub fn assert_dep_graph<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
         let mut visitor = IfThisChanged { tcx: tcx,
                                           if_this_changed: vec![],
                                           then_this_would_need: vec![] };
-        visitor.process_attrs(ast::CRATE_NODE_ID, &tcx.map.krate().attrs);
-        tcx.map.krate().visit_all_item_likes(&mut visitor);
+        visitor.process_attrs(ast::CRATE_NODE_ID, &tcx.hir.krate().attrs);
+        tcx.hir.krate().visit_all_item_likes(&mut visitor);
         (visitor.if_this_changed, visitor.then_this_would_need)
     };
 
@@ -120,7 +120,7 @@ fn argument(&self, attr: &ast::Attribute) -> Option<ast::Name> {
     }
 
     fn process_attrs(&mut self, node_id: ast::NodeId, attrs: &[ast::Attribute]) {
-        let def_id = self.tcx.map.local_def_id(node_id);
+        let def_id = self.tcx.hir.local_def_id(node_id);
         for attr in attrs {
             if attr.check_name(ATTR_IF_THIS_CHANGED) {
                 let dep_node_interned = self.argument(attr);
index 49609fbc7984f937c84ea3ab51b227db64a7f45f..b9e6426dc01d804894568299cc771c5007600a7e 100644 (file)
@@ -102,7 +102,7 @@ fn index(&self, index: &'a DepNode<DefId>) -> &Fingerprint {
 pub fn compute_incremental_hashes_map<'a, 'tcx: 'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>)
                                                     -> IncrementalHashesMap {
     let _ignore = tcx.dep_graph.in_ignore();
-    let krate = tcx.map.krate();
+    let krate = tcx.hir.krate();
     let hash_spans = tcx.sess.opts.debuginfo != NoDebugInfo;
     let mut visitor = HashItemsVisitor {
         tcx: tcx,
@@ -141,7 +141,7 @@ impl<'a, 'tcx> HashItemsVisitor<'a, 'tcx> {
     fn calculate_node_id<W>(&mut self, id: ast::NodeId, walk_op: W)
         where W: for<'v> FnMut(&mut StrictVersionHashVisitor<'v, 'a, 'tcx>)
     {
-        let def_id = self.tcx.map.local_def_id(id);
+        let def_id = self.tcx.hir.local_def_id(id);
         self.calculate_def_id(def_id, walk_op)
     }
 
@@ -178,7 +178,7 @@ fn calculate_def_hash<W>(&mut self,
     }
 
     fn compute_crate_hash(&mut self) {
-        let krate = self.tcx.map.krate();
+        let krate = self.tcx.hir.krate();
 
         let mut crate_state = IchHasher::new();
 
index 3427a42526181c7205ade8b9f0e6549f29a0da2d..69237f406760df9ebe1ebd4c97b83e5fb276f60b 100644 (file)
@@ -561,7 +561,7 @@ macro_rules! hash_span {
 impl<'a, 'hash, 'tcx> visit::Visitor<'tcx> for StrictVersionHashVisitor<'a, 'hash, 'tcx> {
     fn nested_visit_map<'this>(&'this mut self) -> visit::NestedVisitorMap<'this, 'tcx> {
         if self.hash_bodies {
-            visit::NestedVisitorMap::OnlyBodies(&self.tcx.map)
+            visit::NestedVisitorMap::OnlyBodies(&self.tcx.hir)
         } else {
             visit::NestedVisitorMap::None
         }
index 4cefc16efe5abde89ffb4bdd9233ac2ea1a590e8..6e66dac6470f03df93ecd83f54b492be4d72742c 100644 (file)
@@ -72,7 +72,7 @@ pub fn check_dirty_clean_annotations<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
                    .collect();
     let query = tcx.dep_graph.query();
     debug!("query-nodes: {:?}", query.nodes());
-    let krate = tcx.map.krate();
+    let krate = tcx.hir.krate();
     krate.visit_all_item_likes(&mut DirtyCleanVisitor {
         tcx: tcx,
         query: &query,
@@ -171,7 +171,7 @@ fn assert_clean(&self, item: &hir::Item, dep_node: DepNode<DefId>) {
 
 impl<'a, 'tcx> ItemLikeVisitor<'tcx> for DirtyCleanVisitor<'a, 'tcx> {
     fn visit_item(&mut self, item: &'tcx hir::Item) {
-        let def_id = self.tcx.map.local_def_id(item.id);
+        let def_id = self.tcx.hir.local_def_id(item.id);
         for attr in self.tcx.get_attrs(def_id).iter() {
             if attr.check_name(ATTR_DIRTY) {
                 if check_config(self.tcx, attr) {
@@ -200,7 +200,7 @@ pub fn check_dirty_clean_metadata<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
     }
 
     tcx.dep_graph.with_ignore(||{
-        let krate = tcx.map.krate();
+        let krate = tcx.hir.krate();
         krate.visit_all_item_likes(&mut DirtyCleanMetadataVisitor {
             tcx: tcx,
             prev_metadata_hashes: prev_metadata_hashes,
@@ -217,7 +217,7 @@ pub struct DirtyCleanMetadataVisitor<'a, 'tcx:'a, 'm> {
 
 impl<'a, 'tcx, 'm> ItemLikeVisitor<'tcx> for DirtyCleanMetadataVisitor<'a, 'tcx, 'm> {
     fn visit_item(&mut self, item: &'tcx hir::Item) {
-        let def_id = self.tcx.map.local_def_id(item.id);
+        let def_id = self.tcx.hir.local_def_id(item.id);
 
         for attr in self.tcx.get_attrs(def_id).iter() {
             if attr.check_name(ATTR_DIRTY_METADATA) {
index 2baef47c214c28ae54b17906a0be338afc8e2253..d4ab31da8a31ec59064401796222bc825ce08e5e 100644 (file)
@@ -28,7 +28,7 @@ pub enum MethodLateContext {
 }
 
 pub fn method_context(cx: &LateContext, id: ast::NodeId, span: Span) -> MethodLateContext {
-    let def_id = cx.tcx.map.local_def_id(id);
+    let def_id = cx.tcx.hir.local_def_id(id);
     match cx.tcx.associated_items.borrow().get(&def_id) {
         None => span_bug!(span, "missing method descriptor?!"),
         Some(item) => {
index 8d86e7e2e8b9ea7d563465a20490a9e06989ada6..2892d61b8bd6fdf38204ffad45921ac1b4299376 100644 (file)
@@ -117,7 +117,7 @@ fn check_item(&mut self, cx: &LateContext, it: &hir::Item) {
             hir::ItemEnum(..) |
             hir::ItemStruct(..) |
             hir::ItemUnion(..) => {
-                let def_id = cx.tcx.map.local_def_id(it.id);
+                let def_id = cx.tcx.hir.local_def_id(it.id);
                 self.check_heap_type(cx, it.span, cx.tcx.item_type(def_id))
             }
             _ => ()
@@ -128,7 +128,7 @@ fn check_item(&mut self, cx: &LateContext, it: &hir::Item) {
             hir::ItemStruct(ref struct_def, _) |
             hir::ItemUnion(ref struct_def, _) => {
                 for struct_field in struct_def.fields() {
-                    let def_id = cx.tcx.map.local_def_id(struct_field.id);
+                    let def_id = cx.tcx.hir.local_def_id(struct_field.id);
                     self.check_heap_type(cx, struct_field.span,
                                          cx.tcx.item_type(def_id));
                 }
@@ -390,8 +390,8 @@ fn check_item(&mut self, cx: &LateContext, it: &hir::Item) {
                 // If the trait is private, add the impl items to private_traits so they don't get
                 // reported for missing docs.
                 let real_trait = trait_ref.path.def.def_id();
-                if let Some(node_id) = cx.tcx.map.as_local_node_id(real_trait) {
-                    match cx.tcx.map.find(node_id) {
+                if let Some(node_id) = cx.tcx.hir.as_local_node_id(real_trait) {
+                    match cx.tcx.hir.find(node_id) {
                         Some(hir_map::NodeItem(item)) => {
                             if item.vis == hir::Visibility::Inherited {
                                 for impl_item_ref in impl_item_refs {
@@ -504,21 +504,21 @@ fn check_item(&mut self, cx: &LateContext, item: &hir::Item) {
                 if ast_generics.is_parameterized() {
                     return;
                 }
-                let def = cx.tcx.lookup_adt_def(cx.tcx.map.local_def_id(item.id));
+                let def = cx.tcx.lookup_adt_def(cx.tcx.hir.local_def_id(item.id));
                 (def, cx.tcx.mk_adt(def, cx.tcx.intern_substs(&[])))
             }
             hir::ItemUnion(_, ref ast_generics) => {
                 if ast_generics.is_parameterized() {
                     return;
                 }
-                let def = cx.tcx.lookup_adt_def(cx.tcx.map.local_def_id(item.id));
+                let def = cx.tcx.lookup_adt_def(cx.tcx.hir.local_def_id(item.id));
                 (def, cx.tcx.mk_adt(def, cx.tcx.intern_substs(&[])))
             }
             hir::ItemEnum(_, ref ast_generics) => {
                 if ast_generics.is_parameterized() {
                     return;
                 }
-                let def = cx.tcx.lookup_adt_def(cx.tcx.map.local_def_id(item.id));
+                let def = cx.tcx.lookup_adt_def(cx.tcx.hir.local_def_id(item.id));
                 (def, cx.tcx.mk_adt(def, cx.tcx.intern_substs(&[])))
             }
             _ => return,
@@ -586,7 +586,7 @@ fn check_item(&mut self, cx: &LateContext, item: &hir::Item) {
             let mut impls = NodeSet();
             debug_def.for_each_impl(cx.tcx, |d| {
                 if let Some(ty_def) = cx.tcx.item_type(d).ty_to_def_id() {
-                    if let Some(node_id) = cx.tcx.map.as_local_node_id(ty_def) {
+                    if let Some(node_id) = cx.tcx.hir.as_local_node_id(ty_def) {
                         impls.insert(node_id);
                     }
                 }
@@ -680,7 +680,7 @@ fn check_fn(&mut self,
         let method = match fn_kind {
             FnKind::ItemFn(..) => None,
             FnKind::Method(..) => {
-                Some(cx.tcx.associated_item(cx.tcx.map.local_def_id(id)))
+                Some(cx.tcx.associated_item(cx.tcx.hir.local_def_id(id)))
             }
             // closures can't recur, so they don't matter.
             FnKind::Closure(_) => return,
@@ -745,7 +745,7 @@ fn check_fn(&mut self,
                 false
             };
             if self_recursive {
-                self_call_spans.push(cx.tcx.map.span(node_id));
+                self_call_spans.push(cx.tcx.hir.span(node_id));
                 // this is a self call, so we shouldn't explore past
                 // this node in the CFG.
                 continue;
@@ -788,14 +788,14 @@ fn check_fn(&mut self,
         // represents a call to the function `fn_id`/method `method`.
 
         fn expr_refers_to_this_fn(cx: &LateContext, fn_id: ast::NodeId, id: ast::NodeId) -> bool {
-            match cx.tcx.map.get(id) {
+            match cx.tcx.hir.get(id) {
                 hir_map::NodeExpr(&hir::Expr { node: hir::ExprCall(ref callee, _), .. }) => {
                     let def = if let hir::ExprPath(ref qpath) = callee.node {
                         cx.tables.qpath_def(qpath, callee.id)
                     } else {
                         return false;
                     };
-                    def.def_id() == cx.tcx.map.local_def_id(fn_id)
+                    def.def_id() == cx.tcx.hir.local_def_id(fn_id)
                 }
                 _ => false,
             }
@@ -830,7 +830,7 @@ fn expr_refers_to_this_method(cx: &LateContext,
             }
 
             // Check for calls to methods via explicit paths (e.g. `T::method()`).
-            match cx.tcx.map.get(id) {
+            match cx.tcx.hir.get(id) {
                 hir_map::NodeExpr(&hir::Expr { node: hir::ExprCall(ref callee, _), .. }) => {
                     let def = if let hir::ExprPath(ref qpath) = callee.node {
                         cx.tables.qpath_def(qpath, callee.id)
@@ -871,7 +871,7 @@ fn method_call_refers_to_method<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
                 ty::TraitContainer(trait_def_id) => {
                     let trait_ref = ty::TraitRef::from_method(tcx, trait_def_id, callee_substs);
                     let trait_ref = ty::Binder(trait_ref);
-                    let span = tcx.map.span(expr_id);
+                    let span = tcx.hir.span(expr_id);
                     let obligation =
                         traits::Obligation::new(traits::ObligationCause::misc(span, expr_id),
                                                 trait_ref.to_poly_trait_predicate());
@@ -879,7 +879,7 @@ fn method_call_refers_to_method<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
                     // unwrap() is ok here b/c `method` is the method
                     // defined in this crate whose body we are
                     // checking, so it's always local
-                    let node_id = tcx.map.as_local_node_id(method.def_id).unwrap();
+                    let node_id = tcx.hir.as_local_node_id(method.def_id).unwrap();
 
                     let param_env = ty::ParameterEnvironment::for_item(tcx, node_id);
                     tcx.infer_ctxt(param_env, Reveal::NotSpecializable).enter(|infcx| {
@@ -1151,7 +1151,7 @@ fn check_item(&mut self, ctx: &LateContext, item: &hir::Item) {
         if let hir::ItemUnion(ref vdata, _) = item.node {
             let param_env = &ty::ParameterEnvironment::for_item(ctx.tcx, item.id);
             for field in vdata.fields() {
-                let field_ty = ctx.tcx.item_type(ctx.tcx.map.local_def_id(field.id));
+                let field_ty = ctx.tcx.item_type(ctx.tcx.hir.local_def_id(field.id));
                 if ctx.tcx.type_needs_drop_given_env(field_ty, param_env) {
                     ctx.span_lint(UNIONS_WITH_DROP_FIELDS,
                                   field.span,
index 2a77e9a4a7c8b5b0c58c9d093b4de57e9b5bcf9d..532e602226450aed85fdefe7b8613bfbfe551213 100644 (file)
@@ -631,7 +631,7 @@ fn check_type_for_ffi_and_report_errors(&mut self, sp: Span, ty: Ty<'tcx>) {
     }
 
     fn check_foreign_fn(&mut self, id: ast::NodeId, decl: &hir::FnDecl) {
-        let def_id = self.cx.tcx.map.local_def_id(id);
+        let def_id = self.cx.tcx.hir.local_def_id(id);
         let sig = self.cx.tcx.item_type(def_id).fn_sig();
         let sig = self.cx.tcx.erase_late_bound_regions(&sig);
 
@@ -648,7 +648,7 @@ fn check_foreign_fn(&mut self, id: ast::NodeId, decl: &hir::FnDecl) {
     }
 
     fn check_foreign_static(&mut self, id: ast::NodeId, span: Span) {
-        let def_id = self.cx.tcx.map.local_def_id(id);
+        let def_id = self.cx.tcx.hir.local_def_id(id);
         let ty = self.cx.tcx.item_type(def_id);
         self.check_type_for_ffi_and_report_errors(span, ty);
     }
@@ -696,7 +696,7 @@ fn check_item(&mut self, cx: &LateContext, it: &hir::Item) {
         if let hir::ItemEnum(ref enum_definition, ref gens) = it.node {
             if gens.ty_params.is_empty() {
                 // sizes only make sense for non-generic types
-                let t = cx.tcx.item_type(cx.tcx.map.local_def_id(it.id));
+                let t = cx.tcx.item_type(cx.tcx.hir.local_def_id(it.id));
                 let layout = cx.tcx.infer_ctxt((), Reveal::All).enter(|infcx| {
                     let ty = cx.tcx.erase_regions(&t);
                     ty.layout(&infcx).unwrap_or_else(|e| {
index 48d9f5e72c26dab57a38b58deeb2d5879522939e..a85b47c8ada7a2c6c533567ed8ec160cfa9436af 100644 (file)
@@ -64,7 +64,7 @@ fn check_unused_mut_pat(&self, cx: &LateContext, pats: &[P<hir::Pat>]) {
         for (_, v) in &mutables {
             if !v.iter().any(|e| used_mutables.contains(e)) {
                 cx.span_lint(UNUSED_MUT,
-                             cx.tcx.map.span(v[0]),
+                             cx.tcx.hir.span(v[0]),
                              "variable does not need to be mutable");
             }
         }
index ef7bb80312eb5088a21b5a9525eb66406d947eb1..459132eb9c61394f637b9cd210ec03281c9fbdbf 100644 (file)
@@ -28,7 +28,7 @@ pub struct Ast<'tcx> {
 
 impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
     pub fn encode_body(&mut self, body_id: hir::BodyId) -> Lazy<Ast<'tcx>> {
-        let body = self.tcx.map.body(body_id);
+        let body = self.tcx.hir.body(body_id);
         let lazy_body = self.lazy(body);
 
         let tables = self.tcx.body_tables(body_id);
@@ -67,7 +67,7 @@ fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
     }
 
     fn visit_nested_body(&mut self, body: hir::BodyId) {
-        let body = self.ecx.tcx.map.body(body);
+        let body = self.ecx.tcx.hir.body(body);
         body.encode(self.ecx).unwrap();
         self.count += 1;
 
index f6107bc1359153188aad49a5ccd1cc7225860910..d100cb53a8b016649659dac39227198151119139 100644 (file)
@@ -428,7 +428,7 @@ fn maybe_get_item_body<'a>(&'tcx self,
                                def_id: DefId)
                                -> Option<&'tcx hir::Body>
     {
-        if let Some(cached) = tcx.map.get_inlined_body(def_id) {
+        if let Some(cached) = tcx.hir.get_inlined_body(def_id) {
             return Some(cached);
         }
 
index 4abdee345c2985011e4a2d9e87954652ef95d47f..101531b52afb804b54b9a6432f3a9f2ea2ee7526 100644 (file)
@@ -776,7 +776,7 @@ pub fn maybe_get_item_body(&self,
             tcx.tables.borrow_mut().insert(def_id, tcx.alloc_tables(tables));
 
             let body = ast.body.decode((self, tcx));
-            tcx.map.intern_inlined_body(def_id, body)
+            tcx.hir.intern_inlined_body(def_id, body)
         })
     }
 
index 7de768b7b9049447c6ed9995545d7a73ef918d79..2f71776ecf758db446399699903730e55b3ae2f4 100644 (file)
@@ -267,8 +267,8 @@ fn encode_enum_variant_info(&mut self,
             struct_ctor: None,
         };
 
-        let enum_id = tcx.map.as_local_node_id(enum_did).unwrap();
-        let enum_vis = &tcx.map.expect_item(enum_id).vis;
+        let enum_id = tcx.hir.as_local_node_id(enum_did).unwrap();
+        let enum_vis = &tcx.hir.expect_item(enum_id).vis;
 
         Entry {
             kind: EntryKind::Variant(self.lazy(&data)),
@@ -299,7 +299,7 @@ fn encode_info_for_mod(&mut self,
                                                                  &hir::Visibility)>)
                            -> Entry<'tcx> {
         let tcx = self.tcx;
-        let def_id = tcx.map.local_def_id(id);
+        let def_id = tcx.hir.local_def_id(id);
 
         let data = ModData {
             reexports: match self.reexports.get(&id) {
@@ -314,7 +314,7 @@ fn encode_info_for_mod(&mut self,
             span: self.lazy(&md.inner),
             attributes: self.encode_attributes(attrs),
             children: self.lazy_seq(md.item_ids.iter().map(|item_id| {
-                tcx.map.local_def_id(item_id.id).index
+                tcx.hir.local_def_id(item_id.id).index
             })),
             stability: self.encode_stability(def_id),
             deprecation: self.encode_deprecation(def_id),
@@ -361,8 +361,8 @@ fn encode_field(&mut self,
         let field = &variant.fields[field_index];
 
         let def_id = field.did;
-        let variant_id = tcx.map.as_local_node_id(variant.did).unwrap();
-        let variant_data = tcx.map.expect_variant_data(variant_id);
+        let variant_id = tcx.hir.as_local_node_id(variant.did).unwrap();
+        let variant_data = tcx.hir.expect_variant_data(variant_id);
 
         Entry {
             kind: EntryKind::Field,
@@ -394,8 +394,8 @@ fn encode_struct_ctor(&mut self, (adt_def_id, def_id): (DefId, DefId)) -> Entry<
             struct_ctor: Some(def_id.index),
         };
 
-        let struct_id = tcx.map.as_local_node_id(adt_def_id).unwrap();
-        let struct_vis = &tcx.map.expect_item(struct_id).vis;
+        let struct_id = tcx.hir.as_local_node_id(adt_def_id).unwrap();
+        let struct_vis = &tcx.hir.expect_item(struct_id).vis;
 
         Entry {
             kind: EntryKind::Struct(self.lazy(&data)),
@@ -430,8 +430,8 @@ fn encode_predicates(&mut self, def_id: DefId) -> Lazy<ty::GenericPredicates<'tc
     fn encode_info_for_trait_item(&mut self, def_id: DefId) -> Entry<'tcx> {
         let tcx = self.tcx;
 
-        let node_id = tcx.map.as_local_node_id(def_id).unwrap();
-        let ast_item = tcx.map.expect_trait_item(node_id);
+        let node_id = tcx.hir.as_local_node_id(def_id).unwrap();
+        let ast_item = tcx.hir.expect_trait_item(node_id);
         let trait_item = tcx.associated_item(def_id);
 
         let container = match trait_item.defaultness {
@@ -508,8 +508,8 @@ fn encode_info_for_trait_item(&mut self, def_id: DefId) -> Entry<'tcx> {
     }
 
     fn encode_info_for_impl_item(&mut self, def_id: DefId) -> Entry<'tcx> {
-        let node_id = self.tcx.map.as_local_node_id(def_id).unwrap();
-        let ast_item = self.tcx.map.expect_impl_item(node_id);
+        let node_id = self.tcx.hir.as_local_node_id(def_id).unwrap();
+        let ast_item = self.tcx.hir.expect_impl_item(node_id);
         let impl_item = self.tcx.associated_item(def_id);
 
         let container = match impl_item.defaultness {
@@ -576,7 +576,7 @@ fn encode_info_for_impl_item(&mut self, def_id: DefId) -> Entry<'tcx> {
     fn encode_fn_arg_names_for_body(&mut self, body_id: hir::BodyId)
                                     -> LazySeq<ast::Name> {
         let _ignore = self.tcx.dep_graph.in_ignore();
-        let body = self.tcx.map.body(body_id);
+        let body = self.tcx.hir.body(body_id);
         self.lazy_seq(body.arguments.iter().map(|arg| {
             match arg.pat.node {
                 PatKind::Binding(_, _, name, _) => name.node,
@@ -646,7 +646,7 @@ fn encode_info_for_item(&mut self, (def_id, item): (DefId, &'tcx hir::Item)) ->
                 // for methods, write all the stuff get_trait_method
                 // needs to know
                 let struct_ctor = if !struct_def.is_struct() {
-                    Some(tcx.map.local_def_id(struct_def.id()).index)
+                    Some(tcx.hir.local_def_id(struct_def.id()).index)
                 } else {
                     None
                 };
@@ -725,7 +725,7 @@ fn encode_info_for_item(&mut self, (def_id, item): (DefId, &'tcx hir::Item)) ->
                 hir::ItemForeignMod(ref fm) => {
                     self.lazy_seq(fm.items
                         .iter()
-                        .map(|foreign_item| tcx.map.local_def_id(foreign_item.id).index))
+                        .map(|foreign_item| tcx.hir.local_def_id(foreign_item.id).index))
                 }
                 hir::ItemEnum(..) => {
                     let def = self.tcx.lookup_adt_def(def_id);
@@ -855,7 +855,7 @@ impl<'a, 'b, 'tcx> IndexBuilder<'a, 'b, 'tcx> {
     /// so it's easier to do that here then to wait until we would encounter
     /// normally in the visitor walk.
     fn encode_addl_info_for_item(&mut self, item: &hir::Item) {
-        let def_id = self.tcx.map.local_def_id(item.id);
+        let def_id = self.tcx.hir.local_def_id(item.id);
         match item.node {
             hir::ItemStatic(..) |
             hir::ItemConst(..) |
@@ -883,7 +883,7 @@ fn encode_addl_info_for_item(&mut self, item: &hir::Item) {
 
                 // If the struct has a constructor, encode it.
                 if !struct_def.is_struct() {
-                    let ctor_def_id = self.tcx.map.local_def_id(struct_def.id());
+                    let ctor_def_id = self.tcx.hir.local_def_id(struct_def.id());
                     self.record(ctor_def_id,
                                 EncodeContext::encode_struct_ctor,
                                 (def_id, ctor_def_id));
@@ -957,7 +957,7 @@ struct EncodeVisitor<'a, 'b: 'a, 'tcx: 'b> {
 
 impl<'a, 'b, 'tcx> Visitor<'tcx> for EncodeVisitor<'a, 'b, 'tcx> {
     fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
-        NestedVisitorMap::OnlyBodies(&self.index.tcx.map)
+        NestedVisitorMap::OnlyBodies(&self.index.tcx.hir)
     }
     fn visit_expr(&mut self, ex: &'tcx hir::Expr) {
         intravisit::walk_expr(self, ex);
@@ -965,7 +965,7 @@ fn visit_expr(&mut self, ex: &'tcx hir::Expr) {
     }
     fn visit_item(&mut self, item: &'tcx hir::Item) {
         intravisit::walk_item(self, item);
-        let def_id = self.index.tcx.map.local_def_id(item.id);
+        let def_id = self.index.tcx.hir.local_def_id(item.id);
         match item.node {
             hir::ItemExternCrate(_) |
             hir::ItemUse(..) => (), // ignore these
@@ -975,7 +975,7 @@ fn visit_item(&mut self, item: &'tcx hir::Item) {
     }
     fn visit_foreign_item(&mut self, ni: &'tcx hir::ForeignItem) {
         intravisit::walk_foreign_item(self, ni);
-        let def_id = self.index.tcx.map.local_def_id(ni.id);
+        let def_id = self.index.tcx.hir.local_def_id(ni.id);
         self.index.record(def_id,
                           EncodeContext::encode_info_for_foreign_item,
                           (def_id, ni));
@@ -985,7 +985,7 @@ fn visit_ty(&mut self, ty: &'tcx hir::Ty) {
         self.index.encode_info_for_ty(ty);
     }
     fn visit_macro_def(&mut self, macro_def: &'tcx hir::MacroDef) {
-        let def_id = self.index.tcx.map.local_def_id(macro_def.id);
+        let def_id = self.index.tcx.hir.local_def_id(macro_def.id);
         self.index.record(def_id, EncodeContext::encode_info_for_macro_def, macro_def);
     }
 }
@@ -993,7 +993,7 @@ fn visit_macro_def(&mut self, macro_def: &'tcx hir::MacroDef) {
 impl<'a, 'b, 'tcx> IndexBuilder<'a, 'b, 'tcx> {
     fn encode_info_for_ty(&mut self, ty: &hir::Ty) {
         if let hir::TyImplTrait(_) = ty.node {
-            let def_id = self.tcx.map.local_def_id(ty.id);
+            let def_id = self.tcx.hir.local_def_id(ty.id);
             self.record(def_id, EncodeContext::encode_info_for_anon_ty, def_id);
         }
     }
@@ -1001,7 +1001,7 @@ fn encode_info_for_ty(&mut self, ty: &hir::Ty) {
     fn encode_info_for_expr(&mut self, expr: &hir::Expr) {
         match expr.node {
             hir::ExprClosure(..) => {
-                let def_id = self.tcx.map.local_def_id(expr.id);
+                let def_id = self.tcx.hir.local_def_id(expr.id);
                 self.record(def_id, EncodeContext::encode_info_for_closure, def_id);
             }
             _ => {}
@@ -1061,7 +1061,7 @@ fn encode_info_for_closure(&mut self, def_id: DefId) -> Entry<'tcx> {
     }
 
     fn encode_info_for_items(&mut self) -> Index {
-        let krate = self.tcx.map.krate();
+        let krate = self.tcx.hir.krate();
         let mut index = IndexBuilder::new(self);
         index.record(DefId::local(CRATE_DEF_INDEX),
                      EncodeContext::encode_info_for_mod,
@@ -1145,7 +1145,7 @@ fn encode_codemap(&mut self) -> LazySeq<syntax_pos::FileMap> {
     }
 
     fn encode_def_path_table(&mut self) -> Lazy<DefPathTable> {
-        let definitions = self.tcx.map.definitions();
+        let definitions = self.tcx.hir.definitions();
         self.lazy(definitions.def_path_table())
     }
 }
@@ -1158,7 +1158,7 @@ struct ImplVisitor<'a, 'tcx: 'a> {
 impl<'a, 'tcx, 'v> ItemLikeVisitor<'v> for ImplVisitor<'a, 'tcx> {
     fn visit_item(&mut self, item: &hir::Item) {
         if let hir::ItemImpl(..) = item.node {
-            let impl_id = self.tcx.map.local_def_id(item.id);
+            let impl_id = self.tcx.hir.local_def_id(item.id);
             if let Some(trait_ref) = self.tcx.impl_trait_ref(impl_id) {
                 self.impls
                     .entry(trait_ref.def_id)
@@ -1182,7 +1182,7 @@ fn encode_impls(&mut self) -> LazySeq<TraitImpls> {
             tcx: self.tcx,
             impls: FxHashMap(),
         };
-        self.tcx.map.krate().visit_all_item_likes(&mut visitor);
+        self.tcx.hir.krate().visit_all_item_likes(&mut visitor);
 
         let all_impls: Vec<_> = visitor.impls
             .into_iter()
@@ -1206,7 +1206,7 @@ fn encode_impls(&mut self) -> LazySeq<TraitImpls> {
     fn encode_exported_symbols(&mut self) -> LazySeq<DefIndex> {
         let exported_symbols = self.exported_symbols;
         let tcx = self.tcx;
-        self.lazy_seq(exported_symbols.iter().map(|&id| tcx.map.local_def_id(id).index))
+        self.lazy_seq(exported_symbols.iter().map(|&id| tcx.hir.local_def_id(id).index))
     }
 
     fn encode_dylib_dependency_formats(&mut self) -> LazySeq<Option<LinkagePreference>> {
@@ -1283,10 +1283,10 @@ fn encode_crate_root(&mut self) -> Lazy<CrateRoot> {
             plugin_registrar_fn: tcx.sess
                 .plugin_registrar_fn
                 .get()
-                .map(|id| tcx.map.local_def_id(id).index),
+                .map(|id| tcx.hir.local_def_id(id).index),
             macro_derive_registrar: if is_proc_macro {
                 let id = tcx.sess.derive_registrar_fn.get().unwrap();
-                Some(tcx.map.local_def_id(id).index)
+                Some(tcx.hir.local_def_id(id).index)
             } else {
                 None
             },
index 1a74a925454770928ff937df59978be95e5e5e33..2359c747d888d4f71dbe4a7da46772297d6b6d56 100644 (file)
@@ -90,7 +90,7 @@ fn deref_mut(&mut self) -> &mut Self::Target {
 impl<'a, 'b, 'tcx> IndexBuilder<'a, 'b, 'tcx> {
     pub fn new(ecx: &'a mut EncodeContext<'b, 'tcx>) -> Self {
         IndexBuilder {
-            items: Index::new(ecx.tcx.map.num_local_def_ids()),
+            items: Index::new(ecx.tcx.hir.num_local_def_ids()),
             ecx: ecx,
         }
     }
@@ -186,7 +186,7 @@ macro_rules! read_hir {
     ($t:ty) => {
         impl<'tcx> DepGraphRead for &'tcx $t {
             fn read(&self, tcx: TyCtxt) {
-                tcx.map.read(self.id);
+                tcx.hir.read(self.id);
             }
         }
     }
@@ -220,6 +220,6 @@ fn read(&self, _tcx: TyCtxt) {}
 
 impl<T> DepGraphRead for FromId<T> {
     fn read(&self, tcx: TyCtxt) {
-        tcx.map.read(self.0);
+        tcx.hir.read(self.0);
     }
 }
index 2c7b47c7669993ff03dbe84e57a05e71bc4c47c9..73d3875ba2384866ffbd9e14d034d739b9bffe53 100644 (file)
@@ -58,7 +58,7 @@ pub fn ast_block(&mut self,
                         let_extent_stack.push(remainder_scope);
 
                         // Declare the bindings, which may create a visibility scope.
-                        let remainder_span = remainder_scope.span(&tcx.region_maps, &tcx.map);
+                        let remainder_span = remainder_scope.span(&tcx.region_maps, &tcx.hir);
                         let remainder_span = remainder_span.unwrap_or(span);
                         let scope = this.declare_bindings(None, remainder_span, &pattern);
 
index 7347841a5f1ef396ecd473c467601891cb4cda88..ecdc58ba55d6cbfef15d5d1eb20477b45ad5739c 100644 (file)
@@ -133,7 +133,7 @@ pub fn construct_fn<'a, 'gcx, 'tcx, A>(hir: Cx<'a, 'gcx, 'tcx>,
     let arguments: Vec<_> = arguments.collect();
 
     let tcx = hir.tcx();
-    let span = tcx.map.span(fn_id);
+    let span = tcx.hir.span(fn_id);
     let mut builder = Builder::new(hir, span, arguments.len(), return_ty);
 
     let call_site_extent =
@@ -168,7 +168,7 @@ pub fn construct_fn<'a, 'gcx, 'tcx, A>(hir: Cx<'a, 'gcx, 'tcx>,
     // Gather the upvars of a closure, if any.
     let upvar_decls: Vec<_> = tcx.with_freevars(fn_id, |freevars| {
         freevars.iter().map(|fv| {
-            let var_id = tcx.map.as_local_node_id(fv.def.def_id()).unwrap();
+            let var_id = tcx.hir.as_local_node_id(fv.def.def_id()).unwrap();
             let by_ref = hir.tables().upvar_capture(ty::UpvarId {
                 var_id: var_id,
                 closure_expr_id: fn_id
@@ -180,7 +180,7 @@ pub fn construct_fn<'a, 'gcx, 'tcx, A>(hir: Cx<'a, 'gcx, 'tcx>,
                 debug_name: keywords::Invalid.name(),
                 by_ref: by_ref
             };
-            if let Some(hir::map::NodeLocal(pat)) = tcx.map.find(var_id) {
+            if let Some(hir::map::NodeLocal(pat)) = tcx.hir.find(var_id) {
                 if let hir::PatKind::Binding(_, _, ref ident, _) = pat.node {
                     decl.debug_name = ident.node;
                 }
@@ -198,9 +198,9 @@ pub fn construct_const<'a, 'gcx, 'tcx>(hir: Cx<'a, 'gcx, 'tcx>,
                                        body_id: hir::BodyId)
                                        -> Mir<'tcx> {
     let tcx = hir.tcx();
-    let ast_expr = &tcx.map.body(body_id).value;
+    let ast_expr = &tcx.hir.body(body_id).value;
     let ty = hir.tables().expr_ty_adjusted(ast_expr);
-    let span = tcx.map.span(tcx.map.body_owner(body_id));
+    let span = tcx.hir.span(tcx.hir.body_owner(body_id));
     let mut builder = Builder::new(hir, span, 0, ty);
 
     let extent = tcx.region_maps.temporary_scope(ast_expr.id)
index 59a11782e08566744d1e027849a56e60e8506ce4..c702a142fab342fc1520b5643565d544be117d75 100644 (file)
@@ -499,7 +499,7 @@ pub fn schedule_drop(&mut self,
                     scope.needs_cleanup = true;
                 }
                 let tcx = self.hir.tcx();
-                let extent_span = extent.span(&tcx.region_maps, &tcx.map).unwrap();
+                let extent_span = extent.span(&tcx.region_maps, &tcx.hir).unwrap();
                 // Attribute scope exit drops to scope's closing brace
                 let scope_end = Span { lo: extent_span.hi, .. extent_span};
                 scope.drops.push(DropData {
index dd4dd4699d858f95a0a546a33c5fcdcbaade1881..91600b947c6106b96fce3887c8a99cee6f96371b 100644 (file)
@@ -26,7 +26,7 @@ pub fn write_mir_graphviz<'a, 'b, 'tcx, W, I>(tcx: TyCtxt<'b, 'tcx, 'tcx>,
     where W: Write, I: Iterator<Item=DefId>
 {
     for def_id in iter {
-        let nodeid = tcx.map.as_local_node_id(def_id).unwrap();
+        let nodeid = tcx.hir.as_local_node_id(def_id).unwrap();
         let mir = &tcx.item_mir(def_id);
 
         writeln!(w, "digraph Mir_{} {{", nodeid)?;
index cdf7cae3020c891e83bf4ef4742163f11bdffc37..c4c6ec6b8f40067ee7dab254d01a888311c80742 100644 (file)
@@ -574,7 +574,7 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>,
         // Now comes the rote stuff:
         hir::ExprRepeat(ref v, count) => {
             let tcx = cx.tcx.global_tcx();
-            let c = &cx.tcx.map.body(count).value;
+            let c = &cx.tcx.hir.body(count).value;
             let count = match ConstContext::new(tcx, count).eval(c, EvalHint::ExprTypeChecked) {
                 Ok(ConstVal::Integral(ConstInt::Usize(u))) => u,
                 Ok(other) => bug!("constant evaluation of repeat count yielded {:?}", other),
@@ -765,19 +765,19 @@ fn convert_var<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>,
 
     match def {
         Def::Local(def_id) => {
-            let node_id = cx.tcx.map.as_local_node_id(def_id).unwrap();
+            let node_id = cx.tcx.hir.as_local_node_id(def_id).unwrap();
             ExprKind::VarRef { id: node_id }
         }
 
         Def::Upvar(def_id, index, closure_expr_id) => {
-            let id_var = cx.tcx.map.as_local_node_id(def_id).unwrap();
+            let id_var = cx.tcx.hir.as_local_node_id(def_id).unwrap();
             debug!("convert_var(upvar({:?}, {:?}, {:?}))",
                    id_var,
                    index,
                    closure_expr_id);
             let var_ty = cx.tables().node_id_to_type(id_var);
 
-            let body_id = match cx.tcx.map.find(closure_expr_id) {
+            let body_id = match cx.tcx.hir.find(closure_expr_id) {
                 Some(map::NodeExpr(expr)) => {
                     match expr.node {
                         hir::ExprClosure(.., body, _) => body.node_id,
@@ -803,7 +803,7 @@ fn convert_var<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>,
             });
             let region = cx.tcx.mk_region(region);
 
-            let self_expr = match cx.tcx.closure_kind(cx.tcx.map.local_def_id(closure_expr_id)) {
+            let self_expr = match cx.tcx.closure_kind(cx.tcx.hir.local_def_id(closure_expr_id)) {
                 ty::ClosureKind::Fn => {
                     let ref_closure_ty = cx.tcx.mk_ref(region,
                                                        ty::TypeAndMut {
@@ -1013,7 +1013,7 @@ fn capture_freevar<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>,
                                    freevar: &hir::Freevar,
                                    freevar_ty: Ty<'tcx>)
                                    -> ExprRef<'tcx> {
-    let id_var = cx.tcx.map.as_local_node_id(freevar.def.def_id()).unwrap();
+    let id_var = cx.tcx.hir.as_local_node_id(freevar.def.def_id()).unwrap();
     let upvar_id = ty::UpvarId {
         var_id: id_var,
         closure_expr_id: closure_expr.id,
index 533d804a23651a7bc884ad02ab27b8dedfa421ce..5b3297cb694e855f5f3e305dbb05c621a2018319 100644 (file)
@@ -45,13 +45,13 @@ pub fn new(infcx: &'a InferCtxt<'a, 'gcx, 'tcx>, src: MirSource) -> Cx<'a, 'gcx,
             MirSource::Const(_) |
             MirSource::Static(..) => hir::Constness::Const,
             MirSource::Fn(id) => {
-                let fn_like = FnLikeNode::from_node(infcx.tcx.map.get(id));
+                let fn_like = FnLikeNode::from_node(infcx.tcx.hir.get(id));
                 fn_like.map_or(hir::Constness::NotConst, |f| f.constness())
             }
             MirSource::Promoted(..) => bug!(),
         };
 
-        let attrs = infcx.tcx.map.attrs(src.item_id());
+        let attrs = infcx.tcx.hir.attrs(src.item_id());
 
         // Some functions always have overflow checks enabled,
         // however, they may not get codegen'd, depending on
index 453c3e43b6b86c6e7955fafb153ea11384c71399..c71255dcc7c61fec7d5c15fd4a05f8652ea53723 100644 (file)
@@ -84,7 +84,7 @@ fn build<'a, 'gcx, 'tcx>(infcx: &InferCtxt<'a, 'gcx, 'tcx>,
                          -> (Mir<'tcx>, MirSource) {
     let tcx = infcx.tcx.global_tcx();
 
-    let item_id = tcx.map.body_owner(body_id);
+    let item_id = tcx.hir.body_owner(body_id);
     let src = MirSource::from_node(tcx, item_id);
     let cx = Cx::new(infcx, src);
     if let MirSource::Fn(id) = src {
@@ -92,14 +92,14 @@ fn build<'a, 'gcx, 'tcx>(infcx: &InferCtxt<'a, 'gcx, 'tcx>,
         // types/lifetimes replaced)
         let fn_sig = cx.tables().liberated_fn_sigs[&id].clone();
 
-        let ty = tcx.item_type(tcx.map.local_def_id(id));
+        let ty = tcx.item_type(tcx.hir.local_def_id(id));
         let (abi, implicit_argument) = if let ty::TyClosure(..) = ty.sty {
             (Abi::Rust, Some((closure_self_ty(tcx, id, body_id), None)))
         } else {
             (ty.fn_abi(), None)
         };
 
-        let body = tcx.map.body(body_id);
+        let body = tcx.hir.body(body_id);
         let explicit_arguments =
             body.arguments
                 .iter()
@@ -138,11 +138,11 @@ fn visit_nested_body(&mut self, body_id: hir::BodyId) {
             pretty::dump_mir(tcx, "mir_map", &0, src, &mir);
 
             let mir = tcx.alloc_mir(mir);
-            let def_id = tcx.map.local_def_id(src.item_id());
+            let def_id = tcx.hir.local_def_id(src.item_id());
             assert!(tcx.mir_map.borrow_mut().insert(def_id, mir).is_none());
         });
 
-        let body = self.tcx.map.body(body_id);
+        let body = self.tcx.hir.body(body_id);
         self.visit_body(body);
     }
 }
@@ -162,7 +162,7 @@ fn closure_self_ty<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
     });
     let region = tcx.mk_region(region);
 
-    match tcx.closure_kind(tcx.map.local_def_id(closure_expr_id)) {
+    match tcx.closure_kind(tcx.hir.local_def_id(closure_expr_id)) {
         ty::ClosureKind::Fn =>
             tcx.mk_ref(region,
                        ty::TypeAndMut { ty: closure_ty,
index e7188d536980fccde9dd1d76342a0aaa8761e9a8..bfe3e143e7c50697c5c04fdbccc08935c8f9f048 100644 (file)
@@ -48,7 +48,7 @@ pub fn dump_mir<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
         Some(ref filters) => filters,
     };
     let node_id = src.item_id();
-    let node_path = tcx.item_path_str(tcx.map.local_def_id(node_id));
+    let node_path = tcx.item_path_str(tcx.hir.local_def_id(node_id));
     let is_matched =
         filters.split("&")
                .any(|filter| {
@@ -102,7 +102,7 @@ pub fn write_mir_pretty<'a, 'b, 'tcx, I>(tcx: TyCtxt<'b, 'tcx, 'tcx>,
             writeln!(w, "")?;
         }
 
-        let id = tcx.map.as_local_node_id(def_id).unwrap();
+        let id = tcx.hir.as_local_node_id(def_id).unwrap();
         let src = MirSource::from_node(tcx, id);
         write_mir_fn(tcx, src, mir, w)?;
 
index 3cbf8573ba97fdf67a25b36a708eca03b0e24b4a..2194c20c2f442fe3e62dff7771f6c5623c4fb3b7 100644 (file)
@@ -57,7 +57,7 @@ fn run_pass<'a>(&mut self,
                 return
             }
             MirSource::Fn(function_node_id) => {
-                if qualify_consts::is_const_fn(tcx, tcx.map.local_def_id(function_node_id)) {
+                if qualify_consts::is_const_fn(tcx, tcx.hir.local_def_id(function_node_id)) {
                     // Don't run on const functions, as, again, trans might not be able to evaluate
                     // the optimized IR.
                     return
index 771f05f7bccfe3223307d0001a85e8c2ae7b0231..3a93bef36c5f77c958f21ac9918ac6e15774cbbd 100644 (file)
@@ -21,7 +21,7 @@ impl<'tcx> MirPass<'tcx> for Deaggregator {
     fn run_pass<'a>(&mut self, tcx: TyCtxt<'a, 'tcx, 'tcx>,
                     source: MirSource, mir: &mut Mir<'tcx>) {
         let node_id = source.item_id();
-        let node_path = tcx.item_path_str(tcx.map.local_def_id(node_id));
+        let node_path = tcx.item_path_str(tcx.hir.local_def_id(node_id));
         debug!("running on: {:?}", node_path);
         // we only run when mir_opt_level > 2
         if tcx.sess.opts.debugging_opts.mir_opt_level <= 2 {
index fea27ee5c54837736cc049d957cb7b835ad10a4e..af9f7fb5781386b6454d7e6efc32ef17de3365ce 100644 (file)
@@ -115,8 +115,8 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
 }
 
 pub fn is_const_fn(tcx: TyCtxt, def_id: DefId) -> bool {
-    if let Some(node_id) = tcx.map.as_local_node_id(def_id) {
-        if let Some(fn_like) = FnLikeNode::from_node(tcx.map.get(node_id)) {
+    if let Some(node_id) = tcx.hir.as_local_node_id(def_id) {
+        if let Some(fn_like) = FnLikeNode::from_node(tcx.hir.get(node_id)) {
             fn_like.constness() == hir::Constness::Const
         } else {
             false
@@ -267,15 +267,15 @@ fn find_drop_implementation_method_span(&self) -> Option<Span> {
                 self.tcx
                     .lookup_trait_def(drop_trait_id)
                     .for_each_relevant_impl(self.tcx, self.mir.return_ty, |impl_did| {
-                        self.tcx.map
+                        self.tcx.hir
                             .as_local_node_id(impl_did)
-                            .and_then(|impl_node_id| self.tcx.map.find(impl_node_id))
+                            .and_then(|impl_node_id| self.tcx.hir.find(impl_node_id))
                             .map(|node| {
                                 if let hir_map::NodeItem(item) = node {
                                     if let hir::ItemImpl(.., ref impl_item_refs) = item.node {
                                         span = impl_item_refs.first()
                                                              .map(|iiref| {
-                                                                 self.tcx.map.impl_item(iiref.id)
+                                                                 self.tcx.hir.impl_item(iiref.id)
                                                                              .span
                                                              });
                                     }
@@ -953,7 +953,7 @@ fn qualify_const_item_cached<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
     }
 
     let param_env = if def_id.is_local() {
-        let node_id = tcx.map.as_local_node_id(def_id).unwrap();
+        let node_id = tcx.hir.as_local_node_id(def_id).unwrap();
         ty::ParameterEnvironment::for_item(tcx, node_id)
     } else {
         // These should only be monomorphic constants.
@@ -978,7 +978,7 @@ impl<'tcx> MirPass<'tcx> for QualifyAndPromoteConstants {
     fn run_pass<'a>(&mut self, tcx: TyCtxt<'a, 'tcx, 'tcx>,
                     src: MirSource, mir: &mut Mir<'tcx>) {
         let id = src.item_id();
-        let def_id = tcx.map.local_def_id(id);
+        let def_id = tcx.hir.local_def_id(id);
         let mode = match src {
             MirSource::Fn(_) => {
                 if is_const_fn(tcx, def_id) {
index fa148da2e3996bdd00022c0a345b8ff09af3dff7..b6241c618df2f01507a9f06e923bd846bdd0f0de 100644 (file)
@@ -98,8 +98,8 @@ fn add_type(&mut self, ty: Ty<'gcx>) {
     fn handle_const_fn_call(&mut self, def_id: DefId, ret_ty: Ty<'gcx>) {
         self.add_type(ret_ty);
 
-        self.promotable &= if let Some(fn_id) = self.tcx.map.as_local_node_id(def_id) {
-            FnLikeNode::from_node(self.tcx.map.get(fn_id)).map_or(false, |fn_like| {
+        self.promotable &= if let Some(fn_id) = self.tcx.hir.as_local_node_id(def_id) {
+            FnLikeNode::from_node(self.tcx.hir.get(fn_id)).map_or(false, |fn_like| {
                 fn_like.constness() == hir::Constness::Const
             })
         } else {
@@ -122,7 +122,7 @@ fn visit_nested_body(&mut self, body_id: hir::BodyId) {
             }
         }
 
-        let item_id = self.tcx.map.body_owner(body_id);
+        let item_id = self.tcx.hir.body_owner(body_id);
 
         let outer_in_fn = self.in_fn;
         self.in_fn = match MirSource::from_node(self.tcx, item_id) {
@@ -131,9 +131,9 @@ fn visit_nested_body(&mut self, body_id: hir::BodyId) {
         };
 
         let outer_tables = self.tables;
-        self.tables = self.tcx.item_tables(self.tcx.map.local_def_id(item_id));
+        self.tables = self.tcx.item_tables(self.tcx.hir.local_def_id(item_id));
 
-        let body = self.tcx.map.body(body_id);
+        let body = self.tcx.hir.body(body_id);
         if !self.in_fn {
             self.check_const_eval(&body.value);
         }
@@ -329,8 +329,8 @@ fn check_expr<'a, 'tcx>(v: &mut CheckCrateVisitor<'a, 'tcx>, e: &hir::Expr, node
                 Def::Fn(..) | Def::Method(..) => {}
                 Def::AssociatedConst(_) => v.add_type(node_ty),
                 Def::Const(did) => {
-                    v.promotable &= if let Some(node_id) = v.tcx.map.as_local_node_id(did) {
-                        match v.tcx.map.expect_item(node_id).node {
+                    v.promotable &= if let Some(node_id) = v.tcx.hir.as_local_node_id(did) {
+                        match v.tcx.hir.expect_item(node_id).node {
                             hir::ItemConst(_, body) => {
                                 v.visit_nested_body(body);
                                 v.tcx.rvalue_promotable_to_static.borrow()[&body.node_id]
index df9fe00e9a88e23d99f9e248d6843b0c12610a14..a5bd69fff0138b73e71f7da9dce746733db4b670 100644 (file)
@@ -43,9 +43,9 @@ enum Context {
 }
 
 #[derive(Copy, Clone)]
-struct CheckLoopVisitor<'a, 'ast: 'a> {
+struct CheckLoopVisitor<'a, 'hir: 'a> {
     sess: &'a Session,
-    hir_map: &'a Map<'ast>,
+    hir_map: &'a Map<'hir>,
     cx: Context,
 }
 
@@ -59,20 +59,20 @@ pub fn check_crate(sess: &Session, map: &Map) {
     }.as_deep_visitor());
 }
 
-impl<'a, 'ast> Visitor<'ast> for CheckLoopVisitor<'a, 'ast> {
-    fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'ast> {
+impl<'a, 'hir> Visitor<'hir> for CheckLoopVisitor<'a, 'hir> {
+    fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'hir> {
         NestedVisitorMap::OnlyBodies(&self.hir_map)
     }
 
-    fn visit_item(&mut self, i: &'ast hir::Item) {
+    fn visit_item(&mut self, i: &'hir hir::Item) {
         self.with_context(Normal, |v| intravisit::walk_item(v, i));
     }
 
-    fn visit_impl_item(&mut self, i: &'ast hir::ImplItem) {
+    fn visit_impl_item(&mut self, i: &'hir hir::ImplItem) {
         self.with_context(Normal, |v| intravisit::walk_impl_item(v, i));
     }
 
-    fn visit_expr(&mut self, e: &'ast hir::Expr) {
+    fn visit_expr(&mut self, e: &'hir hir::Expr) {
         match e.node {
             hir::ExprWhile(ref e, ref b, _) => {
                 self.with_context(Loop(LoopKind::WhileLoop), |v| {
@@ -125,9 +125,9 @@ fn visit_expr(&mut self, e: &'ast hir::Expr) {
     }
 }
 
-impl<'a, 'ast> CheckLoopVisitor<'a, 'ast> {
+impl<'a, 'hir> CheckLoopVisitor<'a, 'hir> {
     fn with_context<F>(&mut self, cx: Context, f: F)
-        where F: FnOnce(&mut CheckLoopVisitor<'a, 'ast>)
+        where F: FnOnce(&mut CheckLoopVisitor<'a, 'hir>)
     {
         let old_cx = self.cx;
         self.cx = cx;
index 78b591a48cca5f23e02f50e4f1b06ebb4566b096..9de5ff541a52c98d6bfb799493644aacfca67028 100644 (file)
@@ -37,7 +37,7 @@ fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
     }
 
     fn visit_nested_body(&mut self, body_id: hir::BodyId) {
-        let body = self.tcx.map.body(body_id);
+        let body = self.tcx.hir.body(body_id);
         self.tcx.infer_ctxt(body_id, Reveal::NotSpecializable).enter(|infcx| {
             let mut delegate = RvalueContextDelegate {
                 tcx: infcx.tcx,
index ba4fc57276b2ce21a2709b118ef6098d7785676b..1ef8a5b0080f3ca2451bf714f27a0db582b67774 100644 (file)
@@ -12,7 +12,7 @@
 // recursively.
 
 use rustc::dep_graph::DepNode;
-use rustc::hir::map as ast_map;
+use rustc::hir::map as hir_map;
 use rustc::session::{CompileResult, Session};
 use rustc::hir::def::{Def, CtorKind};
 use rustc::util::nodemap::{NodeMap, NodeSet};
@@ -23,9 +23,9 @@
 use rustc::hir::intravisit::{self, Visitor, NestedVisitorMap};
 use rustc::hir;
 
-struct CheckCrateVisitor<'a, 'ast: 'a> {
+struct CheckCrateVisitor<'a, 'hir: 'a> {
     sess: &'a Session,
-    ast_map: &'a ast_map::Map<'ast>,
+    hir_map: &'a hir_map::Map<'hir>,
     // `discriminant_map` is a cache that associates the `NodeId`s of local
     // variant definitions with the discriminant expression that applies to
     // each one. If the variant uses the default values (starting from `0`),
@@ -34,12 +34,12 @@ struct CheckCrateVisitor<'a, 'ast: 'a> {
     detected_recursive_ids: NodeSet,
 }
 
-impl<'a, 'ast: 'a> Visitor<'ast> for CheckCrateVisitor<'a, 'ast> {
-    fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'ast> {
+impl<'a, 'hir: 'a> Visitor<'hir> for CheckCrateVisitor<'a, 'hir> {
+    fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'hir> {
         NestedVisitorMap::None
     }
 
-    fn visit_item(&mut self, it: &'ast hir::Item) {
+    fn visit_item(&mut self, it: &'hir hir::Item) {
         match it.node {
             hir::ItemStatic(..) |
             hir::ItemConst(..) => {
@@ -64,7 +64,7 @@ fn visit_item(&mut self, it: &'ast hir::Item) {
         intravisit::walk_item(self, it)
     }
 
-    fn visit_trait_item(&mut self, ti: &'ast hir::TraitItem) {
+    fn visit_trait_item(&mut self, ti: &'hir hir::TraitItem) {
         match ti.node {
             hir::TraitItemKind::Const(_, ref default) => {
                 if let Some(_) = *default {
@@ -77,7 +77,7 @@ fn visit_trait_item(&mut self, ti: &'ast hir::TraitItem) {
         intravisit::walk_trait_item(self, ti)
     }
 
-    fn visit_impl_item(&mut self, ii: &'ast hir::ImplItem) {
+    fn visit_impl_item(&mut self, ii: &'hir hir::ImplItem) {
         match ii.node {
             hir::ImplItemKind::Const(..) => {
                 let mut recursion_visitor = CheckItemRecursionVisitor::new(self, &ii.span);
@@ -89,36 +89,36 @@ fn visit_impl_item(&mut self, ii: &'ast hir::ImplItem) {
     }
 }
 
-pub fn check_crate<'ast>(sess: &Session, ast_map: &ast_map::Map<'ast>) -> CompileResult {
-    let _task = ast_map.dep_graph.in_task(DepNode::CheckStaticRecursion);
+pub fn check_crate<'hir>(sess: &Session, hir_map: &hir_map::Map<'hir>) -> CompileResult {
+    let _task = hir_map.dep_graph.in_task(DepNode::CheckStaticRecursion);
 
     let mut visitor = CheckCrateVisitor {
         sess: sess,
-        ast_map: ast_map,
+        hir_map: hir_map,
         discriminant_map: NodeMap(),
         detected_recursive_ids: NodeSet(),
     };
     sess.track_errors(|| {
         // FIXME(#37712) could use ItemLikeVisitor if trait items were item-like
-        ast_map.krate().visit_all_item_likes(&mut visitor.as_deep_visitor());
+        hir_map.krate().visit_all_item_likes(&mut visitor.as_deep_visitor());
     })
 }
 
-struct CheckItemRecursionVisitor<'a, 'b: 'a, 'ast: 'b> {
+struct CheckItemRecursionVisitor<'a, 'b: 'a, 'hir: 'b> {
     root_span: &'b Span,
     sess: &'b Session,
-    ast_map: &'b ast_map::Map<'ast>,
+    hir_map: &'b hir_map::Map<'hir>,
     discriminant_map: &'a mut NodeMap<Option<hir::BodyId>>,
     idstack: Vec<ast::NodeId>,
     detected_recursive_ids: &'a mut NodeSet,
 }
 
-impl<'a, 'b: 'a, 'ast: 'b> CheckItemRecursionVisitor<'a, 'b, 'ast> {
-    fn new(v: &'a mut CheckCrateVisitor<'b, 'ast>, span: &'b Span) -> Self {
+impl<'a, 'b: 'a, 'hir: 'b> CheckItemRecursionVisitor<'a, 'b, 'hir> {
+    fn new(v: &'a mut CheckCrateVisitor<'b, 'hir>, span: &'b Span) -> Self {
         CheckItemRecursionVisitor {
             root_span: span,
             sess: v.sess,
-            ast_map: v.ast_map,
+            hir_map: v.hir_map,
             discriminant_map: &mut v.discriminant_map,
             idstack: Vec::new(),
             detected_recursive_ids: &mut v.detected_recursive_ids,
@@ -133,7 +133,7 @@ fn with_item_id_pushed<F>(&mut self, id: ast::NodeId, f: F, span: Span)
             }
             self.detected_recursive_ids.insert(id);
             let any_static = self.idstack.iter().any(|&x| {
-                if let ast_map::NodeItem(item) = self.ast_map.get(x) {
+                if let hir_map::NodeItem(item) = self.hir_map.get(x) {
                     if let hir::ItemStatic(..) = item.node {
                         true
                     } else {
@@ -170,7 +170,7 @@ fn with_item_id_pushed<F>(&mut self, id: ast::NodeId, f: F, span: Span)
     // So for every variant, we need to track whether there is an expression
     // somewhere in the enum definition that controls its discriminant. We do
     // this by starting from the end and searching backward.
-    fn populate_enum_discriminants(&mut self, enum_definition: &'ast hir::EnumDef) {
+    fn populate_enum_discriminants(&mut self, enum_definition: &'hir hir::EnumDef) {
         // Get the map, and return if we already processed this enum or if it
         // has no variants.
         match enum_definition.variants.first() {
@@ -204,17 +204,17 @@ fn populate_enum_discriminants(&mut self, enum_definition: &'ast hir::EnumDef) {
     }
 }
 
-impl<'a, 'b: 'a, 'ast: 'b> Visitor<'ast> for CheckItemRecursionVisitor<'a, 'b, 'ast> {
-    fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'ast> {
-        NestedVisitorMap::OnlyBodies(&self.ast_map)
+impl<'a, 'b: 'a, 'hir: 'b> Visitor<'hir> for CheckItemRecursionVisitor<'a, 'b, 'hir> {
+    fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'hir> {
+        NestedVisitorMap::OnlyBodies(&self.hir_map)
     }
-    fn visit_item(&mut self, it: &'ast hir::Item) {
+    fn visit_item(&mut self, it: &'hir hir::Item) {
         self.with_item_id_pushed(it.id, |v| intravisit::walk_item(v, it), it.span);
     }
 
     fn visit_enum_def(&mut self,
-                      enum_definition: &'ast hir::EnumDef,
-                      generics: &'ast hir::Generics,
+                      enum_definition: &'hir hir::EnumDef,
+                      generics: &'hir hir::Generics,
                       item_id: ast::NodeId,
                       _: Span) {
         self.populate_enum_discriminants(enum_definition);
@@ -222,8 +222,8 @@ fn visit_enum_def(&mut self,
     }
 
     fn visit_variant(&mut self,
-                     variant: &'ast hir::Variant,
-                     _: &'ast hir::Generics,
+                     variant: &'hir hir::Variant,
+                     _: &'hir hir::Generics,
                      _: ast::NodeId) {
         let variant_id = variant.node.data.id();
         let maybe_expr = *self.discriminant_map.get(&variant_id).unwrap_or_else(|| {
@@ -234,34 +234,34 @@ fn visit_variant(&mut self,
         // If `maybe_expr` is `None`, that's because no discriminant is
         // specified that affects this variant. Thus, no risk of recursion.
         if let Some(expr) = maybe_expr {
-            let expr = &self.ast_map.body(expr).value;
+            let expr = &self.hir_map.body(expr).value;
             self.with_item_id_pushed(expr.id, |v| intravisit::walk_expr(v, expr), expr.span);
         }
     }
 
-    fn visit_trait_item(&mut self, ti: &'ast hir::TraitItem) {
+    fn visit_trait_item(&mut self, ti: &'hir hir::TraitItem) {
         self.with_item_id_pushed(ti.id, |v| intravisit::walk_trait_item(v, ti), ti.span);
     }
 
-    fn visit_impl_item(&mut self, ii: &'ast hir::ImplItem) {
+    fn visit_impl_item(&mut self, ii: &'hir hir::ImplItem) {
         self.with_item_id_pushed(ii.id, |v| intravisit::walk_impl_item(v, ii), ii.span);
     }
 
-    fn visit_path(&mut self, path: &'ast hir::Path, _: ast::NodeId) {
+    fn visit_path(&mut self, path: &'hir hir::Path, _: ast::NodeId) {
         match path.def {
             Def::Static(def_id, _) |
             Def::AssociatedConst(def_id) |
             Def::Const(def_id) => {
-                if let Some(node_id) = self.ast_map.as_local_node_id(def_id) {
-                    match self.ast_map.get(node_id) {
-                        ast_map::NodeItem(item) => self.visit_item(item),
-                        ast_map::NodeTraitItem(item) => self.visit_trait_item(item),
-                        ast_map::NodeImplItem(item) => self.visit_impl_item(item),
-                        ast_map::NodeForeignItem(_) => {}
+                if let Some(node_id) = self.hir_map.as_local_node_id(def_id) {
+                    match self.hir_map.get(node_id) {
+                        hir_map::NodeItem(item) => self.visit_item(item),
+                        hir_map::NodeTraitItem(item) => self.visit_trait_item(item),
+                        hir_map::NodeImplItem(item) => self.visit_impl_item(item),
+                        hir_map::NodeForeignItem(_) => {}
                         _ => {
                             span_bug!(path.span,
                                       "expected item, found {}",
-                                      self.ast_map.node_to_string(node_id));
+                                      self.hir_map.node_to_string(node_id));
                         }
                     }
                 }
@@ -271,10 +271,10 @@ fn visit_path(&mut self, path: &'ast hir::Path, _: ast::NodeId) {
             // the whole enum definition to see what expression that
             // might be (if any).
             Def::VariantCtor(variant_id, CtorKind::Const) => {
-                if let Some(variant_id) = self.ast_map.as_local_node_id(variant_id) {
-                    let variant = self.ast_map.expect_variant(variant_id);
-                    let enum_id = self.ast_map.get_parent(variant_id);
-                    let enum_item = self.ast_map.expect_item(enum_id);
+                if let Some(variant_id) = self.hir_map.as_local_node_id(variant_id) {
+                    let variant = self.hir_map.expect_variant(variant_id);
+                    let enum_id = self.hir_map.get_parent(variant_id);
+                    let enum_item = self.hir_map.expect_item(enum_id);
                     if let hir::ItemEnum(ref enum_def, ref generics) = enum_item.node {
                         self.populate_enum_discriminants(enum_def);
                         self.visit_variant(variant, generics, enum_id);
index 445da5a8c3f4ee13df7fca0c8c60ae2747870caf..7357d6f38b651a0d3a5d25a71ba873452db3bcba 100644 (file)
@@ -75,7 +75,7 @@ fn item_ty_level(&self, item_def_id: DefId) -> Option<AccessLevel> {
             ty::TyProjection(ref proj) => proj.trait_ref.def_id,
             _ => return Some(AccessLevel::Public)
         };
-        if let Some(node_id) = self.tcx.map.as_local_node_id(ty_def_id) {
+        if let Some(node_id) = self.tcx.hir.as_local_node_id(ty_def_id) {
             self.get(node_id)
         } else {
             Some(AccessLevel::Public)
@@ -84,7 +84,7 @@ fn item_ty_level(&self, item_def_id: DefId) -> Option<AccessLevel> {
 
     fn impl_trait_level(&self, impl_def_id: DefId) -> Option<AccessLevel> {
         if let Some(trait_ref) = self.tcx.impl_trait_ref(impl_def_id) {
-            if let Some(node_id) = self.tcx.map.as_local_node_id(trait_ref.def_id) {
+            if let Some(node_id) = self.tcx.hir.as_local_node_id(trait_ref.def_id) {
                 return self.get(node_id);
             }
         }
@@ -111,7 +111,7 @@ fn update(&mut self, id: ast::NodeId, level: Option<AccessLevel>) -> Option<Acce
     fn reach<'b>(&'b mut self, item_id: ast::NodeId)
                  -> ReachEverythingInTheInterfaceVisitor<'b, 'a, 'tcx> {
         ReachEverythingInTheInterfaceVisitor {
-            item_def_id: self.tcx.map.local_def_id(item_id),
+            item_def_id: self.tcx.hir.local_def_id(item_id),
             ev: self,
         }
     }
@@ -121,18 +121,18 @@ impl<'a, 'tcx> Visitor<'tcx> for EmbargoVisitor<'a, 'tcx> {
     /// We want to visit items in the context of their containing
     /// module and so forth, so supply a crate for doing a deep walk.
     fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
-        NestedVisitorMap::All(&self.tcx.map)
+        NestedVisitorMap::All(&self.tcx.hir)
     }
 
     fn visit_item(&mut self, item: &'tcx hir::Item) {
         let inherited_item_level = match item.node {
             // Impls inherit level from their types and traits
             hir::ItemImpl(..) => {
-                let def_id = self.tcx.map.local_def_id(item.id);
+                let def_id = self.tcx.hir.local_def_id(item.id);
                 cmp::min(self.item_ty_level(def_id), self.impl_trait_level(def_id))
             }
             hir::ItemDefaultImpl(..) => {
-                let def_id = self.tcx.map.local_def_id(item.id);
+                let def_id = self.tcx.hir.local_def_id(item.id);
                 self.impl_trait_level(def_id)
             }
             // Foreign mods inherit level from parents
@@ -306,7 +306,7 @@ fn visit_mod(&mut self, m: &'tcx hir::Mod, _sp: Span, id: ast::NodeId) {
         if self.prev_level.is_some() {
             if let Some(exports) = self.export_map.get(&id) {
                 for export in exports {
-                    if let Some(node_id) = self.tcx.map.as_local_node_id(export.def.def_id()) {
+                    if let Some(node_id) = self.tcx.hir.as_local_node_id(export.def.def_id()) {
                         self.update(node_id, Some(AccessLevel::Exported));
                     }
                 }
@@ -366,7 +366,7 @@ fn visit_ty(&mut self, ty: Ty<'tcx>) -> bool {
         };
 
         if let Some(def_id) = ty_def_id {
-            if let Some(node_id) = self.ev.tcx.map.as_local_node_id(def_id) {
+            if let Some(node_id) = self.ev.tcx.hir.as_local_node_id(def_id) {
                 self.ev.update(node_id, Some(AccessLevel::Reachable));
             }
         }
@@ -375,8 +375,8 @@ fn visit_ty(&mut self, ty: Ty<'tcx>) -> bool {
     }
 
     fn visit_trait_ref(&mut self, trait_ref: ty::TraitRef<'tcx>) -> bool {
-        if let Some(node_id) = self.ev.tcx.map.as_local_node_id(trait_ref.def_id) {
-            let item = self.ev.tcx.map.expect_item(node_id);
+        if let Some(node_id) = self.ev.tcx.hir.as_local_node_id(trait_ref.def_id) {
+            let item = self.ev.tcx.hir.expect_item(node_id);
             self.ev.update(item.id, Some(AccessLevel::Reachable));
         }
 
@@ -397,9 +397,9 @@ struct PrivacyVisitor<'a, 'tcx: 'a> {
 
 impl<'a, 'tcx> PrivacyVisitor<'a, 'tcx> {
     fn item_is_accessible(&self, did: DefId) -> bool {
-        match self.tcx.map.as_local_node_id(did) {
+        match self.tcx.hir.as_local_node_id(did) {
             Some(node_id) =>
-                ty::Visibility::from_hir(&self.tcx.map.expect_item(node_id).vis, node_id, self.tcx),
+                ty::Visibility::from_hir(&self.tcx.hir.expect_item(node_id).vis, node_id, self.tcx),
             None => self.tcx.sess.cstore.visibility(did),
         }.is_accessible_from(self.curitem, self.tcx)
     }
@@ -433,19 +433,19 @@ impl<'a, 'tcx> Visitor<'tcx> for PrivacyVisitor<'a, 'tcx> {
     /// We want to visit items in the context of their containing
     /// module and so forth, so supply a crate for doing a deep walk.
     fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
-        NestedVisitorMap::All(&self.tcx.map)
+        NestedVisitorMap::All(&self.tcx.hir)
     }
 
     fn visit_nested_body(&mut self, body: hir::BodyId) {
         let old_tables = self.tables;
         self.tables = self.tcx.body_tables(body);
-        let body = self.tcx.map.body(body);
+        let body = self.tcx.hir.body(body);
         self.visit_body(body);
         self.tables = old_tables;
     }
 
     fn visit_item(&mut self, item: &'tcx hir::Item) {
-        let orig_curitem = replace(&mut self.curitem, self.tcx.map.local_def_id(item.id));
+        let orig_curitem = replace(&mut self.curitem, self.tcx.hir.local_def_id(item.id));
         intravisit::walk_item(self, item);
         self.curitem = orig_curitem;
     }
@@ -492,8 +492,8 @@ fn visit_expr(&mut self, expr: &'tcx hir::Expr) {
                         error.span_label(expr.span,
                                          &format!("cannot construct with a private field"));
 
-                        if let Some(node_id) = self.tcx.map.as_local_node_id(adt_def.did) {
-                            let node = self.tcx.map.find(node_id);
+                        if let Some(node_id) = self.tcx.hir.as_local_node_id(adt_def.did) {
+                            let node = self.tcx.hir.find(node_id);
                             if let Some(hir::map::NodeStructCtor(vdata)) = node {
                                 for i in private_indexes {
                                     error.span_label(vdata.fields()[i].span,
@@ -590,10 +590,10 @@ fn path_is_private_type(&self, path: &hir::Path) -> bool {
 
         // A path can only be private if:
         // it's in this crate...
-        if let Some(node_id) = self.tcx.map.as_local_node_id(did) {
+        if let Some(node_id) = self.tcx.hir.as_local_node_id(did) {
             // .. and it corresponds to a private type in the AST (this returns
             // None for type parameters)
-            match self.tcx.map.find(node_id) {
+            match self.tcx.hir.find(node_id) {
                 Some(hir::map::NodeItem(ref item)) => item.vis != hir::Public,
                 Some(_) | None => false,
             }
@@ -653,7 +653,7 @@ impl<'a, 'tcx> Visitor<'tcx> for ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> {
     /// We want to visit items in the context of their containing
     /// module and so forth, so supply a crate for doing a deep walk.
     fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
-        NestedVisitorMap::All(&self.tcx.map)
+        NestedVisitorMap::All(&self.tcx.hir)
     }
 
     fn visit_item(&mut self, item: &'tcx hir::Item) {
@@ -709,7 +709,7 @@ fn visit_item(&mut self, item: &'tcx hir::Item) {
                                               |tr| {
                         let did = tr.path.def.def_id();
 
-                        if let Some(node_id) = self.tcx.map.as_local_node_id(did) {
+                        if let Some(node_id) = self.tcx.hir.as_local_node_id(did) {
                             self.trait_is_public(node_id)
                         } else {
                             true // external traits must be public
@@ -728,7 +728,7 @@ fn visit_item(&mut self, item: &'tcx hir::Item) {
                     trait_ref.is_some() ||
                     impl_item_refs.iter()
                                  .any(|impl_item_ref| {
-                                     let impl_item = self.tcx.map.impl_item(impl_item_ref.id);
+                                     let impl_item = self.tcx.hir.impl_item(impl_item_ref.id);
                                      match impl_item.node {
                                          hir::ImplItemKind::Const(..) |
                                          hir::ImplItemKind::Method(..) => {
@@ -752,7 +752,7 @@ fn visit_item(&mut self, item: &'tcx hir::Item) {
                                 // should only walk into public items so that we
                                 // don't erroneously report errors for private
                                 // types in private items.
-                                let impl_item = self.tcx.map.impl_item(impl_item_ref.id);
+                                let impl_item = self.tcx.hir.impl_item(impl_item_ref.id);
                                 match impl_item.node {
                                     hir::ImplItemKind::Const(..) |
                                     hir::ImplItemKind::Method(..)
@@ -785,7 +785,7 @@ fn visit_item(&mut self, item: &'tcx hir::Item) {
 
                             // Those in 3. are warned with this call.
                             for impl_item_ref in impl_item_refs {
-                                let impl_item = self.tcx.map.impl_item(impl_item_ref.id);
+                                let impl_item = self.tcx.hir.impl_item(impl_item_ref.id);
                                 if let hir::ImplItemKind::Type(ref ty) = impl_item.node {
                                     self.visit_ty(ty);
                                 }
@@ -798,7 +798,7 @@ fn visit_item(&mut self, item: &'tcx hir::Item) {
                     let mut found_pub_static = false;
                     for impl_item_ref in impl_item_refs {
                         if self.item_is_public(&impl_item_ref.id.node_id, &impl_item_ref.vis) {
-                            let impl_item = self.tcx.map.impl_item(impl_item_ref.id);
+                            let impl_item = self.tcx.hir.impl_item(impl_item_ref.id);
                             match impl_item_ref.kind {
                                 hir::AssociatedItemKind::Const => {
                                     found_pub_static = true;
@@ -962,8 +962,8 @@ fn visit_ty(&mut self, ty: Ty<'tcx>) -> bool {
 
         if let Some(def_id) = ty_def_id {
             // Non-local means public (private items can't leave their crate, modulo bugs)
-            if let Some(node_id) = self.tcx.map.as_local_node_id(def_id) {
-                let item = self.tcx.map.expect_item(node_id);
+            if let Some(node_id) = self.tcx.hir.as_local_node_id(def_id) {
+                let item = self.tcx.hir.expect_item(node_id);
                 let vis = ty::Visibility::from_hir(&item.vis, node_id, self.tcx);
 
                 if !vis.is_at_least(self.min_visibility, self.tcx) {
@@ -997,8 +997,8 @@ fn visit_ty(&mut self, ty: Ty<'tcx>) -> bool {
 
     fn visit_trait_ref(&mut self, trait_ref: ty::TraitRef<'tcx>) -> bool {
         // Non-local means public (private items can't leave their crate, modulo bugs)
-        if let Some(node_id) = self.tcx.map.as_local_node_id(trait_ref.def_id) {
-            let item = self.tcx.map.expect_item(node_id);
+        if let Some(node_id) = self.tcx.hir.as_local_node_id(trait_ref.def_id) {
+            let item = self.tcx.hir.expect_item(node_id);
             let vis = ty::Visibility::from_hir(&item.vis, node_id, self.tcx);
 
             if !vis.is_at_least(self.min_visibility, self.tcx) {
@@ -1045,7 +1045,7 @@ fn check(&self, item_id: ast::NodeId, required_visibility: ty::Visibility)
                     has_old_errors = true;
                     break;
                 }
-                let parent = self.tcx.map.get_parent_node(id);
+                let parent = self.tcx.hir.get_parent_node(id);
                 if parent == id {
                     break;
                 }
@@ -1059,8 +1059,8 @@ fn check(&self, item_id: ast::NodeId, required_visibility: ty::Visibility)
 
         SearchInterfaceForPrivateItemsVisitor {
             tcx: self.tcx,
-            item_def_id: self.tcx.map.local_def_id(item_id),
-            span: self.tcx.map.span(item_id),
+            item_def_id: self.tcx.hir.local_def_id(item_id),
+            span: self.tcx.hir.span(item_id),
             min_visibility: ty::Visibility::Public,
             required_visibility: required_visibility,
             has_old_errors: has_old_errors,
@@ -1070,7 +1070,7 @@ fn check(&self, item_id: ast::NodeId, required_visibility: ty::Visibility)
 
 impl<'a, 'tcx> Visitor<'tcx> for PrivateItemsInPublicInterfacesVisitor<'a, 'tcx> {
     fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
-        NestedVisitorMap::OnlyBodies(&self.tcx.map)
+        NestedVisitorMap::OnlyBodies(&self.tcx.hir)
     }
 
     fn visit_item(&mut self, item: &'tcx hir::Item) {
@@ -1148,7 +1148,7 @@ fn visit_item(&mut self, item: &'tcx hir::Item) {
                 self.check(item.id, ty_vis).generics().predicates();
 
                 for impl_item_ref in impl_item_refs {
-                    let impl_item = self.tcx.map.impl_item(impl_item_ref.id);
+                    let impl_item = self.tcx.hir.impl_item(impl_item_ref.id);
                     let impl_item_vis =
                         ty::Visibility::from_hir(&impl_item.vis, item.id, tcx);
                     self.check(impl_item.id, min(impl_item_vis, ty_vis))
@@ -1166,7 +1166,7 @@ fn visit_item(&mut self, item: &'tcx hir::Item) {
                               .item_type().impl_trait_ref().min_visibility;
                 self.check(item.id, vis).generics().predicates();
                 for impl_item_ref in impl_item_refs {
-                    let impl_item = self.tcx.map.impl_item(impl_item_ref.id);
+                    let impl_item = self.tcx.hir.impl_item(impl_item_ref.id);
                     self.check(impl_item.id, vis).generics().predicates().item_type();
 
                     // Recurse for e.g. `impl Trait` (see `visit_ty`).
@@ -1205,7 +1205,7 @@ pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
                              -> AccessLevels {
     let _task = tcx.dep_graph.in_task(DepNode::Privacy);
 
-    let krate = tcx.map.krate();
+    let krate = tcx.hir.krate();
 
     // Use the parent map to check the privacy of everything
     let mut visitor = PrivacyVisitor {
index e5c41d08e1f67a5fd848b73b5faf675a04e5f45b..74521fe465bcd45360924e94547972cb80725239 100644 (file)
@@ -112,7 +112,7 @@ fn nest_tables<F>(&mut self, item_id: NodeId, f: F)
         where F: FnOnce(&mut DumpVisitor<'l, 'tcx, 'll, D>)
     {
         let old_tables = self.save_ctxt.tables;
-        let item_def_id = self.tcx.map.local_def_id(item_id);
+        let item_def_id = self.tcx.hir.local_def_id(item_id);
         self.save_ctxt.tables = self.tcx.item_tables(item_def_id);
         f(self);
         self.save_ctxt.tables = old_tables;
@@ -399,7 +399,7 @@ fn process_method(&mut self,
             // with the right name.
             if !self.span.filter_generated(Some(method_data.span), span) {
                 let container =
-                    self.tcx.associated_item(self.tcx.map.local_def_id(id)).container;
+                    self.tcx.associated_item(self.tcx.hir.local_def_id(id)).container;
                 let mut trait_id;
                 let mut decl_id = None;
                 match container {
@@ -418,7 +418,7 @@ fn process_method(&mut self,
                                 }
                             }
                             None => {
-                                if let Some(NodeItem(item)) = self.tcx.map.get_if_local(id) {
+                                if let Some(NodeItem(item)) = self.tcx.hir.get_if_local(id) {
                                     if let hir::ItemImpl(_, _, _, _, ref ty, _) = item.node {
                                         trait_id = self.lookup_def_id(ty.id);
                                     }
@@ -693,7 +693,7 @@ fn process_enum(&mut self,
                             type_value: enum_data.qualname.clone(),
                             value: val,
                             scope: enum_data.scope,
-                            parent: Some(make_def_id(item.id, &self.tcx.map)),
+                            parent: Some(make_def_id(item.id, &self.tcx.hir)),
                             docs: docs_for_attrs(&variant.node.attrs),
                             sig: sig,
                         }.lower(self.tcx));
@@ -719,7 +719,7 @@ fn process_enum(&mut self,
                             type_value: enum_data.qualname.clone(),
                             value: val,
                             scope: enum_data.scope,
-                            parent: Some(make_def_id(item.id, &self.tcx.map)),
+                            parent: Some(make_def_id(item.id, &self.tcx.hir)),
                             docs: docs_for_attrs(&variant.node.attrs),
                             sig: sig,
                         }.lower(self.tcx));
@@ -775,7 +775,7 @@ fn process_impl(&mut self,
         }
         self.process_generic_params(type_parameters, item.span, "", item.id);
         for impl_item in impl_items {
-            let map = &self.tcx.map;
+            let map = &self.tcx.hir;
             self.process_impl_item(impl_item, make_def_id(item.id, map));
         }
     }
@@ -848,7 +848,7 @@ fn process_trait(&mut self,
         // walk generics and methods
         self.process_generic_params(generics, item.span, &qualname, item.id);
         for method in methods {
-            let map = &self.tcx.map;
+            let map = &self.tcx.hir;
             self.process_trait_item(method, make_def_id(item.id, map))
         }
     }
@@ -1383,7 +1383,7 @@ fn visit_expr(&mut self, ex: &'l ast::Expr) {
                 visit::walk_expr(self, ex);
             }
             ast::ExprKind::Struct(ref path, ref fields, ref base) => {
-                let hir_expr = self.save_ctxt.tcx.map.expect_expr(ex.id);
+                let hir_expr = self.save_ctxt.tcx.hir.expect_expr(ex.id);
                 let adt = match self.save_ctxt.tables.expr_ty_opt(&hir_expr) {
                     Some(ty) => ty.ty_adt_def().unwrap(),
                     None => {
@@ -1408,7 +1408,7 @@ fn visit_expr(&mut self, ex: &'l ast::Expr) {
             ast::ExprKind::TupField(ref sub_ex, idx) => {
                 self.visit_expr(&sub_ex);
 
-                let hir_node = match self.save_ctxt.tcx.map.find(sub_ex.id) {
+                let hir_node = match self.save_ctxt.tcx.hir.find(sub_ex.id) {
                     Some(Node::NodeExpr(expr)) => expr,
                     _ => {
                         debug!("Missing or weird node for sub-expression {} in {:?}",
@@ -1510,7 +1510,7 @@ fn visit_arm(&mut self, arm: &'l ast::Arm) {
         for &(id, ref p, immut, ref_kind) in &collector.collected_paths {
             match self.save_ctxt.get_path_def(id) {
                 Def::Local(def_id) => {
-                    let id = self.tcx.map.as_local_node_id(def_id).unwrap();
+                    let id = self.tcx.hir.as_local_node_id(def_id).unwrap();
                     let mut value = if immut == ast::Mutability::Immutable {
                         self.span.snippet(p.span).to_string()
                     } else {
index 18ae3a7fa9ea8b1c83ded974401100d642048b28..fccb56e88b3de801a55eb08a7e77f6f175b072e2 100644 (file)
@@ -105,13 +105,13 @@ impl Lower for data::EnumData {
 
     fn lower(self, tcx: TyCtxt) -> EnumData {
         EnumData {
-            id: make_def_id(self.id, &tcx.map),
+            id: make_def_id(self.id, &tcx.hir),
             name: self.name,
             value: self.value,
             qualname: self.qualname,
             span: SpanData::from_span(self.span, tcx.sess.codemap()),
-            scope: make_def_id(self.scope, &tcx.map),
-            variants: self.variants.into_iter().map(|id| make_def_id(id, &tcx.map)).collect(),
+            scope: make_def_id(self.scope, &tcx.hir),
+            variants: self.variants.into_iter().map(|id| make_def_id(id, &tcx.hir)).collect(),
             visibility: self.visibility,
             docs: self.docs,
             sig: self.sig.lower(tcx),
@@ -135,12 +135,12 @@ impl Lower for data::ExternCrateData {
 
     fn lower(self, tcx: TyCtxt) -> ExternCrateData {
         ExternCrateData {
-            id: make_def_id(self.id, &tcx.map),
+            id: make_def_id(self.id, &tcx.hir),
             name: self.name,
             crate_num: self.crate_num,
             location: self.location,
             span: SpanData::from_span(self.span, tcx.sess.codemap()),
-            scope: make_def_id(self.scope, &tcx.map),
+            scope: make_def_id(self.scope, &tcx.hir),
         }
     }
 }
@@ -159,7 +159,7 @@ impl Lower for data::FunctionCallData {
     fn lower(self, tcx: TyCtxt) -> FunctionCallData {
         FunctionCallData {
             span: SpanData::from_span(self.span, tcx.sess.codemap()),
-            scope: make_def_id(self.scope, &tcx.map),
+            scope: make_def_id(self.scope, &tcx.hir),
             ref_id: self.ref_id,
         }
     }
@@ -186,12 +186,12 @@ impl Lower for data::FunctionData {
 
     fn lower(self, tcx: TyCtxt) -> FunctionData {
         FunctionData {
-            id: make_def_id(self.id, &tcx.map),
+            id: make_def_id(self.id, &tcx.hir),
             name: self.name,
             qualname: self.qualname,
             declaration: self.declaration,
             span: SpanData::from_span(self.span, tcx.sess.codemap()),
-            scope: make_def_id(self.scope, &tcx.map),
+            scope: make_def_id(self.scope, &tcx.hir),
             value: self.value,
             visibility: self.visibility,
             parent: self.parent,
@@ -215,7 +215,7 @@ impl Lower for data::FunctionRefData {
     fn lower(self, tcx: TyCtxt) -> FunctionRefData {
         FunctionRefData {
             span: SpanData::from_span(self.span, tcx.sess.codemap()),
-            scope: make_def_id(self.scope, &tcx.map),
+            scope: make_def_id(self.scope, &tcx.hir),
             ref_id: self.ref_id,
         }
     }
@@ -234,9 +234,9 @@ impl Lower for data::ImplData {
 
     fn lower(self, tcx: TyCtxt) -> ImplData {
         ImplData {
-            id: make_def_id(self.id, &tcx.map),
+            id: make_def_id(self.id, &tcx.hir),
             span: SpanData::from_span(self.span, tcx.sess.codemap()),
-            scope: make_def_id(self.scope, &tcx.map),
+            scope: make_def_id(self.scope, &tcx.hir),
             trait_ref: self.trait_ref,
             self_ref: self.self_ref,
         }
@@ -257,7 +257,7 @@ fn lower(self, tcx: TyCtxt) -> InheritanceData {
         InheritanceData {
             span: SpanData::from_span(self.span, tcx.sess.codemap()),
             base_id: self.base_id,
-            deriv_id: make_def_id(self.deriv_id, &tcx.map)
+            deriv_id: make_def_id(self.deriv_id, &tcx.hir)
         }
     }
 }
@@ -305,7 +305,7 @@ fn lower(self, tcx: TyCtxt) -> MacroUseData {
             name: self.name,
             qualname: self.qualname,
             callee_span: SpanData::from_span(self.callee_span, tcx.sess.codemap()),
-            scope: make_def_id(self.scope, &tcx.map),
+            scope: make_def_id(self.scope, &tcx.hir),
         }
     }
 }
@@ -325,7 +325,7 @@ impl Lower for data::MethodCallData {
     fn lower(self, tcx: TyCtxt) -> MethodCallData {
         MethodCallData {
             span: SpanData::from_span(self.span, tcx.sess.codemap()),
-            scope: make_def_id(self.scope, &tcx.map),
+            scope: make_def_id(self.scope, &tcx.hir),
             ref_id: self.ref_id,
             decl_id: self.decl_id,
         }
@@ -355,8 +355,8 @@ fn lower(self, tcx: TyCtxt) -> MethodData {
         MethodData {
             span: SpanData::from_span(self.span, tcx.sess.codemap()),
             name: self.name,
-            scope: make_def_id(self.scope, &tcx.map),
-            id: make_def_id(self.id, &tcx.map),
+            scope: make_def_id(self.scope, &tcx.hir),
+            id: make_def_id(self.id, &tcx.hir),
             qualname: self.qualname,
             value: self.value,
             decl_id: self.decl_id,
@@ -388,13 +388,13 @@ impl Lower for data::ModData {
 
     fn lower(self, tcx: TyCtxt) -> ModData {
         ModData {
-            id: make_def_id(self.id, &tcx.map),
+            id: make_def_id(self.id, &tcx.hir),
             name: self.name,
             qualname: self.qualname,
             span: SpanData::from_span(self.span, tcx.sess.codemap()),
-            scope: make_def_id(self.scope, &tcx.map),
+            scope: make_def_id(self.scope, &tcx.hir),
             filename: self.filename,
-            items: self.items.into_iter().map(|id| make_def_id(id, &tcx.map)).collect(),
+            items: self.items.into_iter().map(|id| make_def_id(id, &tcx.hir)).collect(),
             visibility: self.visibility,
             docs: self.docs,
             sig: self.sig.lower(tcx),
@@ -417,7 +417,7 @@ impl Lower for data::ModRefData {
     fn lower(self, tcx: TyCtxt) -> ModRefData {
         ModRefData {
             span: SpanData::from_span(self.span, tcx.sess.codemap()),
-            scope: make_def_id(self.scope, &tcx.map),
+            scope: make_def_id(self.scope, &tcx.hir),
             ref_id: self.ref_id,
             qualname: self.qualname,
         }
@@ -446,12 +446,12 @@ fn lower(self, tcx: TyCtxt) -> StructData {
         StructData {
             span: SpanData::from_span(self.span, tcx.sess.codemap()),
             name: self.name,
-            id: make_def_id(self.id, &tcx.map),
-            ctor_id: make_def_id(self.ctor_id, &tcx.map),
+            id: make_def_id(self.id, &tcx.hir),
+            ctor_id: make_def_id(self.ctor_id, &tcx.hir),
             qualname: self.qualname,
-            scope: make_def_id(self.scope, &tcx.map),
+            scope: make_def_id(self.scope, &tcx.hir),
             value: self.value,
-            fields: self.fields.into_iter().map(|id| make_def_id(id, &tcx.map)).collect(),
+            fields: self.fields.into_iter().map(|id| make_def_id(id, &tcx.hir)).collect(),
             visibility: self.visibility,
             docs: self.docs,
             sig: self.sig.lower(tcx),
@@ -480,11 +480,11 @@ fn lower(self, tcx: TyCtxt) -> StructVariantData {
         StructVariantData {
             span: SpanData::from_span(self.span, tcx.sess.codemap()),
             name: self.name,
-            id: make_def_id(self.id, &tcx.map),
+            id: make_def_id(self.id, &tcx.hir),
             qualname: self.qualname,
             type_value: self.type_value,
             value: self.value,
-            scope: make_def_id(self.scope, &tcx.map),
+            scope: make_def_id(self.scope, &tcx.hir),
             parent: self.parent,
             docs: self.docs,
             sig: self.sig.lower(tcx),
@@ -513,11 +513,11 @@ fn lower(self, tcx: TyCtxt) -> TraitData {
         TraitData {
             span: SpanData::from_span(self.span, tcx.sess.codemap()),
             name: self.name,
-            id: make_def_id(self.id, &tcx.map),
+            id: make_def_id(self.id, &tcx.hir),
             qualname: self.qualname,
-            scope: make_def_id(self.scope, &tcx.map),
+            scope: make_def_id(self.scope, &tcx.hir),
             value: self.value,
-            items: self.items.into_iter().map(|id| make_def_id(id, &tcx.map)).collect(),
+            items: self.items.into_iter().map(|id| make_def_id(id, &tcx.hir)).collect(),
             visibility: self.visibility,
             docs: self.docs,
             sig: self.sig.lower(tcx),
@@ -545,12 +545,12 @@ impl Lower for data::TupleVariantData {
     fn lower(self, tcx: TyCtxt) -> TupleVariantData {
         TupleVariantData {
             span: SpanData::from_span(self.span, tcx.sess.codemap()),
-            id: make_def_id(self.id, &tcx.map),
+            id: make_def_id(self.id, &tcx.hir),
             name: self.name,
             qualname: self.qualname,
             type_value: self.type_value,
             value: self.value,
-            scope: make_def_id(self.scope, &tcx.map),
+            scope: make_def_id(self.scope, &tcx.hir),
             parent: self.parent,
             docs: self.docs,
             sig: self.sig.lower(tcx),
@@ -577,7 +577,7 @@ impl Lower for data::TypeDefData {
 
     fn lower(self, tcx: TyCtxt) -> TypeDefData {
         TypeDefData {
-            id: make_def_id(self.id, &tcx.map),
+            id: make_def_id(self.id, &tcx.hir),
             name: self.name,
             span: SpanData::from_span(self.span, tcx.sess.codemap()),
             qualname: self.qualname,
@@ -605,7 +605,7 @@ impl Lower for data::TypeRefData {
     fn lower(self, tcx: TyCtxt) -> TypeRefData {
         TypeRefData {
             span: SpanData::from_span(self.span, tcx.sess.codemap()),
-            scope: make_def_id(self.scope, &tcx.map),
+            scope: make_def_id(self.scope, &tcx.hir),
             ref_id: self.ref_id,
             qualname: self.qualname,
         }
@@ -627,11 +627,11 @@ impl Lower for data::UseData {
 
     fn lower(self, tcx: TyCtxt) -> UseData {
         UseData {
-            id: make_def_id(self.id, &tcx.map),
+            id: make_def_id(self.id, &tcx.hir),
             span: SpanData::from_span(self.span, tcx.sess.codemap()),
             name: self.name,
             mod_id: self.mod_id,
-            scope: make_def_id(self.scope, &tcx.map),
+            scope: make_def_id(self.scope, &tcx.hir),
             visibility: self.visibility,
         }
     }
@@ -651,10 +651,10 @@ impl Lower for data::UseGlobData {
 
     fn lower(self, tcx: TyCtxt) -> UseGlobData {
         UseGlobData {
-            id: make_def_id(self.id, &tcx.map),
+            id: make_def_id(self.id, &tcx.hir),
             span: SpanData::from_span(self.span, tcx.sess.codemap()),
             names: self.names,
-            scope: make_def_id(self.scope, &tcx.map),
+            scope: make_def_id(self.scope, &tcx.hir),
             visibility: self.visibility,
         }
     }
@@ -682,12 +682,12 @@ impl Lower for data::VariableData {
 
     fn lower(self, tcx: TyCtxt) -> VariableData {
         VariableData {
-            id: make_def_id(self.id, &tcx.map),
+            id: make_def_id(self.id, &tcx.hir),
             kind: self.kind,
             name: self.name,
             qualname: self.qualname,
             span: SpanData::from_span(self.span, tcx.sess.codemap()),
-            scope: make_def_id(self.scope, &tcx.map),
+            scope: make_def_id(self.scope, &tcx.hir),
             value: self.value,
             type_value: self.type_value,
             parent: self.parent,
@@ -715,7 +715,7 @@ fn lower(self, tcx: TyCtxt) -> VariableRefData {
         VariableRefData {
             name: self.name,
             span: SpanData::from_span(self.span, tcx.sess.codemap()),
-            scope: make_def_id(self.scope, &tcx.map),
+            scope: make_def_id(self.scope, &tcx.hir),
             ref_id: self.ref_id,
         }
     }
index ded59cfccf13471bc7c3c528dd441a88efad2570..8d0cdd1678c730a39c19175cc9dc3f943aef4fc9 100644 (file)
@@ -285,7 +285,7 @@ pub fn get_field_data(&self,
             let qualname = format!("::{}::{}", self.tcx.node_path_str(scope), ident);
             let sub_span = self.span_utils.sub_span_before_token(field.span, token::Colon);
             filter!(self.span_utils, sub_span, field.span, None);
-            let def_id = self.tcx.map.local_def_id(field.id);
+            let def_id = self.tcx.hir.local_def_id(field.id);
             let typ = self.tcx.item_type(def_id).to_string();
 
             let span = field.span;
@@ -307,7 +307,7 @@ pub fn get_field_data(&self,
                 qualname: qualname,
                 span: sub_span.unwrap(),
                 scope: scope,
-                parent: Some(make_def_id(scope, &self.tcx.map)),
+                parent: Some(make_def_id(scope, &self.tcx.hir)),
                 value: "".to_owned(),
                 type_value: typ,
                 visibility: From::from(&field.vis),
@@ -326,13 +326,13 @@ pub fn get_method_data(&self, id: ast::NodeId,
         // The qualname for a method is the trait name or name of the struct in an impl in
         // which the method is declared in, followed by the method's name.
         let (qualname, parent_scope, decl_id, vis, docs) =
-          match self.tcx.impl_of_method(self.tcx.map.local_def_id(id)) {
-            Some(impl_id) => match self.tcx.map.get_if_local(impl_id) {
+          match self.tcx.impl_of_method(self.tcx.hir.local_def_id(id)) {
+            Some(impl_id) => match self.tcx.hir.get_if_local(impl_id) {
                 Some(Node::NodeItem(item)) => {
                     match item.node {
                         hir::ItemImpl(.., ref ty, _) => {
                             let mut result = String::from("<");
-                            result.push_str(&self.tcx.map.node_to_pretty_string(ty.id));
+                            result.push_str(&self.tcx.hir.node_to_pretty_string(ty.id));
 
                             let trait_id = self.tcx.trait_id_of_impl(impl_id);
                             let mut decl_id = None;
@@ -365,9 +365,9 @@ pub fn get_method_data(&self, id: ast::NodeId,
                               r);
                 }
             },
-            None => match self.tcx.trait_of_item(self.tcx.map.local_def_id(id)) {
+            None => match self.tcx.trait_of_item(self.tcx.hir.local_def_id(id)) {
                 Some(def_id) => {
-                    match self.tcx.map.get_if_local(def_id) {
+                    match self.tcx.hir.get_if_local(def_id) {
                         Some(Node::NodeItem(item)) => {
                             (format!("::{}", self.tcx.item_path_str(def_id)),
                              Some(def_id), None,
@@ -442,14 +442,14 @@ pub fn get_trait_ref_data(&self,
     }
 
     pub fn get_expr_data(&self, expr: &ast::Expr) -> Option<Data> {
-        let hir_node = self.tcx.map.expect_expr(expr.id);
+        let hir_node = self.tcx.hir.expect_expr(expr.id);
         let ty = self.tables.expr_ty_adjusted_opt(&hir_node);
         if ty.is_none() || ty.unwrap().sty == ty::TyError {
             return None;
         }
         match expr.node {
             ast::ExprKind::Field(ref sub_ex, ident) => {
-                let hir_node = match self.tcx.map.find(sub_ex.id) {
+                let hir_node = match self.tcx.hir.find(sub_ex.id) {
                     Some(Node::NodeExpr(expr)) => expr,
                     _ => {
                         debug!("Missing or weird node for sub-expression {} in {:?}",
@@ -523,7 +523,7 @@ pub fn get_expr_data(&self, expr: &ast::Expr) -> Option<Data> {
     }
 
     pub fn get_path_def(&self, id: NodeId) -> Def {
-        match self.tcx.map.get(id) {
+        match self.tcx.hir.get(id) {
             Node::NodeTraitRef(tr) => tr.path.def,
 
             Node::NodeItem(&hir::Item { node: hir::ItemUse(ref path, _), .. }) |
@@ -733,7 +733,7 @@ fn sig_base(&self, item: &ast::Item) -> Signature {
 
     #[inline]
     pub fn enclosing_scope(&self, id: NodeId) -> NodeId {
-        self.tcx.map.get_enclosing_scope(id).unwrap_or(CRATE_NODE_ID)
+        self.tcx.hir.get_enclosing_scope(id).unwrap_or(CRATE_NODE_ID)
     }
 }
 
index 898e65ce391e609dd295dc29971a85cb09075f42..7a41f8341099b5cf79703b0999ecf68e0e209540 100644 (file)
@@ -50,7 +50,7 @@ pub fn assert_module_sources<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
     }
 
     let ams = AssertModuleSource { tcx: tcx, modules: modules };
-    for attr in &tcx.map.krate().attrs {
+    for attr in &tcx.hir.krate().attrs {
         ams.check_attr(attr);
     }
 }
index 5f16291892387fb6b2622895a4979b37625b0618..81be2d02f125b0797bbaa7ff009fe69a21703b49 100644 (file)
@@ -48,7 +48,7 @@ pub fn compute_from<'a, 'tcx>(scx: &SharedCrateContext<'a, 'tcx>,
             .exported_symbols()
             .iter()
             .map(|&node_id| {
-                scx.tcx().map.local_def_id(node_id)
+                scx.tcx().hir.local_def_id(node_id)
             })
             .map(|def_id| {
                 let name = symbol_for_def_id(scx, def_id, symbol_map);
@@ -64,7 +64,7 @@ pub fn compute_from<'a, 'tcx>(scx: &SharedCrateContext<'a, 'tcx>,
 
         if let Some(id) = scx.sess().derive_registrar_fn.get() {
             let svh = &scx.link_meta().crate_hash;
-            let def_id = scx.tcx().map.local_def_id(id);
+            let def_id = scx.tcx().hir.local_def_id(id);
             let idx = def_id.index;
             let registrar = scx.sess().generate_derive_registrar_symbol(svh, idx);
             local_crate.push((registrar, SymbolExportLevel::C));
@@ -181,7 +181,7 @@ fn symbol_for_def_id<'a, 'tcx>(scx: &SharedCrateContext<'a, 'tcx>,
                                -> String {
     // Just try to look things up in the symbol map. If nothing's there, we
     // recompute.
-    if let Some(node_id) = scx.tcx().map.as_local_node_id(def_id) {
+    if let Some(node_id) = scx.tcx().hir.as_local_node_id(def_id) {
         if let Some(sym) = symbol_map.get(TransItem::Static(node_id)) {
             return sym.to_owned();
         }
index 8f8c48a06b2c086bc749b72513442d3067b46ae4..20338e4f6afb03293fcee550cf150f516bd55982 100644 (file)
@@ -175,7 +175,7 @@ pub fn symbol_name(self, scx: &SharedCrateContext<'a, 'tcx>) -> String {
         debug!("symbol_name(def_id={:?}, substs={:?})",
                def_id, substs);
 
-        let node_id = scx.tcx().map.as_local_node_id(def_id);
+        let node_id = scx.tcx().hir.as_local_node_id(def_id);
 
         if let Some(id) = node_id {
             if scx.sess().plugin_registrar_fn.get() == Some(id) {
@@ -193,7 +193,7 @@ pub fn symbol_name(self, scx: &SharedCrateContext<'a, 'tcx>) -> String {
         // FIXME(eddyb) Precompute a custom symbol name based on attributes.
         let attrs = scx.tcx().get_attrs(def_id);
         let is_foreign = if let Some(id) = node_id {
-            match scx.tcx().map.get(id) {
+            match scx.tcx().hir.get(id) {
                 hir_map::NodeForeignItem(_) => true,
                 _ => false
             }
index d006dccbccc58ef7bdea42d0866b0d9819014530..32fe3effcc9f8af57c2713eae5a25d2138373514 100644 (file)
@@ -710,7 +710,7 @@ pub fn set_link_section(ccx: &CrateContext,
 pub fn maybe_create_entry_wrapper(ccx: &CrateContext) {
     let (main_def_id, span) = match *ccx.sess().entry_fn.borrow() {
         Some((id, span)) => {
-            (ccx.tcx().map.local_def_id(id), span)
+            (ccx.tcx().hir.local_def_id(id), span)
         }
         None => return,
     };
@@ -1075,9 +1075,9 @@ pub fn find_exported_symbols(tcx: TyCtxt, reachable: NodeSet) -> NodeSet {
         //
         // As a result, if this id is an FFI item (foreign item) then we only
         // let it through if it's included statically.
-        match tcx.map.get(id) {
+        match tcx.hir.get(id) {
             hir_map::NodeForeignItem(..) => {
-                let def_id = tcx.map.local_def_id(id);
+                let def_id = tcx.hir.local_def_id(id);
                 tcx.sess.cstore.is_statically_included_foreign_item(def_id)
             }
 
@@ -1088,7 +1088,7 @@ pub fn find_exported_symbols(tcx: TyCtxt, reachable: NodeSet) -> NodeSet {
                 node: hir::ItemFn(..), .. }) |
             hir_map::NodeImplItem(&hir::ImplItem {
                 node: hir::ImplItemKind::Method(..), .. }) => {
-                let def_id = tcx.map.local_def_id(id);
+                let def_id = tcx.hir.local_def_id(id);
                 let generics = tcx.item_generics(def_id);
                 let attributes = tcx.get_attrs(def_id);
                 (generics.parent_types == 0 && generics.types.is_empty()) &&
@@ -1112,7 +1112,7 @@ pub fn trans_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
     // entire contents of the krate. So if you push any subtasks of
     // `TransCrate`, you need to be careful to register "reads" of the
     // particular items that will be processed.
-    let krate = tcx.map.krate();
+    let krate = tcx.hir.krate();
 
     let ty::CrateAnalysis { export_map, reachable, name, .. } = analysis;
     let exported_symbols = find_exported_symbols(tcx, reachable);
index 5e409a2aa5520e076afd3a7d1dbb16d05f9c2c9b..d30766dc5392a3015a2785c5d2043889bf7973c1 100644 (file)
@@ -309,7 +309,7 @@ fn collect_roots<'a, 'tcx>(scx: &SharedCrateContext<'a, 'tcx>,
             output: &mut roots,
         };
 
-        scx.tcx().map.krate().visit_all_item_likes(&mut visitor);
+        scx.tcx().hir.krate().visit_all_item_likes(&mut visitor);
     }
 
     roots
@@ -336,7 +336,7 @@ fn collect_items_rec<'a, 'tcx: 'a>(scx: &SharedCrateContext<'a, 'tcx>,
             recursion_depth_reset = None;
         }
         TransItem::Static(node_id) => {
-            let def_id = scx.tcx().map.local_def_id(node_id);
+            let def_id = scx.tcx().hir.local_def_id(node_id);
 
             // Sanity check whether this ended up being collected accidentally
             debug_assert!(should_trans_locally(scx.tcx(), def_id));
@@ -406,8 +406,8 @@ fn check_recursion_limit<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
     if recursion_depth > tcx.sess.recursion_limit.get() {
         let error = format!("reached the recursion limit while instantiating `{}`",
                             instance);
-        if let Some(node_id) = tcx.map.as_local_node_id(instance.def) {
-            tcx.sess.span_fatal(tcx.map.span(node_id), &error);
+        if let Some(node_id) = tcx.hir.as_local_node_id(instance.def) {
+            tcx.sess.span_fatal(tcx.hir.span(node_id), &error);
         } else {
             tcx.sess.fatal(&error);
         }
@@ -438,8 +438,8 @@ fn check_type_length_limit<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
         let instance_name = instance.to_string();
         let msg = format!("reached the type-length limit while instantiating `{:.64}...`",
                           instance_name);
-        let mut diag = if let Some(node_id) = tcx.map.as_local_node_id(instance.def) {
-            tcx.sess.struct_span_fatal(tcx.map.span(node_id), &msg)
+        let mut diag = if let Some(node_id) = tcx.hir.as_local_node_id(instance.def) {
+            tcx.sess.struct_span_fatal(tcx.hir.span(node_id), &msg)
         } else {
             tcx.sess.struct_fatal(&msg)
         };
@@ -619,7 +619,7 @@ fn can_result_in_trans_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
                     // Some constructors also have type TyFnDef but they are
                     // always instantiated inline and don't result in a
                     // translation item. Same for FFI functions.
-                    if let Some(hir_map::NodeForeignItem(_)) = tcx.map.get_if_local(def_id) {
+                    if let Some(hir_map::NodeForeignItem(_)) = tcx.hir.get_if_local(def_id) {
                         return false;
                     }
 
@@ -1152,7 +1152,7 @@ fn visit_item(&mut self, item: &'v hir::Item) {
             hir::ItemUnion(_, ref generics) => {
                 if !generics.is_parameterized() {
                     if self.mode == TransItemCollectionMode::Eager {
-                        let def_id = self.scx.tcx().map.local_def_id(item.id);
+                        let def_id = self.scx.tcx().hir.local_def_id(item.id);
                         debug!("RootCollector: ADT drop-glue for {}",
                                def_id_to_string(self.scx.tcx(), def_id));
 
@@ -1165,7 +1165,7 @@ fn visit_item(&mut self, item: &'v hir::Item) {
             hir::ItemStatic(..) => {
                 debug!("RootCollector: ItemStatic({})",
                        def_id_to_string(self.scx.tcx(),
-                                        self.scx.tcx().map.local_def_id(item.id)));
+                                        self.scx.tcx().hir.local_def_id(item.id)));
                 self.output.push(TransItem::Static(item.id));
             }
             hir::ItemConst(..) => {
@@ -1174,7 +1174,7 @@ fn visit_item(&mut self, item: &'v hir::Item) {
             }
             hir::ItemFn(.., ref generics, _) => {
                 if !generics.is_type_parameterized() {
-                    let def_id = self.scx.tcx().map.local_def_id(item.id);
+                    let def_id = self.scx.tcx().hir.local_def_id(item.id);
 
                     debug!("RootCollector: ItemFn({})",
                            def_id_to_string(self.scx.tcx(), def_id));
@@ -1197,7 +1197,7 @@ fn visit_impl_item(&mut self, ii: &'v hir::ImplItem) {
                 ref generics,
                 ..
             }, _) => {
-                let hir_map = &self.scx.tcx().map;
+                let hir_map = &self.scx.tcx().hir;
                 let parent_node_id = hir_map.get_parent_node(ii.id);
                 let is_impl_generic = match hir_map.expect_item(parent_node_id) {
                     &hir::Item {
@@ -1212,7 +1212,7 @@ fn visit_impl_item(&mut self, ii: &'v hir::ImplItem) {
                 };
 
                 if !generics.is_type_parameterized() && !is_impl_generic {
-                    let def_id = self.scx.tcx().map.local_def_id(ii.id);
+                    let def_id = self.scx.tcx().hir.local_def_id(ii.id);
 
                     debug!("RootCollector: MethodImplItem({})",
                            def_id_to_string(self.scx.tcx(), def_id));
@@ -1240,7 +1240,7 @@ fn create_trans_items_for_default_impls<'a, 'tcx>(scx: &SharedCrateContext<'a, '
                 return
             }
 
-            let impl_def_id = tcx.map.local_def_id(item.id);
+            let impl_def_id = tcx.hir.local_def_id(item.id);
 
             debug!("create_trans_items_for_default_impls(item={})",
                    def_id_to_string(tcx, impl_def_id));
index a9c1edfdc66cc600ae6c7d9afffc2ac44ee02cb3..b68de7b46c82e9b7a0ded83ce76ec76989107115 100644 (file)
@@ -85,10 +85,10 @@ pub fn get_static(ccx: &CrateContext, def_id: DefId) -> ValueRef {
     }
 
     let ty = ccx.tcx().item_type(def_id);
-    let g = if let Some(id) = ccx.tcx().map.as_local_node_id(def_id) {
+    let g = if let Some(id) = ccx.tcx().hir.as_local_node_id(def_id) {
 
         let llty = type_of::type_of(ccx, ty);
-        let (g, attrs) = match ccx.tcx().map.get(id) {
+        let (g, attrs) = match ccx.tcx().hir.get(id) {
             hir_map::NodeItem(&hir::Item {
                 ref attrs, span, node: hir::ItemStatic(..), ..
             }) => {
@@ -219,7 +219,7 @@ pub fn trans_static(ccx: &CrateContext,
                     attrs: &[ast::Attribute])
                     -> Result<ValueRef, ConstEvalErr> {
     unsafe {
-        let def_id = ccx.tcx().map.local_def_id(id);
+        let def_id = ccx.tcx().hir.local_def_id(id);
         let g = get_static(ccx, def_id);
 
         let v = ::mir::trans_static_initializer(ccx, def_id)?;
index e8728a39993081bc3bcc45966b43537922ea2b37..4567ec8b452df58a258cd932092af89b9699c52a 100644 (file)
@@ -79,7 +79,7 @@ pub fn get_or_insert_gdb_debug_scripts_section_global(ccx: &CrateContext)
 
 pub fn needs_gdb_debug_scripts_section(ccx: &CrateContext) -> bool {
     let omit_gdb_pretty_printer_section =
-        attr::contains_name(&ccx.tcx().map.krate_attrs(),
+        attr::contains_name(&ccx.tcx().hir.krate_attrs(),
                             "omit_gdb_pretty_printer_section");
 
     !omit_gdb_pretty_printer_section &&
index 1473e55b2643cbef4b8f6aef5ccf759fe45d8cd8..0de3c13dc21a9864943d4bd352230ae889cbc5d7 100644 (file)
@@ -1738,7 +1738,7 @@ pub fn create_global_var_metadata(cx: &CrateContext,
 
     let tcx = cx.tcx();
 
-    let node_def_id = tcx.map.local_def_id(node_id);
+    let node_def_id = tcx.hir.local_def_id(node_id);
     let (var_scope, span) = get_namespace_and_span_for_item(cx, node_def_id);
 
     let (file_metadata, line_number) = if span != syntax_pos::DUMMY_SP {
index 9117f49cf3ea5b8aaa3ec3fc0a343df1e0113a81..f05d48566daaea4396044d34f130140db2ec3148 100644 (file)
@@ -251,7 +251,7 @@ pub fn create_function_debug_context<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
 
     let scope_line = span_start(cx, span).line;
 
-    let local_id = cx.tcx().map.as_local_node_id(instance.def);
+    let local_id = cx.tcx().hir.as_local_node_id(instance.def);
     let is_local_to_unit = local_id.map_or(false, |id| is_node_local_to_unit(cx, id));
 
     let function_name = CString::new(name).unwrap();
index 9bf023fc18936e4ca0517df93df0d92db8316408..bf7a02eb0f196c7fdc6306f6a8a2c35fd3014afd 100644 (file)
@@ -76,7 +76,7 @@ fn declare_raw_fn(ccx: &CrateContext, name: &str, callconv: llvm::CallConv, ty:
     // compiler-rt, then we want to implicitly compile everything with hidden
     // visibility as we're going to link this object all over the place but
     // don't want the symbols to get exported.
-    if attr::contains_name(ccx.tcx().map.krate_attrs(), "compiler_builtins") {
+    if attr::contains_name(ccx.tcx().hir.krate_attrs(), "compiler_builtins") {
         unsafe {
             llvm::LLVMRustSetVisibility(llfn, llvm::Visibility::Hidden);
         }
index d1d167306c1fdb9fff02e4d06850415204b9bfae..706f131ed627fc1df6a491b18ca7e9d462dac6fa 100644 (file)
@@ -186,7 +186,7 @@ pub fn compute_symbol_name_hash(&self,
             symbol_name.hash(&mut state);
             let exported = match item {
                TransItem::Fn(ref instance) => {
-                    let node_id = scx.tcx().map.as_local_node_id(instance.def);
+                    let node_id = scx.tcx().hir.as_local_node_id(instance.def);
                     node_id.map(|node_id| exported_symbols.contains(&node_id))
                            .unwrap_or(false)
                }
@@ -241,7 +241,7 @@ pub fn items_in_deterministic_order(&self,
         fn local_node_id(tcx: TyCtxt, trans_item: TransItem) -> Option<NodeId> {
             match trans_item {
                 TransItem::Fn(instance) => {
-                    tcx.map.as_local_node_id(instance.def)
+                    tcx.hir.as_local_node_id(instance.def)
                 }
                 TransItem::Static(node_id) => Some(node_id),
                 TransItem::DropGlue(_) => None,
@@ -482,7 +482,7 @@ fn characteristic_def_id_of_trans_item<'a, 'tcx>(scx: &SharedCrateContext<'a, 't
             Some(instance.def)
         }
         TransItem::DropGlue(dg) => characteristic_def_id_of_type(dg.ty()),
-        TransItem::Static(node_id) => Some(tcx.map.local_def_id(node_id)),
+        TransItem::Static(node_id) => Some(tcx.hir.local_def_id(node_id)),
     }
 }
 
index c3e0ac1fee51578d33b238f3ebb4d3e4aba06265..880c65937e3087f826a8bd079c4d57a0e7ef1a22 100644 (file)
@@ -97,12 +97,12 @@ fn get_span<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
                               trans_item: TransItem<'tcx>) -> Option<Span> {
             match trans_item {
                 TransItem::Fn(Instance { def, .. }) => {
-                    tcx.map.as_local_node_id(def)
+                    tcx.hir.as_local_node_id(def)
                 }
                 TransItem::Static(node_id) => Some(node_id),
                 TransItem::DropGlue(_) => None,
             }.map(|node_id| {
-                tcx.map.span(node_id)
+                tcx.hir.span(node_id)
             })
         }
 
index 9ed5a5d148cd62410cd608a546524d3c96db189b..02e1290b5778331d0e5734100811561d78196448 100644 (file)
@@ -36,7 +36,7 @@ pub fn report_symbol_names(scx: &SharedCrateContext) {
     let _ignore = tcx.dep_graph.in_ignore();
     let mut visitor = SymbolNamesTest { scx: scx };
     // FIXME(#37712) could use ItemLikeVisitor if trait items were item-like
-    tcx.map.krate().visit_all_item_likes(&mut visitor.as_deep_visitor());
+    tcx.hir.krate().visit_all_item_likes(&mut visitor.as_deep_visitor());
 }
 
 struct SymbolNamesTest<'a, 'tcx:'a> {
@@ -47,7 +47,7 @@ impl<'a, 'tcx> SymbolNamesTest<'a, 'tcx> {
     fn process_attrs(&mut self,
                      node_id: ast::NodeId) {
         let tcx = self.scx.tcx();
-        let def_id = tcx.map.local_def_id(node_id);
+        let def_id = tcx.hir.local_def_id(node_id);
         for attr in tcx.get_attrs(def_id).iter() {
             if attr.check_name(SYMBOL_NAME) {
                 // for now, can only use on monomorphic names
index 816c34425437166e985b823fe2e75f7d05754d50..43ea1e56a5a4d19e2112a0d98ccc7bde27bc3eb7 100644 (file)
@@ -77,9 +77,9 @@ pub fn define(&self, ccx: &CrateContext<'a, 'tcx>) {
 
         match *self {
             TransItem::Static(node_id) => {
-                let def_id = ccx.tcx().map.local_def_id(node_id);
+                let def_id = ccx.tcx().hir.local_def_id(node_id);
                 let _task = ccx.tcx().dep_graph.in_task(DepNode::TransCrateItem(def_id)); // (*)
-                let item = ccx.tcx().map.expect_item(node_id);
+                let item = ccx.tcx().hir.expect_item(node_id);
                 if let hir::ItemStatic(_, m, _) = item.node {
                     match consts::trans_static(&ccx, m, item.id, &item.attrs) {
                         Ok(_) => { /* Cool, everything's alright. */ },
@@ -145,12 +145,12 @@ fn predefine_static(ccx: &CrateContext<'a, 'tcx>,
                         node_id: ast::NodeId,
                         linkage: llvm::Linkage,
                         symbol_name: &str) {
-        let def_id = ccx.tcx().map.local_def_id(node_id);
+        let def_id = ccx.tcx().hir.local_def_id(node_id);
         let ty = ccx.tcx().item_type(def_id);
         let llty = type_of::type_of(ccx, ty);
 
         let g = declare::define_global(ccx, symbol_name, llty).unwrap_or_else(|| {
-            ccx.sess().span_fatal(ccx.tcx().map.span(node_id),
+            ccx.sess().span_fatal(ccx.tcx().hir.span(node_id),
                 &format!("symbol `{}` is already defined", symbol_name))
         });
 
@@ -222,7 +222,7 @@ pub fn compute_symbol_name(&self,
         match *self {
             TransItem::Fn(instance) => instance.symbol_name(scx),
             TransItem::Static(node_id) => {
-                let def_id = scx.tcx().map.local_def_id(node_id);
+                let def_id = scx.tcx().hir.local_def_id(node_id);
                 Instance::mono(scx, def_id).symbol_name(scx)
             }
             TransItem::DropGlue(dg) => {
@@ -274,7 +274,7 @@ pub fn is_generic_fn(&self) -> bool {
     pub fn explicit_linkage(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Option<llvm::Linkage> {
         let def_id = match *self {
             TransItem::Fn(ref instance) => instance.def,
-            TransItem::Static(node_id) => tcx.map.local_def_id(node_id),
+            TransItem::Static(node_id) => tcx.hir.local_def_id(node_id),
             TransItem::DropGlue(..) => return None,
         };
 
@@ -283,7 +283,7 @@ pub fn explicit_linkage(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Option<llvm::Link
             if let Some(linkage) = base::llvm_linkage_by_name(&name.as_str()) {
                 Some(linkage)
             } else {
-                let span = tcx.map.span_if_local(def_id);
+                let span = tcx.hir.span_if_local(def_id);
                 if let Some(span) = span {
                     tcx.sess.span_fatal(span, "invalid linkage specified")
                 } else {
@@ -296,7 +296,7 @@ pub fn explicit_linkage(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Option<llvm::Link
     }
 
     pub fn to_string(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> String {
-        let hir_map = &tcx.map;
+        let hir_map = &tcx.hir;
 
         return match *self {
             TransItem::DropGlue(dg) => {
index 838dbef8ecf1b3d13e09db328f5b41a3999b68a1..1af8b59cdfa7d7ab6dc3db7b722d395fe89320d9 100644 (file)
@@ -186,7 +186,7 @@ pub fn ast_region_to_region<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>,
                                  .get(&id)
                                  .cloned()
                                  .unwrap_or(ty::Issue32330::WontChange);
-            ty::ReLateBound(debruijn, ty::BrNamed(tcx.map.local_def_id(id),
+            ty::ReLateBound(debruijn, ty::BrNamed(tcx.hir.local_def_id(id),
                                                   lifetime.name,
                                                   issue_32330))
         }
@@ -208,7 +208,7 @@ pub fn ast_region_to_region<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>,
                                  .unwrap_or(ty::Issue32330::WontChange);
             ty::ReFree(ty::FreeRegion {
                     scope: scope.to_code_extent(&tcx.region_maps),
-                    bound_region: ty::BrNamed(tcx.map.local_def_id(id),
+                    bound_region: ty::BrNamed(tcx.hir.local_def_id(id),
                                               lifetime.name,
                                               issue_32330)
             })
@@ -245,8 +245,8 @@ fn report_elision_failure(
         } = info;
 
         let help_name = if let Some(body) = parent {
-            let arg = &tcx.map.body(body).arguments[index];
-            format!("`{}`", tcx.map.node_to_pretty_string(arg.pat.id))
+            let arg = &tcx.hir.body(body).arguments[index];
+            format!("`{}`", tcx.hir.node_to_pretty_string(arg.pat.id))
         } else {
             format!("argument {}", index + 1)
         };
@@ -684,7 +684,7 @@ fn trait_def_id(&self, trait_ref: &hir::TraitRef) -> DefId {
             }
             _ => {
                 span_fatal!(self.tcx().sess, path.span, E0245, "`{}` is not a trait",
-                            self.tcx().map.node_to_pretty_string(trait_ref.ref_id));
+                            self.tcx().hir.node_to_pretty_string(trait_ref.ref_id));
             }
         }
     }
@@ -1152,7 +1152,7 @@ fn one_bound_for_assoc_type<I>(&self,
                 let bound_span = self.tcx().associated_items(bound.def_id()).find(|item| {
                     item.kind == ty::AssociatedKind::Type && item.name == assoc_name
                 })
-                .and_then(|item| self.tcx().map.span_if_local(item.def_id));
+                .and_then(|item| self.tcx().hir.span_if_local(item.def_id));
 
                 if let Some(span) = bound_span {
                     err.span_label(span, &format!("ambiguous `{}` from `{}`",
@@ -1223,7 +1223,7 @@ pub fn associated_path_def_to_ty(&self,
                 }
             }
             (&ty::TyParam(_), Def::SelfTy(Some(trait_did), None)) => {
-                let trait_node_id = tcx.map.as_local_node_id(trait_did).unwrap();
+                let trait_node_id = tcx.hir.as_local_node_id(trait_did).unwrap();
                 match self.find_bound_for_assoc_item(trait_node_id,
                                                      keywords::SelfType.name(),
                                                      assoc_name,
@@ -1233,7 +1233,7 @@ pub fn associated_path_def_to_ty(&self,
                 }
             }
             (&ty::TyParam(_), Def::TyParam(param_did)) => {
-                let param_node_id = tcx.map.as_local_node_id(param_did).unwrap();
+                let param_node_id = tcx.hir.as_local_node_id(param_did).unwrap();
                 let param_name = tcx.type_parameter_def(param_node_id).name;
                 match self.find_bound_for_assoc_item(param_node_id,
                                                      param_name,
@@ -1379,7 +1379,7 @@ pub fn def_to_ty(&self,
                 assert_eq!(opt_self_ty, None);
                 tcx.prohibit_type_params(&path.segments);
 
-                let node_id = tcx.map.as_local_node_id(did).unwrap();
+                let node_id = tcx.hir.as_local_node_id(did).unwrap();
                 let param = tcx.ty_param_defs.borrow().get(&node_id)
                                .map(ty::ParamTy::for_def);
                 if let Some(p) = param {
@@ -1544,10 +1544,10 @@ pub fn ast_ty_to_ty(&self, rscope: &RegionScope, ast_ty: &hir::Ty) -> Ty<'tcx> {
                 use collect::{compute_bounds, SizedByDefault};
 
                 // Create the anonymized type.
-                let def_id = tcx.map.local_def_id(ast_ty.id);
+                let def_id = tcx.hir.local_def_id(ast_ty.id);
                 if let Some(anon_scope) = rscope.anon_type_scope() {
                     let substs = anon_scope.fresh_substs(self, ast_ty.span);
-                    let ty = tcx.mk_anon(tcx.map.local_def_id(ast_ty.id), substs);
+                    let ty = tcx.mk_anon(tcx.hir.local_def_id(ast_ty.id), substs);
 
                     // Collect the bounds, i.e. the `A+B+'c` in `impl A+B+'c`.
                     let bounds = compute_bounds(self, ty, bounds,
index 3b3c0257c4a412ca56c9a44aac6c7b19385bd06f..932e7ae1dd4266ffa480e092fbae9cf3e44033e7 100644 (file)
@@ -139,7 +139,7 @@ pub fn check_pat_arg(&self, pat: &'gcx hir::Pat, expected: Ty<'tcx>, is_arg: boo
 
                 // if there are multiple arms, make sure they all agree on
                 // what the type of the binding `x` ought to be
-                let var_id = tcx.map.as_local_node_id(def_id).unwrap();
+                let var_id = tcx.hir.as_local_node_id(def_id).unwrap();
                 if var_id != pat.id {
                     let vt = self.local_ty(pat.span, var_id);
                     self.demand_eqtype(pat.span, vt, typ);
@@ -561,7 +561,7 @@ fn check_pat_path(&self,
             span_err!(tcx.sess, pat.span, E0533,
                       "expected unit struct/variant or constant, found {} `{}`",
                       def.kind_name(),
-                      hir::print::to_string(&tcx.map, |s| s.print_qpath(qpath, false)));
+                      hir::print::to_string(&tcx.hir, |s| s.print_qpath(qpath, false)));
         };
 
         // Resolve the path and check the definition for errors.
@@ -603,7 +603,7 @@ fn check_pat_tuple_struct(&self,
         let report_unexpected_def = |def: Def| {
             let msg = format!("expected tuple struct/variant, found {} `{}`",
                               def.kind_name(),
-                              hir::print::to_string(&tcx.map, |s| s.print_qpath(qpath, false)));
+                              hir::print::to_string(&tcx.hir, |s| s.print_qpath(qpath, false)));
             struct_span_err!(tcx.sess, pat.span, E0164, "{}", msg)
                 .span_label(pat.span, &format!("not a tuple variant or struct")).emit();
             on_error();
index 0b9cf38fa073316a3d1adffa112f545029a1a013..3a980c8e7642bae14c380ddad7e1f0f1bf1bb540 100644 (file)
@@ -194,7 +194,7 @@ fn confirm_builtin_call(&self,
 
         let (fn_sig, def_span) = match callee_ty.sty {
             ty::TyFnDef(def_id, .., &ty::BareFnTy {ref sig, ..}) => {
-                (sig, self.tcx.map.span_if_local(def_id))
+                (sig, self.tcx.hir.span_if_local(def_id))
             }
             ty::TyFnPtr(&ty::BareFnTy {ref sig, ..}) => (sig, None),
             ref t => {
@@ -202,7 +202,7 @@ fn confirm_builtin_call(&self,
                 if let &ty::TyAdt(adt_def, ..) = t {
                     if adt_def.is_enum() {
                         if let hir::ExprCall(ref expr, _) = call_expr.node {
-                            unit_variant = Some(self.tcx.map.node_to_pretty_string(expr.id))
+                            unit_variant = Some(self.tcx.hir.node_to_pretty_string(expr.id))
                         }
                     }
                 }
@@ -225,7 +225,7 @@ fn confirm_builtin_call(&self,
                         Def::Err
                     };
                     if def != Def::Err {
-                        if let Some(span) = self.tcx.map.span_if_local(def.def_id()) {
+                        if let Some(span) = self.tcx.hir.span_if_local(def.def_id()) {
                             err.span_note(span, "defined here");
                         }
                     }
index 0551887e2e8a0d41aad7032a82e3e28f27f117f8..2e6592b55017961034aff71eb3398c012209e428 100644 (file)
@@ -39,7 +39,7 @@ pub fn check_expr_closure(&self,
             Some(ty) => self.deduce_expectations_from_expected_type(ty),
             None => (None, None),
         };
-        let body = self.tcx.map.body(body_id);
+        let body = self.tcx.hir.body(body_id);
         self.check_closure(expr, expected_kind, decl, body, expected_sig)
     }
 
@@ -54,7 +54,7 @@ fn check_closure(&self,
                opt_kind,
                expected_sig);
 
-        let expr_def_id = self.tcx.map.local_def_id(expr.id);
+        let expr_def_id = self.tcx.hir.local_def_id(expr.id);
         let mut fn_ty = AstConv::ty_of_closure(self,
                                                hir::Unsafety::Normal,
                                                decl,
index 3960dc9edbd2795edecbd0bd8f4fadbfeb0108b3..d110c16cf331396e133e95315cc154a8722564a8 100644 (file)
@@ -170,7 +170,7 @@ fn compare_predicate_entailment<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
 
     // Create a parameter environment that represents the implementation's
     // method.
-    let impl_m_node_id = tcx.map.as_local_node_id(impl_m.def_id).unwrap();
+    let impl_m_node_id = tcx.hir.as_local_node_id(impl_m.def_id).unwrap();
     let impl_param_env = ty::ParameterEnvironment::for_item(tcx, impl_m_node_id);
 
     // Create mapping from impl to skolemized.
@@ -437,8 +437,8 @@ fn extract_spans_for_error_reporting<'a, 'gcx, 'tcx>(infcx: &infer::InferCtxt<'a
                                                      trait_sig: ty::FnSig<'tcx>)
                                                      -> (Span, Option<Span>) {
     let tcx = infcx.tcx;
-    let impl_m_node_id = tcx.map.as_local_node_id(impl_m.def_id).unwrap();
-    let (impl_m_output, impl_m_iter) = match tcx.map.expect_impl_item(impl_m_node_id).node {
+    let impl_m_node_id = tcx.hir.as_local_node_id(impl_m.def_id).unwrap();
+    let (impl_m_output, impl_m_iter) = match tcx.hir.expect_impl_item(impl_m_node_id).node {
         ImplItemKind::Method(ref impl_m_sig, _) => {
             (&impl_m_sig.decl.output, impl_m_sig.decl.inputs.iter())
         }
@@ -447,8 +447,8 @@ fn extract_spans_for_error_reporting<'a, 'gcx, 'tcx>(infcx: &infer::InferCtxt<'a
 
     match *terr {
         TypeError::Mutability => {
-            if let Some(trait_m_node_id) = tcx.map.as_local_node_id(trait_m.def_id) {
-                let trait_m_iter = match tcx.map.expect_trait_item(trait_m_node_id).node {
+            if let Some(trait_m_node_id) = tcx.hir.as_local_node_id(trait_m.def_id) {
+                let trait_m_iter = match tcx.hir.expect_trait_item(trait_m_node_id).node {
                     TraitItemKind::Method(ref trait_m_sig, _) => {
                         trait_m_sig.decl.inputs.iter()
                     }
@@ -466,15 +466,15 @@ fn extract_spans_for_error_reporting<'a, 'gcx, 'tcx>(infcx: &infer::InferCtxt<'a
                 }).map(|(ref impl_arg, ref trait_arg)| {
                     (impl_arg.span, Some(trait_arg.span))
                 })
-                .unwrap_or_else(|| (cause.span, tcx.map.span_if_local(trait_m.def_id)))
+                .unwrap_or_else(|| (cause.span, tcx.hir.span_if_local(trait_m.def_id)))
             } else {
-                (cause.span, tcx.map.span_if_local(trait_m.def_id))
+                (cause.span, tcx.hir.span_if_local(trait_m.def_id))
             }
         }
         TypeError::Sorts(ExpectedFound { .. }) => {
-            if let Some(trait_m_node_id) = tcx.map.as_local_node_id(trait_m.def_id) {
+            if let Some(trait_m_node_id) = tcx.hir.as_local_node_id(trait_m.def_id) {
                 let (trait_m_output, trait_m_iter) =
-                    match tcx.map.expect_trait_item(trait_m_node_id).node {
+                    match tcx.hir.expect_trait_item(trait_m_node_id).node {
                         TraitItemKind::Method(ref trait_m_sig, _) => {
                             (&trait_m_sig.decl.output, trait_m_sig.decl.inputs.iter())
                         }
@@ -499,14 +499,14 @@ fn extract_spans_for_error_reporting<'a, 'gcx, 'tcx>(infcx: &infer::InferCtxt<'a
                                      .is_err() {
                                          (impl_m_output.span(), Some(trait_m_output.span()))
                                      } else {
-                                         (cause.span, tcx.map.span_if_local(trait_m.def_id))
+                                         (cause.span, tcx.hir.span_if_local(trait_m.def_id))
                                      }
                          })
             } else {
-                (cause.span, tcx.map.span_if_local(trait_m.def_id))
+                (cause.span, tcx.hir.span_if_local(trait_m.def_id))
             }
         }
-        _ => (cause.span, tcx.map.span_if_local(trait_m.def_id)),
+        _ => (cause.span, tcx.hir.span_if_local(trait_m.def_id)),
     }
 }
 
@@ -554,7 +554,7 @@ fn compare_self_type<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
                                            trait_m.name,
                                            self_descr);
             err.span_label(impl_m_span, &format!("`{}` used in impl", self_descr));
-            if let Some(span) = tcx.map.span_if_local(trait_m.def_id) {
+            if let Some(span) = tcx.hir.span_if_local(trait_m.def_id) {
                 err.span_label(span, &format!("trait declared without `{}`", self_descr));
             }
             err.emit();
@@ -572,7 +572,7 @@ fn compare_self_type<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
                                            self_descr);
             err.span_label(impl_m_span,
                            &format!("expected `{}` in impl", self_descr));
-            if let Some(span) = tcx.map.span_if_local(trait_m.def_id) {
+            if let Some(span) = tcx.hir.span_if_local(trait_m.def_id) {
                 err.span_label(span, &format!("`{}` used in trait", self_descr));
             }
             err.emit();
@@ -595,8 +595,8 @@ fn compare_number_of_generics<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
     let num_impl_m_type_params = impl_m_generics.types.len();
     let num_trait_m_type_params = trait_m_generics.types.len();
     if num_impl_m_type_params != num_trait_m_type_params {
-        let impl_m_node_id = tcx.map.as_local_node_id(impl_m.def_id).unwrap();
-        let span = match tcx.map.expect_impl_item(impl_m_node_id).node {
+        let impl_m_node_id = tcx.hir.as_local_node_id(impl_m.def_id).unwrap();
+        let span = match tcx.hir.expect_impl_item(impl_m_node_id).node {
             ImplItemKind::Method(ref impl_m_sig, _) => {
                 if impl_m_sig.generics.is_parameterized() {
                     impl_m_sig.generics.span
@@ -671,9 +671,9 @@ fn compare_number_of_method_arguments<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
     let trait_number_args = trait_m_fty.sig.inputs().skip_binder().len();
     let impl_number_args = impl_m_fty.sig.inputs().skip_binder().len();
     if trait_number_args != impl_number_args {
-        let trait_m_node_id = tcx.map.as_local_node_id(trait_m.def_id);
+        let trait_m_node_id = tcx.hir.as_local_node_id(trait_m.def_id);
         let trait_span = if let Some(trait_id) = trait_m_node_id {
-            match tcx.map.expect_trait_item(trait_id).node {
+            match tcx.hir.expect_trait_item(trait_id).node {
                 TraitItemKind::Method(ref trait_m_sig, _) => {
                     if let Some(arg) = trait_m_sig.decl.inputs.get(if trait_number_args > 0 {
                         trait_number_args - 1
@@ -690,8 +690,8 @@ fn compare_number_of_method_arguments<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
         } else {
             trait_item_span
         };
-        let impl_m_node_id = tcx.map.as_local_node_id(impl_m.def_id).unwrap();
-        let impl_span = match tcx.map.expect_impl_item(impl_m_node_id).node {
+        let impl_m_node_id = tcx.hir.as_local_node_id(impl_m.def_id).unwrap();
+        let impl_span = match tcx.hir.expect_impl_item(impl_m_node_id).node {
             ImplItemKind::Method(ref impl_m_sig, _) => {
                 if let Some(arg) = impl_m_sig.decl.inputs.get(if impl_number_args > 0 {
                     impl_number_args - 1
@@ -759,7 +759,7 @@ pub fn compare_const_impl<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
 
         // Create a parameter environment that represents the implementation's
         // method.
-        let impl_c_node_id = tcx.map.as_local_node_id(impl_c.def_id).unwrap();
+        let impl_c_node_id = tcx.hir.as_local_node_id(impl_c.def_id).unwrap();
         let impl_param_env = ty::ParameterEnvironment::for_item(tcx, impl_c_node_id);
 
         // Create mapping from impl to skolemized.
@@ -810,7 +810,7 @@ pub fn compare_const_impl<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
                    trait_ty);
 
             // Locate the Span containing just the type of the offending impl
-            match tcx.map.expect_impl_item(impl_c_node_id).node {
+            match tcx.hir.expect_impl_item(impl_c_node_id).node {
                 ImplItemKind::Const(ref ty, _) => cause.span = ty.span,
                 _ => bug!("{:?} is not a impl const", impl_c),
             }
@@ -823,8 +823,8 @@ pub fn compare_const_impl<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
                                             trait_c.name);
 
             // Add a label to the Span containing just the type of the item
-            let trait_c_node_id = tcx.map.as_local_node_id(trait_c.def_id).unwrap();
-            let trait_c_span = match tcx.map.expect_trait_item(trait_c_node_id).node {
+            let trait_c_node_id = tcx.hir.as_local_node_id(trait_c.def_id).unwrap();
+            let trait_c_span = match tcx.hir.expect_trait_item(trait_c_node_id).node {
                 TraitItemKind::Const(ref ty, _) => ty.span,
                 _ => bug!("{:?} is not a trait const", trait_c),
             };
index 9cd54bd94c8172f8809c4c10d7eaff2a26aa736e..91b772a748c72c28a6dc4ab11ff6a5da08769946 100644 (file)
@@ -75,8 +75,8 @@ fn ensure_drop_params_and_item_params_correspond<'a, 'tcx>(
     -> Result<(), ()>
 {
     let tcx = ccx.tcx;
-    let drop_impl_node_id = tcx.map.as_local_node_id(drop_impl_did).unwrap();
-    let self_type_node_id = tcx.map.as_local_node_id(self_type_did).unwrap();
+    let drop_impl_node_id = tcx.hir.as_local_node_id(drop_impl_did).unwrap();
+    let self_type_node_id = tcx.hir.as_local_node_id(self_type_did).unwrap();
 
     // check that the impl type can be made to match the trait type.
 
@@ -100,7 +100,7 @@ fn ensure_drop_params_and_item_params_correspond<'a, 'tcx>(
                 assert!(obligations.is_empty());
             }
             Err(_) => {
-                let item_span = tcx.map.span(self_type_node_id);
+                let item_span = tcx.hir.span(self_type_node_id);
                 struct_span_err!(tcx.sess, drop_impl_span, E0366,
                                  "Implementations of Drop cannot be specialized")
                     .span_note(item_span,
@@ -171,7 +171,7 @@ fn ensure_drop_predicates_are_implied_by_item_defn<'a, 'tcx>(
 
     let tcx = ccx.tcx;
 
-    let self_type_node_id = tcx.map.as_local_node_id(self_type_did).unwrap();
+    let self_type_node_id = tcx.hir.as_local_node_id(self_type_did).unwrap();
 
     let drop_impl_span = tcx.def_span(drop_impl_did);
 
@@ -203,7 +203,7 @@ fn ensure_drop_predicates_are_implied_by_item_defn<'a, 'tcx>(
         // repeated `contains` calls.
 
         if !assumptions_in_impl_context.contains(&predicate) {
-            let item_span = tcx.map.span(self_type_node_id);
+            let item_span = tcx.hir.span(self_type_node_id);
             struct_span_err!(tcx.sess, drop_impl_span, E0367,
                              "The requirement `{}` is added only by the Drop impl.", predicate)
                 .span_note(item_span,
index 4f41bbe9924b0f54fd37da4d9833625b27984aca..7ead7ada893d7bccdb2e284a13d19c300ee21c83 100644 (file)
@@ -34,7 +34,7 @@ fn equate_intrinsic_type<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
                                    inputs: Vec<Ty<'tcx>>,
                                    output: Ty<'tcx>) {
     let tcx = ccx.tcx;
-    let def_id = tcx.map.local_def_id(it.id);
+    let def_id = tcx.hir.local_def_id(it.id);
 
     let substs = Substs::for_item(tcx, def_id,
                                   |_, _| tcx.mk_region(ty::ReErased),
@@ -324,7 +324,7 @@ pub fn check_platform_intrinsic_type(ccx: &CrateCtxt,
     };
 
     let tcx = ccx.tcx;
-    let def_id = tcx.map.local_def_id(it.id);
+    let def_id = tcx.hir.local_def_id(it.id);
     let i_n_tps = tcx.item_generics(def_id).types.len();
     let name = it.name.as_str();
 
index aa8f3bef92ed2da298b08c00a88e6d9ba36d046d..e2d7d31a8a890b0ca3586caa7809cef9821326e0 100644 (file)
@@ -803,7 +803,7 @@ fn assemble_closure_candidates(&mut self,
         for step in steps.iter() {
             let closure_id = match step.self_ty.sty {
                 ty::TyClosure(def_id, _) => {
-                    if let Some(id) = self.tcx.map.as_local_node_id(def_id) {
+                    if let Some(id) = self.tcx.hir.as_local_node_id(def_id) {
                         id
                     } else {
                         continue;
index b1705425e6eb0cdd77501f93cfe76b1f6a2a99f5..f6345e6e262db618192ee00d2719f77c48e5f42a 100644 (file)
@@ -99,8 +99,8 @@ pub fn report_method_error(&self,
                                     item_name
                                 )
                             }).unwrap();
-                        let note_span = self.tcx.map.span_if_local(item.def_id).or_else(|| {
-                            self.tcx.map.span_if_local(impl_did)
+                        let note_span = self.tcx.hir.span_if_local(item.def_id).or_else(|| {
+                            self.tcx.hir.span_if_local(impl_did)
                         });
 
                         let impl_ty = self.impl_self_ty(span, impl_did).ty;
@@ -285,7 +285,7 @@ macro_rules! report_function {
                 let msg = if let Some(callee) = rcvr_expr {
                     format!("{}; use overloaded call notation instead (e.g., `{}()`)",
                             msg,
-                            self.tcx.map.node_to_pretty_string(callee.id))
+                            self.tcx.hir.node_to_pretty_string(callee.id))
                 } else {
                     msg
                 };
@@ -488,8 +488,8 @@ fn visit_trait_item(&mut self, _trait_item: &hir::TraitItem) {
             fn visit_impl_item(&mut self, _impl_item: &hir::ImplItem) {
             }
         }
-        ccx.tcx.map.krate().visit_all_item_likes(&mut Visitor {
-            map: &ccx.tcx.map,
+        ccx.tcx.hir.krate().visit_all_item_likes(&mut Visitor {
+            map: &ccx.tcx.hir,
             traits: &mut traits,
         });
 
index 7a9df90c1a6138e045f69facdd2bf4a71edae242..7b87ec5dd5d2fb6907e7bbea77bd9924024ebdd9 100644 (file)
@@ -538,7 +538,7 @@ struct CheckItemBodiesVisitor<'a, 'tcx: 'a> { ccx: &'a CrateCtxt<'a, 'tcx> }
 
 impl<'a, 'tcx> Visitor<'tcx> for CheckItemTypesVisitor<'a, 'tcx> {
     fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
-        NestedVisitorMap::OnlyBodies(&self.ccx.tcx.map)
+        NestedVisitorMap::OnlyBodies(&self.ccx.tcx.hir)
     }
 
     fn visit_item(&mut self, i: &'tcx hir::Item) {
@@ -634,7 +634,7 @@ pub fn check_item_bodies(ccx: &CrateCtxt) -> CompileResult {
         // bodies have been fully inferred.
         for (&item_id, obligations) in ccx.deferred_obligations.borrow().iter() {
             // Use the same DepNode as for the body of the original function/item.
-            let def_id = ccx.tcx.map.local_def_id(item_id);
+            let def_id = ccx.tcx.hir.local_def_id(item_id);
             let _task = ccx.tcx.dep_graph.in_task(DepNode::TypeckTables(def_id));
 
             let param_env = ParameterEnvironment::for_item(ccx.tcx, item_id);
@@ -677,9 +677,9 @@ fn check_bare_fn<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
                            body_id: hir::BodyId,
                            fn_id: ast::NodeId,
                            span: Span) {
-    let body = ccx.tcx.map.body(body_id);
+    let body = ccx.tcx.hir.body(body_id);
 
-    let raw_fty = ccx.tcx.item_type(ccx.tcx.map.local_def_id(fn_id));
+    let raw_fty = ccx.tcx.item_type(ccx.tcx.hir.local_def_id(fn_id));
     let fn_ty = match raw_fty.sty {
         ty::TyFnDef(.., f) => f,
         _ => span_bug!(body.value.span, "check_bare_fn: function type expected")
@@ -835,7 +835,7 @@ fn check_fn<'a, 'gcx, 'tcx>(inherited: &'a Inherited<'a, 'gcx, 'tcx>,
 }
 
 fn check_struct(ccx: &CrateCtxt, id: ast::NodeId, span: Span) {
-    let def_id = ccx.tcx.map.local_def_id(id);
+    let def_id = ccx.tcx.hir.local_def_id(id);
     check_representable(ccx.tcx, span, def_id);
 
     if ccx.tcx.lookup_simd(def_id) {
@@ -844,13 +844,13 @@ fn check_struct(ccx: &CrateCtxt, id: ast::NodeId, span: Span) {
 }
 
 fn check_union(ccx: &CrateCtxt, id: ast::NodeId, span: Span) {
-    check_representable(ccx.tcx, span, ccx.tcx.map.local_def_id(id));
+    check_representable(ccx.tcx, span, ccx.tcx.hir.local_def_id(id));
 }
 
 pub fn check_item_type<'a,'tcx>(ccx: &CrateCtxt<'a,'tcx>, it: &'tcx hir::Item) {
     debug!("check_item_type(it.id={}, it.name={})",
            it.id,
-           ccx.tcx.item_path_str(ccx.tcx.map.local_def_id(it.id)));
+           ccx.tcx.item_path_str(ccx.tcx.hir.local_def_id(it.id)));
     let _indenter = indenter();
     match it.node {
       // Consts can play a role in type-checking, so they are included here.
@@ -865,7 +865,7 @@ pub fn check_item_type<'a,'tcx>(ccx: &CrateCtxt<'a,'tcx>, it: &'tcx hir::Item) {
       hir::ItemFn(..) => {} // entirely within check_item_body
       hir::ItemImpl(.., ref impl_item_refs) => {
           debug!("ItemImpl {} with id {}", it.name, it.id);
-          let impl_def_id = ccx.tcx.map.local_def_id(it.id);
+          let impl_def_id = ccx.tcx.hir.local_def_id(it.id);
           if let Some(impl_trait_ref) = ccx.tcx.impl_trait_ref(impl_def_id) {
               check_impl_items_against_trait(ccx,
                                              it.span,
@@ -877,7 +877,7 @@ pub fn check_item_type<'a,'tcx>(ccx: &CrateCtxt<'a,'tcx>, it: &'tcx hir::Item) {
           }
       }
       hir::ItemTrait(..) => {
-        let def_id = ccx.tcx.map.local_def_id(it.id);
+        let def_id = ccx.tcx.hir.local_def_id(it.id);
         check_on_unimplemented(ccx, def_id, it);
       }
       hir::ItemStruct(..) => {
@@ -887,7 +887,7 @@ pub fn check_item_type<'a,'tcx>(ccx: &CrateCtxt<'a,'tcx>, it: &'tcx hir::Item) {
         check_union(ccx, it.id, it.span);
       }
       hir::ItemTy(_, ref generics) => {
-        let def_id = ccx.tcx.map.local_def_id(it.id);
+        let def_id = ccx.tcx.hir.local_def_id(it.id);
         let pty_ty = ccx.tcx.item_type(def_id);
         check_bounds_are_used(ccx, generics, pty_ty);
       }
@@ -904,7 +904,7 @@ pub fn check_item_type<'a,'tcx>(ccx: &CrateCtxt<'a,'tcx>, it: &'tcx hir::Item) {
             }
         } else {
             for item in &m.items {
-                let generics = ccx.tcx.item_generics(ccx.tcx.map.local_def_id(item.id));
+                let generics = ccx.tcx.item_generics(ccx.tcx.hir.local_def_id(item.id));
                 if !generics.types.is_empty() {
                     let mut err = struct_span_err!(ccx.tcx.sess, item.span, E0044,
                         "foreign items may not have type parameters");
@@ -1038,12 +1038,12 @@ fn check_impl_items_against_trait<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
     let trait_def = tcx.lookup_trait_def(impl_trait_ref.def_id);
     let mut overridden_associated_type = None;
 
-    let impl_items = || impl_item_refs.iter().map(|iiref| ccx.tcx.map.impl_item(iiref.id));
+    let impl_items = || impl_item_refs.iter().map(|iiref| ccx.tcx.hir.impl_item(iiref.id));
 
     // Check existing impl methods to see if they are both present in trait
     // and compatible with trait signature
     for impl_item in impl_items() {
-        let ty_impl_item = tcx.associated_item(tcx.map.local_def_id(impl_item.id));
+        let ty_impl_item = tcx.associated_item(tcx.hir.local_def_id(impl_item.id));
         let ty_trait_item = tcx.associated_items(impl_trait_ref.def_id)
             .find(|ac| ac.name == ty_impl_item.name);
 
@@ -1067,14 +1067,14 @@ fn check_impl_items_against_trait<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
                          err.span_label(impl_item.span, &format!("does not match trait"));
                          // We can only get the spans from local trait definition
                          // Same for E0324 and E0325
-                         if let Some(trait_span) = tcx.map.span_if_local(ty_trait_item.def_id) {
+                         if let Some(trait_span) = tcx.hir.span_if_local(ty_trait_item.def_id) {
                             err.span_label(trait_span, &format!("item in trait"));
                          }
                          err.emit()
                     }
                 }
                 hir::ImplItemKind::Method(_, body_id) => {
-                    let trait_span = tcx.map.span_if_local(ty_trait_item.def_id);
+                    let trait_span = tcx.hir.span_if_local(ty_trait_item.def_id);
                     if ty_trait_item.kind == ty::AssociatedKind::Method {
                         let err_count = tcx.sess.err_count();
                         compare_impl_method(ccx,
@@ -1103,7 +1103,7 @@ fn check_impl_items_against_trait<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
                                   ty_impl_item.name,
                                   impl_trait_ref);
                          err.span_label(impl_item.span, &format!("does not match trait"));
-                         if let Some(trait_span) = tcx.map.span_if_local(ty_trait_item.def_id) {
+                         if let Some(trait_span) = tcx.hir.span_if_local(ty_trait_item.def_id) {
                             err.span_label(trait_span, &format!("item in trait"));
                          }
                          err.emit()
@@ -1121,7 +1121,7 @@ fn check_impl_items_against_trait<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
                                   ty_impl_item.name,
                                   impl_trait_ref);
                          err.span_label(impl_item.span, &format!("does not match trait"));
-                         if let Some(trait_span) = tcx.map.span_if_local(ty_trait_item.def_id) {
+                         if let Some(trait_span) = tcx.hir.span_if_local(ty_trait_item.def_id) {
                             err.span_label(trait_span, &format!("item in trait"));
                          }
                          err.emit()
@@ -1176,7 +1176,7 @@ fn check_impl_items_against_trait<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
                     .map(|trait_item| trait_item.name.to_string())
                     .collect::<Vec<_>>().join("`, `")));
         for trait_item in missing_items {
-            if let Some(span) = tcx.map.span_if_local(trait_item.def_id) {
+            if let Some(span) = tcx.hir.span_if_local(trait_item.def_id) {
                 err.span_label(span, &format!("`{}` from trait", trait_item.name));
             } else {
                 err.note(&format!("`{}` from trait: `{}`",
@@ -1204,7 +1204,7 @@ fn check_const_with_type<'a, 'tcx>(ccx: &'a CrateCtxt<'a, 'tcx>,
                                    body: hir::BodyId,
                                    expected_type: Ty<'tcx>,
                                    id: ast::NodeId) {
-    let body = ccx.tcx.map.body(body);
+    let body = ccx.tcx.hir.body(body);
     ccx.inherited(id).enter(|inh| {
         let fcx = FnCtxt::new(&inh, None, body.value.id);
         fcx.require_type_is_sized(expected_type, body.value.span, traits::ConstSized);
@@ -1231,7 +1231,7 @@ fn check_const_with_type<'a, 'tcx>(ccx: &'a CrateCtxt<'a, 'tcx>,
 fn check_const<'a, 'tcx>(ccx: &CrateCtxt<'a,'tcx>,
                          body: hir::BodyId,
                          id: ast::NodeId) {
-    let decl_ty = ccx.tcx.item_type(ccx.tcx.map.local_def_id(id));
+    let decl_ty = ccx.tcx.item_type(ccx.tcx.hir.local_def_id(id));
     check_const_with_type(ccx, body, decl_ty, id);
 }
 
@@ -1294,7 +1294,7 @@ pub fn check_enum_variants<'a,'tcx>(ccx: &CrateCtxt<'a,'tcx>,
                                     sp: Span,
                                     vs: &'tcx [hir::Variant],
                                     id: ast::NodeId) {
-    let def_id = ccx.tcx.map.local_def_id(id);
+    let def_id = ccx.tcx.hir.local_def_id(id);
     let hint = *ccx.tcx.lookup_repr_hints(def_id).get(0).unwrap_or(&attr::ReprAny);
 
     if hint != attr::ReprAny && vs.is_empty() {
@@ -1319,7 +1319,7 @@ pub fn check_enum_variants<'a,'tcx>(ccx: &CrateCtxt<'a,'tcx>,
         }
     }
 
-    let def_id = ccx.tcx.map.local_def_id(id);
+    let def_id = ccx.tcx.hir.local_def_id(id);
 
     let variants = &ccx.tcx.lookup_adt_def(def_id).variants;
     let mut disr_vals: Vec<ty::Disr> = Vec::new();
@@ -1328,14 +1328,14 @@ pub fn check_enum_variants<'a,'tcx>(ccx: &CrateCtxt<'a,'tcx>,
 
         // Check for duplicate discriminant values
         if let Some(i) = disr_vals.iter().position(|&x| x == current_disr_val) {
-            let variant_i_node_id = ccx.tcx.map.as_local_node_id(variants[i].did).unwrap();
-            let variant_i = ccx.tcx.map.expect_variant(variant_i_node_id);
+            let variant_i_node_id = ccx.tcx.hir.as_local_node_id(variants[i].did).unwrap();
+            let variant_i = ccx.tcx.hir.expect_variant(variant_i_node_id);
             let i_span = match variant_i.node.disr_expr {
-                Some(expr) => ccx.tcx.map.span(expr.node_id),
-                None => ccx.tcx.map.span(variant_i_node_id)
+                Some(expr) => ccx.tcx.hir.span(expr.node_id),
+                None => ccx.tcx.hir.span(variant_i_node_id)
             };
             let span = match v.node.disr_expr {
-                Some(expr) => ccx.tcx.map.span(expr.node_id),
+                Some(expr) => ccx.tcx.hir.span(expr.node_id),
                 None => v.span
             };
             struct_span_err!(ccx.tcx.sess, span, E0081,
@@ -1610,7 +1610,7 @@ pub fn local_ty(&self, span: Span, nid: ast::NodeId) -> Ty<'tcx> {
             Some(&t) => t,
             None => {
                 span_bug!(span, "no type for local variable {}",
-                          self.tcx.map.node_to_string(nid));
+                          self.tcx.hir.node_to_string(nid));
             }
         }
     }
@@ -1841,7 +1841,7 @@ pub fn node_ty(&self, id: ast::NodeId) -> Ty<'tcx> {
             None if self.err_count_since_creation() != 0 => self.tcx.types.err,
             None => {
                 bug!("no type for node {}: {} in fcx {}",
-                     id, self.tcx.map.node_to_string(id),
+                     id, self.tcx.hir.node_to_string(id),
                      self.tag());
             }
         }
@@ -2159,7 +2159,7 @@ fn new_select_all_obligations_and_apply_defaults(&self) {
                                     TypeVariableOrigin::MiscVariable(syntax_pos::DUMMY_SP)),
                                 origin_span: syntax_pos::DUMMY_SP,
                                 // what do I put here?
-                                def_id: self.tcx.map.local_def_id(ast::CRATE_NODE_ID)
+                                def_id: self.tcx.hir.local_def_id(ast::CRATE_NODE_ID)
                             });
 
                     // This is to ensure that we elimnate any non-determinism from the error
@@ -2435,7 +2435,7 @@ fn check_method_argument_types(&self,
                     );
                     self.check_argument_types(sp, &fty.sig.0.inputs()[1..], &expected_arg_tys[..],
                                               args_no_rcvr, fty.sig.0.variadic, tuple_arguments,
-                                              self.tcx.map.span_if_local(def_id));
+                                              self.tcx.hir.span_if_local(def_id));
                     fty.sig.0.output()
                 }
                 _ => {
@@ -3021,7 +3021,7 @@ fn check_field(&self,
                 ty::TyRawPtr(..) => {
                     err.note(&format!("`{0}` is a native pointer; perhaps you need to deref with \
                                       `(*{0}).{1}`",
-                                      self.tcx.map.node_to_pretty_string(base.id),
+                                      self.tcx.hir.node_to_pretty_string(base.id),
                                       field.node));
                 }
                 _ => {}
@@ -3436,12 +3436,12 @@ fn check_expr_with_expectation_and_lvalue_pref(&self,
         self.diverges.set(self.diverges.get() | old_diverges);
         self.has_errors.set(self.has_errors.get() | old_has_errors);
 
-        debug!("type of {} is...", self.tcx.map.node_to_string(expr.id));
+        debug!("type of {} is...", self.tcx.hir.node_to_string(expr.id));
         debug!("... {:?}, expected is {:?}", ty, expected);
 
         // Add adjustments to !-expressions
         if ty.is_never() {
-            if let Some(hir::map::NodeExpr(node_expr)) = self.tcx.map.find(expr.id) {
+            if let Some(hir::map::NodeExpr(node_expr)) = self.tcx.hir.find(expr.id) {
                 let adj_ty = self.next_diverging_ty_var(
                     TypeVariableOrigin::AdjustmentType(node_expr.span));
                 self.write_adjustment(expr.id, adjustment::Adjustment {
@@ -4370,7 +4370,7 @@ pub fn instantiate_value_path(&self,
 
         match def {
             Def::Local(def_id) | Def::Upvar(def_id, ..) => {
-                let nid = self.tcx.map.as_local_node_id(def_id).unwrap();
+                let nid = self.tcx.hir.as_local_node_id(def_id).unwrap();
                 let ty = self.local_ty(span, nid);
                 let ty = self.normalize_associated_types_in(span, &ty);
                 self.write_ty(node_id, ty);
index bd63eb6ad25effeb2aa95536a598c8f5b48ba62d..9a5d402ef0adfb3a6c8ab28c6f6be35be1be7650 100644 (file)
@@ -148,7 +148,7 @@ pub fn regionck_fn(&self,
 
         if self.err_count_since_creation() == 0 {
             // regionck assumes typeck succeeded
-            rcx.visit_fn_body(fn_id, body, self.tcx.map.span(fn_id));
+            rcx.visit_fn_body(fn_id, body, self.tcx.hir.span(fn_id));
         }
 
         rcx.free_region_map.relate_free_regions_from_predicates(
@@ -482,7 +482,7 @@ fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'gcx> {
 
     fn visit_fn(&mut self, _fk: intravisit::FnKind<'gcx>, _: &'gcx hir::FnDecl,
                 b: hir::BodyId, span: Span, id: ast::NodeId) {
-        let body = self.tcx.map.body(b);
+        let body = self.tcx.hir.body(b);
         self.visit_fn_body(id, body, span)
     }
 
index 95da5a97f6750588f9d1df52a7f8aa0e711bf585..d511d57c3780dbc36647fead7a44747cd9b79238 100644 (file)
@@ -85,7 +85,7 @@ fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'gcx> {
     fn visit_expr(&mut self, expr: &'gcx hir::Expr) {
         match expr.node {
             hir::ExprClosure(cc, _, body_id, _) => {
-                let body = self.fcx.tcx.map.body(body_id);
+                let body = self.fcx.tcx.hir.body(body_id);
                 self.visit_body(body);
                 self.check_closure(expr, cc);
             }
@@ -114,7 +114,7 @@ fn check_closure(&mut self,
         self.fcx.tcx.with_freevars(expr.id, |freevars| {
             for freevar in freevars {
                 let def_id = freevar.def.def_id();
-                let var_node_id = self.fcx.tcx.map.as_local_node_id(def_id).unwrap();
+                let var_node_id = self.fcx.tcx.hir.as_local_node_id(def_id).unwrap();
                 let upvar_id = ty::UpvarId { var_id: var_node_id,
                                              closure_expr_id: expr.id };
                 debug!("seed upvar_id {:?}", upvar_id);
@@ -208,7 +208,7 @@ fn analyze_closure(&mut self,
 
         // If we are also inferred the closure kind here, update the
         // main table and process any deferred resolutions.
-        let closure_def_id = self.fcx.tcx.map.local_def_id(id);
+        let closure_def_id = self.fcx.tcx.hir.local_def_id(id);
         if let Some(&kind) = self.temp_closure_kinds.get(&id) {
             self.fcx.tables.borrow_mut().closure_kinds.insert(id, kind);
             debug!("closure_kind({:?}) = {:?}", closure_def_id, kind);
@@ -232,7 +232,7 @@ fn final_upvar_tys(&mut self, closure_id: ast::NodeId) -> Vec<Ty<'tcx>> {
         tcx.with_freevars(closure_id, |freevars| {
             freevars.iter().map(|freevar| {
                 let def_id = freevar.def.def_id();
-                let var_id = tcx.map.as_local_node_id(def_id).unwrap();
+                let var_id = tcx.hir.as_local_node_id(def_id).unwrap();
                 let freevar_ty = self.fcx.node_ty(var_id);
                 let upvar_id = ty::UpvarId {
                     var_id: var_id,
@@ -500,7 +500,7 @@ fn visit_fn(&mut self,
     {
         intravisit::walk_fn(self, fn_kind, decl, body, span, id);
 
-        let body = self.fcx.tcx.map.body(body);
+        let body = self.fcx.tcx.hir.body(body);
         self.visit_body(body);
         self.analyze_closure(id, span, body);
     }
index 4c124cdd60c0fbc34bdf3c2db05cd29425b6f036..cef6a75e58dc9bdddfe8f1961a9450e2a7c7eff7 100644 (file)
@@ -90,7 +90,7 @@ fn check_item_well_formed(&mut self, item: &hir::Item) {
         let ccx = self.ccx;
         debug!("check_item_well_formed(it.id={}, it.name={})",
                item.id,
-               ccx.tcx.item_path_str(ccx.tcx.map.local_def_id(item.id)));
+               ccx.tcx.item_path_str(ccx.tcx.hir.local_def_id(item.id)));
 
         match item.node {
             /// Right now we check that every default trait implementation
@@ -117,7 +117,7 @@ fn check_item_well_formed(&mut self, item: &hir::Item) {
             hir::ItemImpl(_, hir::ImplPolarity::Negative, _, Some(_), ..) => {
                 // FIXME(#27579) what amount of WF checking do we need for neg impls?
 
-                let trait_ref = ccx.tcx.impl_trait_ref(ccx.tcx.map.local_def_id(item.id)).unwrap();
+                let trait_ref = ccx.tcx.impl_trait_ref(ccx.tcx.hir.local_def_id(item.id)).unwrap();
                 if !ccx.tcx.trait_has_default_impl(trait_ref.def_id) {
                     error_192(ccx, item.span);
                 }
@@ -168,7 +168,7 @@ fn check_associated_item(&mut self,
             let free_substs = &fcx.parameter_environment.free_substs;
             let free_id_outlive = fcx.parameter_environment.free_id_outlive;
 
-            let item = fcx.tcx.associated_item(fcx.tcx.map.local_def_id(item_id));
+            let item = fcx.tcx.associated_item(fcx.tcx.hir.local_def_id(item_id));
 
             let (mut implied_bounds, self_ty) = match item.container {
                 ty::TraitContainer(_) => (vec![], fcx.tcx.mk_self_type()),
@@ -251,7 +251,7 @@ fn check_type_defn<F>(&mut self, item: &hir::Item, all_sized: bool, mut lookup_f
             }
 
             let free_substs = &fcx.parameter_environment.free_substs;
-            let def_id = fcx.tcx.map.local_def_id(item.id);
+            let def_id = fcx.tcx.hir.local_def_id(item.id);
             let predicates = fcx.instantiate_bounds(item.span, def_id, free_substs);
             this.check_where_clauses(fcx, item.span, &predicates);
 
@@ -321,7 +321,7 @@ fn check_auto_trait(&mut self, trait_def_id: DefId, span: Span) {
     }
 
     fn check_trait(&mut self, item: &hir::Item) {
-        let trait_def_id = self.tcx().map.local_def_id(item.id);
+        let trait_def_id = self.tcx().hir.local_def_id(item.id);
 
         if self.tcx().trait_has_default_impl(trait_def_id) {
             self.check_auto_trait(trait_def_id, item.span);
@@ -341,7 +341,7 @@ fn check_item_fn(&mut self,
     {
         self.for_item(item).with_fcx(|fcx, this| {
             let free_substs = &fcx.parameter_environment.free_substs;
-            let def_id = fcx.tcx.map.local_def_id(item.id);
+            let def_id = fcx.tcx.hir.local_def_id(item.id);
             let ty = fcx.tcx.item_type(def_id);
             let item_ty = fcx.instantiate_type_scheme(item.span, free_substs, &ty);
             let bare_fn_ty = match item_ty.sty {
@@ -367,7 +367,7 @@ fn check_item_type(&mut self,
         debug!("check_item_type: {:?}", item);
 
         self.for_item(item).with_fcx(|fcx, this| {
-            let ty = fcx.tcx.item_type(fcx.tcx.map.local_def_id(item.id));
+            let ty = fcx.tcx.item_type(fcx.tcx.hir.local_def_id(item.id));
             let item_ty = fcx.instantiate_type_scheme(item.span,
                                                       &fcx.parameter_environment
                                                           .free_substs,
@@ -388,7 +388,7 @@ fn check_impl(&mut self,
 
         self.for_item(item).with_fcx(|fcx, this| {
             let free_substs = &fcx.parameter_environment.free_substs;
-            let item_def_id = fcx.tcx.map.local_def_id(item.id);
+            let item_def_id = fcx.tcx.hir.local_def_id(item.id);
 
             match *ast_trait_ref {
                 Some(ref ast_trait_ref) => {
@@ -514,7 +514,7 @@ fn check_variances_for_type_defn(&self,
                                      item: &hir::Item,
                                      ast_generics: &hir::Generics)
     {
-        let item_def_id = self.tcx().map.local_def_id(item.id);
+        let item_def_id = self.tcx().hir.local_def_id(item.id);
         let ty = self.tcx().item_type(item_def_id);
         if self.tcx().has_error_field(ty) {
             return;
@@ -644,7 +644,7 @@ fn struct_variant(&self, struct_def: &hir::VariantData) -> AdtVariant<'tcx> {
         let fields =
             struct_def.fields().iter()
             .map(|field| {
-                let field_ty = self.tcx.item_type(self.tcx.map.local_def_id(field.id));
+                let field_ty = self.tcx.item_type(self.tcx.hir.local_def_id(field.id));
                 let field_ty = self.instantiate_type_scheme(field.span,
                                                             &self.parameter_environment
                                                                  .free_substs,
index 172c1dfe35eae17e1da9b9490f22f2ba73f2bd36..b95126af56aa7c43c7b674129e4bd7fda956f8e1 100644 (file)
@@ -36,8 +36,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
     pub fn resolve_type_vars_in_body(&self, body: &'gcx hir::Body) {
         assert_eq!(self.writeback_errors.get(), false);
 
-        let item_id = self.tcx.map.body_owner(body.id());
-        let item_def_id = self.tcx.map.local_def_id(item_id);
+        let item_id = self.tcx.hir.body_owner(body.id());
+        let item_def_id = self.tcx.hir.local_def_id(item_id);
 
         let mut wbcx = WritebackCx::new(self);
         for arg in &body.arguments {
@@ -209,7 +209,7 @@ fn visit_expr(&mut self, e: &'gcx hir::Expr) {
                                     MethodCall::expr(e.id));
 
         if let hir::ExprClosure(_, _, body, _) = e.node {
-            let body = self.fcx.tcx.map.body(body);
+            let body = self.fcx.tcx.hir.body(body);
             for arg in &body.arguments {
                 self.visit_node_id(ResolvingExpr(e.span), arg.id);
             }
@@ -281,12 +281,12 @@ fn visit_closures(&self) {
 
         for (&id, closure_ty) in self.fcx.tables.borrow().closure_tys.iter() {
             let closure_ty = self.resolve(closure_ty, ResolvingClosure(id));
-            let def_id = self.tcx().map.local_def_id(id);
+            let def_id = self.tcx().hir.local_def_id(id);
             self.tcx().closure_tys.borrow_mut().insert(def_id, closure_ty);
         }
 
         for (&id, &closure_kind) in self.fcx.tables.borrow().closure_kinds.iter() {
-            let def_id = self.tcx().map.local_def_id(id);
+            let def_id = self.tcx().hir.local_def_id(id);
             self.tcx().closure_kinds.borrow_mut().insert(def_id, closure_kind);
         }
     }
@@ -517,7 +517,7 @@ fn span(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Span {
             ResolvingFnSig(id) |
             ResolvingFieldTypes(id) |
             ResolvingTyNode(id) => {
-                tcx.map.span(id)
+                tcx.hir.span(id)
             }
             ResolvingAnonTy(did) => {
                 tcx.def_span(did)
index cd9453770a6ab28ff7a3e63af12db965a526fcec..bdda538db160ec3765299ac174188f643693905d 100644 (file)
@@ -60,5 +60,5 @@ fn visit_impl_item(&mut self, _impl_item: &hir::ImplItem) {
 pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
     let _task = tcx.dep_graph.in_task(DepNode::UnusedTraitCheck);
     let mut visitor = UnusedTraitImportVisitor { tcx: tcx };
-    tcx.map.krate().visit_all_item_likes(&mut visitor);
+    tcx.hir.krate().visit_all_item_likes(&mut visitor);
 }
index 57df0fb2cee938302af19b6001d80bcc84235eb8..086484c643ad1c238c5b5fa26acf3cd6504651e2 100644 (file)
@@ -69,8 +69,8 @@ fn visit_implementation_of_drop<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
         }
         _ => {
             // Destructors only work on nominal types.
-            if let Some(impl_node_id) = tcx.map.as_local_node_id(impl_did) {
-                match tcx.map.find(impl_node_id) {
+            if let Some(impl_node_id) = tcx.hir.as_local_node_id(impl_did) {
+                match tcx.hir.find(impl_node_id) {
                     Some(hir_map::NodeItem(item)) => {
                         let span = match item.node {
                             ItemImpl(.., ref ty, _) => ty.span,
@@ -101,7 +101,7 @@ fn visit_implementation_of_copy<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
                                           impl_did: DefId) {
     debug!("visit_implementation_of_copy: impl_did={:?}", impl_did);
 
-    let impl_node_id = if let Some(n) = tcx.map.as_local_node_id(impl_did) {
+    let impl_node_id = if let Some(n) = tcx.hir.as_local_node_id(impl_did) {
         n
     } else {
         debug!("visit_implementation_of_copy(): impl not in this \
@@ -113,7 +113,7 @@ fn visit_implementation_of_copy<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
     debug!("visit_implementation_of_copy: self_type={:?} (bound)",
            self_type);
 
-    let span = tcx.map.span(impl_node_id);
+    let span = tcx.hir.span(impl_node_id);
     let param_env = ParameterEnvironment::for_item(tcx, impl_node_id);
     let self_type = self_type.subst(tcx, &param_env.free_substs);
     assert!(!self_type.has_escaping_regions());
@@ -124,7 +124,7 @@ fn visit_implementation_of_copy<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
     match param_env.can_type_implement_copy(tcx, self_type, span) {
         Ok(()) => {}
         Err(CopyImplementationError::InfrigingField(field)) => {
-            let item = tcx.map.expect_item(impl_node_id);
+            let item = tcx.hir.expect_item(impl_node_id);
             let span = if let ItemImpl(.., Some(ref tr), _, _) = item.node {
                 tr.path.span
             } else {
@@ -141,7 +141,7 @@ fn visit_implementation_of_copy<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
                 .emit()
         }
         Err(CopyImplementationError::NotAnAdt) => {
-            let item = tcx.map.expect_item(impl_node_id);
+            let item = tcx.hir.expect_item(impl_node_id);
             let span = if let ItemImpl(.., ref ty, _) = item.node {
                 ty.span
             } else {
@@ -180,7 +180,7 @@ fn visit_implementation_of_coerce_unsized<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
         }
     };
 
-    let impl_node_id = if let Some(n) = tcx.map.as_local_node_id(impl_did) {
+    let impl_node_id = if let Some(n) = tcx.hir.as_local_node_id(impl_did) {
         n
     } else {
         debug!("visit_implementation_of_coerce_unsized(): impl not \
@@ -195,7 +195,7 @@ fn visit_implementation_of_coerce_unsized<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
            source,
            target);
 
-    let span = tcx.map.span(impl_node_id);
+    let span = tcx.hir.span(impl_node_id);
     let param_env = ParameterEnvironment::for_item(tcx, impl_node_id);
     let source = source.subst(tcx, &param_env.free_substs);
     let target = target.subst(tcx, &param_env.free_substs);
@@ -281,11 +281,11 @@ fn visit_implementation_of_coerce_unsized<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
                                being coerced, none found");
                     return;
                 } else if diff_fields.len() > 1 {
-                    let item = tcx.map.expect_item(impl_node_id);
+                    let item = tcx.hir.expect_item(impl_node_id);
                     let span = if let ItemImpl(.., Some(ref t), _, _) = item.node {
                         t.path.span
                     } else {
-                        tcx.map.span(impl_node_id)
+                        tcx.hir.span(impl_node_id)
                     };
 
                     let mut err = struct_span_err!(tcx.sess,
index 6cf752dd69fcadea7d82f05ab89999e0c817c87a..5af9ea29fafa76e49cffc8c400515c254585b8d0 100644 (file)
@@ -86,7 +86,7 @@ fn check(&mut self) {
 
     fn check_implementation(&self, item: &Item) {
         let tcx = self.tcx;
-        let impl_did = tcx.map.local_def_id(item.id);
+        let impl_did = tcx.hir.local_def_id(item.id);
         let self_type = tcx.item_type(impl_did);
 
         // If there are no traits, then this implementation must have a
index 2b5a4515cd0d8d63c576253a3f3e9ad57e87d10d..c3417ab08d7fad3642f99f65e63c8016a7253f97 100644 (file)
@@ -76,13 +76,13 @@ impl<'cx, 'tcx, 'v> ItemLikeVisitor<'v> for OrphanChecker<'cx, 'tcx> {
     /// to prevent inundating the user with a bunch of similar error
     /// reports.
     fn visit_item(&mut self, item: &hir::Item) {
-        let def_id = self.tcx.map.local_def_id(item.id);
+        let def_id = self.tcx.hir.local_def_id(item.id);
         match item.node {
             hir::ItemImpl(.., None, ref ty, _) => {
                 // For inherent impls, self type must be a nominal type
                 // defined in this crate.
                 debug!("coherence2::orphan check: inherent impl {}",
-                       self.tcx.map.node_to_string(item.id));
+                       self.tcx.hir.node_to_string(item.id));
                 let self_ty = self.tcx.item_type(def_id);
                 match self_ty.sty {
                     ty::TyAdt(def, _) => {
@@ -249,7 +249,7 @@ fn visit_item(&mut self, item: &hir::Item) {
             hir::ItemImpl(.., Some(_), _, _) => {
                 // "Trait" impl
                 debug!("coherence2::orphan check: trait impl {}",
-                       self.tcx.map.node_to_string(item.id));
+                       self.tcx.hir.node_to_string(item.id));
                 let trait_ref = self.tcx.impl_trait_ref(def_id).unwrap();
                 let trait_def_id = trait_ref.def_id;
                 match traits::orphan_check(self.tcx, def_id) {
@@ -374,7 +374,7 @@ fn visit_item(&mut self, item: &hir::Item) {
             hir::ItemDefaultImpl(_, ref item_trait_ref) => {
                 // "Trait" impl
                 debug!("coherence2::orphan check: default trait impl {}",
-                       self.tcx.map.node_to_string(item.id));
+                       self.tcx.hir.node_to_string(item.id));
                 let trait_ref = self.tcx.impl_trait_ref(def_id).unwrap();
                 if trait_ref.def_id.krate != LOCAL_CRATE {
                     struct_span_err!(self.tcx.sess,
@@ -384,7 +384,7 @@ fn visit_item(&mut self, item: &hir::Item) {
                                       the crate they're defined in; define a new trait instead")
                         .span_label(item_trait_ref.path.span,
                                     &format!("`{}` trait not defined in this crate",
-                            self.tcx.map.node_to_pretty_string(item_trait_ref.ref_id)))
+                            self.tcx.hir.node_to_pretty_string(item_trait_ref.ref_id)))
                         .emit();
                     return;
                 }
index 7890ae20ec26cf603475dd0d395591123279b2c5..56c17dc2f6efda144dbb9e2be510ab19648c57db 100644 (file)
@@ -66,7 +66,7 @@ enum Namespace {
             for &item2 in &impl_items2[..] {
                 if (name, namespace) == name_and_namespace(item2) {
                     let msg = format!("duplicate definitions with name `{}`", name);
-                    let node_id = self.tcx.map.as_local_node_id(item1).unwrap();
+                    let node_id = self.tcx.hir.as_local_node_id(item1).unwrap();
                     self.tcx.sess.add_lint(lint::builtin::OVERLAPPING_INHERENT_IMPLS,
                                            node_id,
                                            self.tcx.span_of_impl(item1).unwrap(),
@@ -104,7 +104,7 @@ fn visit_item(&mut self, item: &'v hir::Item) {
             hir::ItemStruct(..) |
             hir::ItemTrait(..) |
             hir::ItemUnion(..) => {
-                let type_def_id = self.tcx.map.local_def_id(item.id);
+                let type_def_id = self.tcx.hir.local_def_id(item.id);
                 self.check_for_overlapping_inherent_impls(type_def_id);
             }
 
@@ -112,7 +112,7 @@ fn visit_item(&mut self, item: &'v hir::Item) {
                 // look for another default impl; note that due to the
                 // general orphan/coherence rules, it must always be
                 // in this crate.
-                let impl_def_id = self.tcx.map.local_def_id(item.id);
+                let impl_def_id = self.tcx.hir.local_def_id(item.id);
                 let trait_ref = self.tcx.impl_trait_ref(impl_def_id).unwrap();
 
                 let prev_default_impl = self.default_impls.insert(trait_ref.def_id, item.id);
@@ -124,14 +124,14 @@ fn visit_item(&mut self, item: &'v hir::Item) {
                                                     `{}`:",
                                                    trait_ref);
                     err.span_note(self.tcx
-                                      .span_of_impl(self.tcx.map.local_def_id(prev_id))
+                                      .span_of_impl(self.tcx.hir.local_def_id(prev_id))
                                       .unwrap(),
                                   "redundant implementation is here:");
                     err.emit();
                 }
             }
             hir::ItemImpl(.., Some(_), _, _) => {
-                let impl_def_id = self.tcx.map.local_def_id(item.id);
+                let impl_def_id = self.tcx.hir.local_def_id(item.id);
                 let trait_ref = self.tcx.impl_trait_ref(impl_def_id).unwrap();
                 let trait_def_id = trait_ref.def_id;
 
index c4c7c699f65f62ba5c8a74524587d35e9de8e51d..8c98e2952ebe9ce155696b2779fe49535486c3bb 100644 (file)
@@ -17,7 +17,7 @@
 
 pub fn check<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
     let mut unsafety = UnsafetyChecker { tcx: tcx };
-    tcx.map.krate().visit_all_item_likes(&mut unsafety);
+    tcx.hir.krate().visit_all_item_likes(&mut unsafety);
 }
 
 struct UnsafetyChecker<'cx, 'tcx: 'cx> {
@@ -30,7 +30,7 @@ fn check_unsafety_coherence(&mut self,
                                 impl_generics: Option<&hir::Generics>,
                                 unsafety: hir::Unsafety,
                                 polarity: hir::ImplPolarity) {
-        match self.tcx.impl_trait_ref(self.tcx.map.local_def_id(item.id)) {
+        match self.tcx.impl_trait_ref(self.tcx.hir.local_def_id(item.id)) {
             None => {
                 // Inherent impl.
                 match unsafety {
index d403ac43435319b9e47ffe3a0e3afb68dd66fa67..841b4516a18f31720f3dd603b10c1d50f241e338 100644 (file)
@@ -169,9 +169,9 @@ impl<'a, 'tcx> CollectItemTypesVisitor<'a, 'tcx> {
     fn with_collect_item_sig<OP>(&self, id: ast::NodeId, op: OP)
         where OP: FnOnce()
     {
-        let def_id = self.ccx.tcx.map.local_def_id(id);
+        let def_id = self.ccx.tcx.hir.local_def_id(id);
         self.ccx.tcx.dep_graph.with_task(DepNode::CollectItemSig(def_id), || {
-            self.ccx.tcx.map.read(id);
+            self.ccx.tcx.hir.read(id);
             op();
         });
     }
@@ -179,7 +179,7 @@ fn with_collect_item_sig<OP>(&self, id: ast::NodeId, op: OP)
 
 impl<'a, 'tcx> Visitor<'tcx> for CollectItemTypesVisitor<'a, 'tcx> {
     fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
-        NestedVisitorMap::OnlyBodies(&self.ccx.tcx.map)
+        NestedVisitorMap::OnlyBodies(&self.ccx.tcx.hir)
     }
 
     fn visit_item(&mut self, item: &'tcx hir::Item) {
@@ -189,7 +189,7 @@ fn visit_item(&mut self, item: &'tcx hir::Item) {
 
     fn visit_expr(&mut self, expr: &'tcx hir::Expr) {
         if let hir::ExprClosure(..) = expr.node {
-            let def_id = self.ccx.tcx.map.local_def_id(expr.id);
+            let def_id = self.ccx.tcx.hir.local_def_id(expr.id);
             generics_of_def_id(self.ccx, def_id);
             type_of_def_id(self.ccx, def_id);
         }
@@ -198,7 +198,7 @@ fn visit_expr(&mut self, expr: &'tcx hir::Expr) {
 
     fn visit_ty(&mut self, ty: &'tcx hir::Ty) {
         if let hir::TyImplTrait(..) = ty.node {
-            let def_id = self.ccx.tcx.map.local_def_id(ty.id);
+            let def_id = self.ccx.tcx.hir.local_def_id(ty.id);
             generics_of_def_id(self.ccx, def_id);
         }
         intravisit::walk_ty(self, ty);
@@ -341,8 +341,8 @@ fn get_trait_def(&self, def_id: DefId)
     {
         let tcx = self.tcx;
 
-        if let Some(trait_id) = tcx.map.as_local_node_id(def_id) {
-            let item = match tcx.map.get(trait_id) {
+        if let Some(trait_id) = tcx.hir.as_local_node_id(def_id) {
+            let item = match tcx.hir.get(trait_id) {
                 hir_map::NodeItem(item) => item,
                 _ => bug!("get_trait_def({:?}): not an item", trait_id)
             };
@@ -611,7 +611,7 @@ fn is_param<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
         match path.def {
             Def::SelfTy(Some(def_id), None) |
             Def::TyParam(def_id) => {
-                def_id == tcx.map.local_def_id(param_id)
+                def_id == tcx.hir.local_def_id(param_id)
             }
             _ => false
         }
@@ -629,7 +629,7 @@ fn convert_field<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
     let tt = ccx.icx(struct_predicates).to_ty(&ExplicitRscope, &field.ty);
     ccx.tcx.item_types.borrow_mut().insert(ty_f.did, tt);
 
-    let def_id = ccx.tcx.map.local_def_id(field.id);
+    let def_id = ccx.tcx.hir.local_def_id(field.id);
     ccx.tcx.item_types.borrow_mut().insert(def_id, tt);
     ccx.tcx.generics.borrow_mut().insert(def_id, struct_generics);
     ccx.tcx.predicates.borrow_mut().insert(def_id, struct_predicates.clone());
@@ -642,7 +642,7 @@ fn convert_method<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
                             untransformed_rcvr_ty: Ty<'tcx>,
                             body: Option<hir::BodyId>,
                             rcvr_ty_predicates: &ty::GenericPredicates<'tcx>,) {
-    let def_id = ccx.tcx.map.local_def_id(id);
+    let def_id = ccx.tcx.hir.local_def_id(id);
     let ty_generics = generics_of_def_id(ccx, def_id);
 
     let ty_generic_predicates =
@@ -662,7 +662,7 @@ fn convert_method<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
                                     sig, self_value_ty, body, anon_scope);
 
     let substs = mk_item_substs(&ccx.icx(&(rcvr_ty_predicates, &sig.generics)),
-                                ccx.tcx.map.span(id), def_id);
+                                ccx.tcx.hir.span(id), def_id);
     let fty = ccx.tcx.mk_fn_def(def_id, substs, fty);
     ccx.tcx.item_types.borrow_mut().insert(def_id, fty);
     ccx.tcx.predicates.borrow_mut().insert(def_id, ty_generic_predicates);
@@ -677,7 +677,7 @@ fn convert_associated_const<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
         parent: Some(container.id()),
         predicates: vec![]
     };
-    let def_id = ccx.tcx.map.local_def_id(id);
+    let def_id = ccx.tcx.hir.local_def_id(id);
     ccx.tcx.predicates.borrow_mut().insert(def_id, predicates);
     ccx.tcx.item_types.borrow_mut().insert(def_id, ty);
 }
@@ -691,7 +691,7 @@ fn convert_associated_type<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
         parent: Some(container.id()),
         predicates: vec![]
     };
-    let def_id = ccx.tcx.map.local_def_id(id);
+    let def_id = ccx.tcx.hir.local_def_id(id);
     ccx.tcx.predicates.borrow_mut().insert(def_id, predicates);
 
     if let Some(ty) = ty {
@@ -741,7 +741,7 @@ fn ensure_no_ty_param_bounds(ccx: &CrateCtxt,
 fn convert_item(ccx: &CrateCtxt, it: &hir::Item) {
     let tcx = ccx.tcx;
     debug!("convert: item {} with id {}", it.name, it.id);
-    let def_id = ccx.tcx.map.local_def_id(it.id);
+    let def_id = ccx.tcx.hir.local_def_id(it.id);
     match it.node {
         // These don't define types.
         hir::ItemExternCrate(_) | hir::ItemUse(..) | hir::ItemMod(_) => {
@@ -756,7 +756,7 @@ fn convert_item(ccx: &CrateCtxt, it: &hir::Item) {
             let generics = generics_of_def_id(ccx, def_id);
             let predicates = predicates_of_item(ccx, it);
             convert_enum_variant_types(ccx,
-                                       tcx.lookup_adt_def(ccx.tcx.map.local_def_id(it.id)),
+                                       tcx.lookup_adt_def(ccx.tcx.hir.local_def_id(it.id)),
                                        ty,
                                        generics,
                                        predicates,
@@ -771,7 +771,7 @@ fn convert_item(ccx: &CrateCtxt, it: &hir::Item) {
 
             tcx.record_trait_has_default_impl(trait_ref.def_id);
 
-            tcx.impl_trait_refs.borrow_mut().insert(ccx.tcx.map.local_def_id(it.id),
+            tcx.impl_trait_refs.borrow_mut().insert(ccx.tcx.hir.local_def_id(it.id),
                                                     Some(trait_ref));
         }
         hir::ItemImpl(..,
@@ -851,12 +851,12 @@ fn convert_trait_item(ccx: &CrateCtxt, trait_item: &hir::TraitItem) {
 
     // we can lookup details about the trait because items are visited
     // before trait-items
-    let trait_def_id = tcx.map.get_parent_did(trait_item.id);
+    let trait_def_id = tcx.hir.get_parent_did(trait_item.id);
     let trait_predicates = tcx.item_predicates(trait_def_id);
 
     match trait_item.node {
         hir::TraitItemKind::Const(ref ty, _) => {
-            let const_def_id = ccx.tcx.map.local_def_id(trait_item.id);
+            let const_def_id = ccx.tcx.hir.local_def_id(trait_item.id);
             generics_of_def_id(ccx, const_def_id);
             let ty = ccx.icx(&trait_predicates)
                         .to_ty(&ExplicitRscope, &ty);
@@ -866,7 +866,7 @@ fn convert_trait_item(ccx: &CrateCtxt, trait_item: &hir::TraitItem) {
         }
 
         hir::TraitItemKind::Type(_, ref opt_ty) => {
-            let type_def_id = ccx.tcx.map.local_def_id(trait_item.id);
+            let type_def_id = ccx.tcx.hir.local_def_id(trait_item.id);
             generics_of_def_id(ccx, type_def_id);
 
             let typ = opt_ty.as_ref().map({
@@ -893,14 +893,14 @@ fn convert_impl_item(ccx: &CrateCtxt, impl_item: &hir::ImplItem) {
 
     // we can lookup details about the impl because items are visited
     // before impl-items
-    let impl_def_id = tcx.map.get_parent_did(impl_item.id);
+    let impl_def_id = tcx.hir.get_parent_did(impl_item.id);
     let impl_predicates = tcx.item_predicates(impl_def_id);
     let impl_trait_ref = tcx.impl_trait_ref(impl_def_id);
     let impl_self_ty = tcx.item_type(impl_def_id);
 
     match impl_item.node {
         hir::ImplItemKind::Const(ref ty, _) => {
-            let const_def_id = ccx.tcx.map.local_def_id(impl_item.id);
+            let const_def_id = ccx.tcx.hir.local_def_id(impl_item.id);
             generics_of_def_id(ccx, const_def_id);
             let ty = ccx.icx(&impl_predicates)
                         .to_ty(&ExplicitRscope, &ty);
@@ -910,7 +910,7 @@ fn convert_impl_item(ccx: &CrateCtxt, impl_item: &hir::ImplItem) {
         }
 
         hir::ImplItemKind::Type(ref ty) => {
-            let type_def_id = ccx.tcx.map.local_def_id(impl_item.id);
+            let type_def_id = ccx.tcx.hir.local_def_id(impl_item.id);
             generics_of_def_id(ccx, type_def_id);
 
             if impl_trait_ref.is_none() {
@@ -937,13 +937,13 @@ fn convert_variant_ctor<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
                                   ty: Ty<'tcx>,
                                   predicates: ty::GenericPredicates<'tcx>) {
     let tcx = ccx.tcx;
-    let def_id = tcx.map.local_def_id(ctor_id);
+    let def_id = tcx.hir.local_def_id(ctor_id);
     generics_of_def_id(ccx, def_id);
     let ctor_ty = match variant.ctor_kind {
         CtorKind::Fictive | CtorKind::Const => ty,
         CtorKind::Fn => {
             let inputs = variant.fields.iter().map(|field| tcx.item_type(field.did));
-            let substs = mk_item_substs(&ccx.icx(&predicates), ccx.tcx.map.span(ctor_id), def_id);
+            let substs = mk_item_substs(&ccx.icx(&predicates), ccx.tcx.hir.span(ctor_id), def_id);
             tcx.mk_fn_def(def_id, substs, tcx.mk_bare_fn(ty::BareFnTy {
                 unsafety: hir::Unsafety::Normal,
                 abi: abi::Abi::Rust,
@@ -952,7 +952,7 @@ fn convert_variant_ctor<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
         }
     };
     tcx.item_types.borrow_mut().insert(def_id, ctor_ty);
-    tcx.predicates.borrow_mut().insert(tcx.map.local_def_id(ctor_id), predicates);
+    tcx.predicates.borrow_mut().insert(tcx.hir.local_def_id(ctor_id), predicates);
 }
 
 fn convert_enum_variant_types<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
@@ -986,9 +986,9 @@ fn convert_struct_variant<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
                                     def: &hir::VariantData)
                                     -> ty::VariantDef {
     let mut seen_fields: FxHashMap<ast::Name, Span> = FxHashMap();
-    let node_id = ccx.tcx.map.as_local_node_id(did).unwrap();
+    let node_id = ccx.tcx.hir.as_local_node_id(did).unwrap();
     let fields = def.fields().iter().map(|f| {
-        let fid = ccx.tcx.map.local_def_id(f.id);
+        let fid = ccx.tcx.hir.local_def_id(f.id);
         let dup_span = seen_fields.get(&f.name).cloned();
         if let Some(prev_span) = dup_span {
             struct_span_err!(ccx.tcx.sess, f.span, E0124,
@@ -1021,9 +1021,9 @@ fn convert_struct_def<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
                                 def: &hir::VariantData)
                                 -> &'tcx ty::AdtDef
 {
-    let did = ccx.tcx.map.local_def_id(it.id);
+    let did = ccx.tcx.hir.local_def_id(it.id);
     // Use separate constructor id for unit/tuple structs and reuse did for braced structs.
-    let ctor_id = if !def.is_struct() { Some(ccx.tcx.map.local_def_id(def.id())) } else { None };
+    let ctor_id = if !def.is_struct() { Some(ccx.tcx.hir.local_def_id(def.id())) } else { None };
     let variants = vec![convert_struct_variant(ccx, ctor_id.unwrap_or(did), it.name,
                                                ConstInt::Infer(0), def)];
     let adt = ccx.tcx.alloc_adt_def(did, AdtKind::Struct, variants);
@@ -1041,7 +1041,7 @@ fn convert_union_def<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
                                 def: &hir::VariantData)
                                 -> &'tcx ty::AdtDef
 {
-    let did = ccx.tcx.map.local_def_id(it.id);
+    let did = ccx.tcx.hir.local_def_id(it.id);
     let variants = vec![convert_struct_variant(ccx, did, it.name, ConstInt::Infer(0), def)];
 
     let adt = ccx.tcx.alloc_adt_def(did, AdtKind::Union, variants);
@@ -1051,8 +1051,8 @@ fn convert_union_def<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
 
     fn evaluate_disr_expr(ccx: &CrateCtxt, repr_ty: attr::IntType, body: hir::BodyId)
                           -> Option<ty::Disr> {
-        let e = &ccx.tcx.map.body(body).value;
-        debug!("disr expr, checking {}", ccx.tcx.map.node_to_pretty_string(e.id));
+        let e = &ccx.tcx.hir.body(body).value;
+        debug!("disr expr, checking {}", ccx.tcx.hir.node_to_pretty_string(e.id));
 
         let ty_hint = repr_ty.to_ty(ccx.tcx);
         let print_err = |cv: ConstVal| {
@@ -1106,7 +1106,7 @@ fn convert_enum_def<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
                               -> &'tcx ty::AdtDef
 {
     let tcx = ccx.tcx;
-    let did = tcx.map.local_def_id(it.id);
+    let did = tcx.hir.local_def_id(it.id);
     let repr_hints = tcx.lookup_repr_hints(did);
     let repr_type = tcx.enum_repr_type(repr_hints.get(0));
     let initial = repr_type.initial_discriminant(tcx);
@@ -1128,7 +1128,7 @@ fn convert_enum_def<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
         }.unwrap_or(wrapped_disr);
         prev_disr = Some(disr);
 
-        let did = tcx.map.local_def_id(v.node.data.id());
+        let did = tcx.hir.local_def_id(v.node.data.id());
         convert_struct_variant(ccx, did, v.node.name, disr, &v.node.data)
     }).collect();
 
@@ -1152,7 +1152,7 @@ fn ensure_super_predicates_step(ccx: &CrateCtxt,
 
     debug!("ensure_super_predicates_step(trait_def_id={:?})", trait_def_id);
 
-    let trait_node_id = if let Some(n) = tcx.map.as_local_node_id(trait_def_id) {
+    let trait_node_id = if let Some(n) = tcx.hir.as_local_node_id(trait_def_id) {
         n
     } else {
         // If this trait comes from an external crate, then all of the
@@ -1165,7 +1165,7 @@ fn ensure_super_predicates_step(ccx: &CrateCtxt,
 
     let superpredicates = tcx.super_predicates.borrow().get(&trait_def_id).cloned();
     let superpredicates = superpredicates.unwrap_or_else(|| {
-        let item = match ccx.tcx.map.get(trait_node_id) {
+        let item = match ccx.tcx.hir.get(trait_node_id) {
             hir_map::NodeItem(item) => item,
             _ => bug!("trait_node_id {} is not an item", trait_node_id)
         };
@@ -1213,7 +1213,7 @@ fn ensure_super_predicates_step(ccx: &CrateCtxt,
             predicates: superbounds
         };
         debug!("superpredicates for trait {:?} = {:?}",
-               tcx.map.local_def_id(item.id),
+               tcx.hir.local_def_id(item.id),
                superpredicates);
 
         tcx.super_predicates.borrow_mut().insert(trait_def_id, superpredicates.clone());
@@ -1233,7 +1233,7 @@ fn ensure_super_predicates_step(ccx: &CrateCtxt,
 }
 
 fn trait_def_of_item<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>, it: &hir::Item) -> &'tcx ty::TraitDef {
-    let def_id = ccx.tcx.map.local_def_id(it.id);
+    let def_id = ccx.tcx.hir.local_def_id(it.id);
     let tcx = ccx.tcx;
 
     tcx.trait_defs.memoize(def_id, || {
@@ -1262,7 +1262,7 @@ fn trait_def_of_item<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>, it: &hir::Item) -> &'t
 fn convert_trait_predicates<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>, it: &hir::Item) {
     let tcx = ccx.tcx;
 
-    let def_id = ccx.tcx.map.local_def_id(it.id);
+    let def_id = ccx.tcx.hir.local_def_id(it.id);
 
     generics_of_def_id(ccx, def_id);
     trait_def_of_item(ccx, it);
@@ -1319,7 +1319,7 @@ fn predicates_for_associated_types<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
                                                  -> Vec<ty::Predicate<'tcx>>
     {
         trait_item_refs.iter().flat_map(|trait_item_ref| {
-            let trait_item = ccx.tcx.map.trait_item(trait_item_ref.id);
+            let trait_item = ccx.tcx.hir.trait_item(trait_item_ref.id);
             let bounds = match trait_item.node {
                 hir::TraitItemKind::Type(ref bounds, _) => bounds,
                 _ => {
@@ -1346,7 +1346,7 @@ fn generics_of_def_id<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
                                 def_id: DefId)
                                 -> &'tcx ty::Generics<'tcx> {
     let tcx = ccx.tcx;
-    let node_id = if let Some(id) = tcx.map.as_local_node_id(def_id) {
+    let node_id = if let Some(id) = tcx.hir.as_local_node_id(def_id) {
         id
     } else {
         return tcx.item_generics(def_id);
@@ -1355,14 +1355,14 @@ fn generics_of_def_id<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
         use rustc::hir::map::*;
         use rustc::hir::*;
 
-        let node = tcx.map.get(node_id);
+        let node = tcx.hir.get(node_id);
         let parent_def_id = match node {
             NodeImplItem(_) |
             NodeTraitItem(_) |
             NodeVariant(_) |
             NodeStructCtor(_) => {
-                let parent_id = tcx.map.get_parent(node_id);
-                Some(tcx.map.local_def_id(parent_id))
+                let parent_id = tcx.hir.get_parent(node_id);
+                Some(tcx.hir.local_def_id(parent_id))
             }
             NodeExpr(&hir::Expr { node: hir::ExprClosure(..), .. }) => {
                 Some(tcx.closure_base_def_id(def_id))
@@ -1370,14 +1370,14 @@ fn generics_of_def_id<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
             NodeTy(&hir::Ty { node: hir::TyImplTrait(..), .. }) => {
                 let mut parent_id = node_id;
                 loop {
-                    match tcx.map.get(parent_id) {
+                    match tcx.hir.get(parent_id) {
                         NodeItem(_) | NodeImplItem(_) | NodeTraitItem(_) => break,
                         _ => {
-                            parent_id = tcx.map.get_parent_node(parent_id);
+                            parent_id = tcx.hir.get_parent_node(parent_id);
                         }
                     }
                 }
-                Some(tcx.map.local_def_id(parent_id))
+                Some(tcx.hir.local_def_id(parent_id))
             }
             _ => None
         };
@@ -1421,13 +1421,13 @@ fn generics_of_def_id<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
                         // the node id for the Self type parameter.
                         let param_id = item.id;
 
-                        let parent = ccx.tcx.map.get_parent(param_id);
+                        let parent = ccx.tcx.hir.get_parent(param_id);
 
                         let def = ty::TypeParameterDef {
                             index: 0,
                             name: keywords::SelfType.name(),
-                            def_id: tcx.map.local_def_id(param_id),
-                            default_def_id: tcx.map.local_def_id(parent),
+                            def_id: tcx.hir.local_def_id(param_id),
+                            default_def_id: tcx.hir.local_def_id(parent),
                             default: None,
                             object_lifetime_default: ty::ObjectLifetimeDefault::BaseDefault,
                             pure_wrt_drop: false,
@@ -1470,7 +1470,7 @@ fn generics_of_def_id<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
             ty::RegionParameterDef {
                 name: l.lifetime.name,
                 index: own_start + i as u32,
-                def_id: tcx.map.local_def_id(l.lifetime.id),
+                def_id: tcx.hir.local_def_id(l.lifetime.id),
                 bounds: l.bounds.iter().map(|l| {
                     ast_region_to_region(tcx, l)
                 }).collect(),
@@ -1512,7 +1512,7 @@ fn generics_of_def_id<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
                         d => format!("{:?}", d),
                     }
                 }).collect::<Vec<String>>().join(",");
-            tcx.sess.span_err(tcx.map.span(node_id), &object_lifetime_default_reprs);
+            tcx.sess.span_err(tcx.hir.span(node_id), &object_lifetime_default_reprs);
         }
 
         tcx.alloc_generics(ty::Generics {
@@ -1529,7 +1529,7 @@ fn generics_of_def_id<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
 fn type_of_def_id<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
                             def_id: DefId)
                             -> Ty<'tcx> {
-    let node_id = if let Some(id) = ccx.tcx.map.as_local_node_id(def_id) {
+    let node_id = if let Some(id) = ccx.tcx.hir.as_local_node_id(def_id) {
         id
     } else {
         return ccx.tcx.item_type(def_id);
@@ -1541,7 +1541,7 @@ fn type_of_def_id<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
         // Alway bring in generics, as computing the type needs them.
         generics_of_def_id(ccx, def_id);
 
-        let ty = match ccx.tcx.map.get(node_id) {
+        let ty = match ccx.tcx.hir.get(node_id) {
             NodeItem(item) => {
                 match item.node {
                     ItemStatic(ref t, ..) | ItemConst(ref t, _) => {
@@ -1586,12 +1586,12 @@ fn type_of_def_id<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
                 }
             }
             NodeForeignItem(foreign_item) => {
-                let abi = ccx.tcx.map.get_foreign_abi(node_id);
+                let abi = ccx.tcx.hir.get_foreign_abi(node_id);
 
                 match foreign_item.node {
                     ForeignItemFn(ref fn_decl, _, ref generics) => {
                         compute_type_of_foreign_fn_decl(
-                            ccx, ccx.tcx.map.local_def_id(foreign_item.id),
+                            ccx, ccx.tcx.hir.local_def_id(foreign_item.id),
                             fn_decl, generics, abi)
                     }
                     ForeignItemStatic(ref t, _) => {
@@ -1621,7 +1621,7 @@ fn type_of_def_id<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
 fn predicates_of_item<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
                                 it: &hir::Item)
                                 -> ty::GenericPredicates<'tcx> {
-    let def_id = ccx.tcx.map.local_def_id(it.id);
+    let def_id = ccx.tcx.hir.local_def_id(it.id);
 
     let no_generics = hir::Generics::empty();
     let generics = match it.node {
@@ -1648,7 +1648,7 @@ fn convert_foreign_item<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
     // map, and I regard each time that I use it as a personal and
     // moral failing, but at the moment it seems like the only
     // convenient way to extract the ABI. - ndm
-    let def_id = ccx.tcx.map.local_def_id(it.id);
+    let def_id = ccx.tcx.hir.local_def_id(it.id);
     type_of_def_id(ccx, def_id);
     generics_of_def_id(ccx, def_id);
 
@@ -1868,7 +1868,7 @@ fn get_or_create_type_parameter_def<'a,'tcx>(ccx: &CrateCtxt<'a,'tcx>,
         compute_object_lifetime_default(ccx, param.id,
                                         &param.bounds, &ast_generics.where_clause);
 
-    let parent = tcx.map.get_parent(param.id);
+    let parent = tcx.hir.get_parent(param.id);
 
     if !allow_defaults && default.is_some() {
         if !tcx.sess.features.borrow().default_type_parameter_fallback {
@@ -1884,8 +1884,8 @@ fn get_or_create_type_parameter_def<'a,'tcx>(ccx: &CrateCtxt<'a,'tcx>,
     let def = ty::TypeParameterDef {
         index: index,
         name: param.name,
-        def_id: ccx.tcx.map.local_def_id(param.id),
-        default_def_id: ccx.tcx.map.local_def_id(parent),
+        def_id: ccx.tcx.hir.local_def_id(param.id),
+        default_def_id: ccx.tcx.hir.local_def_id(parent),
         default: default,
         object_lifetime_default: object_lifetime_default,
         pure_wrt_drop: param.pure_wrt_drop,
@@ -2083,7 +2083,7 @@ fn compute_type_of_foreign_fn_decl<'a, 'tcx>(
                 ccx.tcx.sess.struct_span_err(ast_ty.span,
                               &format!("use of SIMD type `{}` in FFI is highly experimental and \
                                         may result in invalid code",
-                                       ccx.tcx.map.node_to_pretty_string(ast_ty.id)))
+                                       ccx.tcx.hir.node_to_pretty_string(ast_ty.id)))
                     .help("add #![feature(simd_ffi)] to the crate attributes to enable")
                     .emit();
             }
@@ -2096,8 +2096,8 @@ fn compute_type_of_foreign_fn_decl<'a, 'tcx>(
         }
     }
 
-    let id = ccx.tcx.map.as_local_node_id(def_id).unwrap();
-    let substs = mk_item_substs(&ccx.icx(ast_generics), ccx.tcx.map.span(id), def_id);
+    let id = ccx.tcx.hir.as_local_node_id(def_id).unwrap();
+    let substs = mk_item_substs(&ccx.icx(ast_generics), ccx.tcx.hir.span(id), def_id);
     ccx.tcx.mk_fn_def(def_id, substs, ccx.tcx.mk_bare_fn(ty::BareFnTy {
         abi: abi,
         unsafety: hir::Unsafety::Unsafe,
index ce495e6fb4cd8a8cc689a4bcdb54e888e5cebf59..3a19b3579d5598b61bf275fc13f2db9b0eafa0f8 100644 (file)
@@ -76,7 +76,7 @@ impl<'a, 'tcx> ItemLikeVisitor<'tcx> for ImplWfCheck<'a, 'tcx> {
     fn visit_item(&mut self, item: &'tcx hir::Item) {
         match item.node {
             hir::ItemImpl(.., ref generics, _, _, ref impl_item_refs) => {
-                let impl_def_id = self.ccx.tcx.map.local_def_id(item.id);
+                let impl_def_id = self.ccx.tcx.hir.local_def_id(item.id);
                 enforce_impl_params_are_constrained(self.ccx,
                                                     generics,
                                                     impl_def_id,
@@ -117,7 +117,7 @@ fn enforce_impl_params_are_constrained<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
 
     // Disallow unconstrained lifetimes, but only if they appear in assoc types.
     let lifetimes_in_associated_types: FxHashSet<_> = impl_item_refs.iter()
-        .map(|item_ref|  ccx.tcx.map.local_def_id(item_ref.id.node_id))
+        .map(|item_ref|  ccx.tcx.hir.local_def_id(item_ref.id.node_id))
         .filter(|&def_id| {
             let item = ccx.tcx.associated_item(def_id);
             item.kind == ty::AssociatedKind::Type && item.defaultness.has_value()
@@ -181,7 +181,7 @@ fn enforce_impl_items_are_distinct<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
     let mut seen_type_items = FxHashMap();
     let mut seen_value_items = FxHashMap();
     for impl_item_ref in impl_item_refs {
-        let impl_item = tcx.map.impl_item(impl_item_ref.id);
+        let impl_item = tcx.hir.impl_item(impl_item_ref.id);
         let seen_items = match impl_item.node {
             hir::ImplItemKind::Type(_) => &mut seen_type_items,
             _                    => &mut seen_value_items,
index 6d30a85b582912a7f108a5908588a88333dc564b..0e7daa03404c5bf18b4bdd113a6cf08961043821 100644 (file)
@@ -196,11 +196,11 @@ fn check_main_fn_ty(ccx: &CrateCtxt,
                     main_id: ast::NodeId,
                     main_span: Span) {
     let tcx = ccx.tcx;
-    let main_def_id = tcx.map.local_def_id(main_id);
+    let main_def_id = tcx.hir.local_def_id(main_id);
     let main_t = tcx.item_type(main_def_id);
     match main_t.sty {
         ty::TyFnDef(..) => {
-            match tcx.map.find(main_id) {
+            match tcx.hir.find(main_id) {
                 Some(hir_map::NodeItem(it)) => {
                     match it.node {
                         hir::ItemFn(.., ref generics, _) => {
@@ -244,11 +244,11 @@ fn check_start_fn_ty(ccx: &CrateCtxt,
                      start_id: ast::NodeId,
                      start_span: Span) {
     let tcx = ccx.tcx;
-    let start_def_id = ccx.tcx.map.local_def_id(start_id);
+    let start_def_id = ccx.tcx.hir.local_def_id(start_id);
     let start_t = tcx.item_type(start_def_id);
     match start_t.sty {
         ty::TyFnDef(..) => {
-            match tcx.map.find(start_id) {
+            match tcx.hir.find(start_id) {
                 Some(hir_map::NodeItem(it)) => {
                     match it.node {
                         hir::ItemFn(..,ref ps,_)
index 507079a4f874cd93e017458416e75fd1c644695b..55033330a449055a4d0cf9903cb4bd64be45bb2a 100644 (file)
@@ -74,9 +74,9 @@ pub fn add_constraints_from_crate<'a, 'tcx>(terms_cx: TermsContext<'a, 'tcx>)
 impl<'a, 'tcx, 'v> ItemLikeVisitor<'v> for ConstraintContext<'a, 'tcx> {
     fn visit_item(&mut self, item: &hir::Item) {
         let tcx = self.terms_cx.tcx;
-        let did = tcx.map.local_def_id(item.id);
+        let did = tcx.hir.local_def_id(item.id);
 
-        debug!("visit_item item={}", tcx.map.node_to_string(item.id));
+        debug!("visit_item item={}", tcx.hir.node_to_string(item.id));
 
         match item.node {
             hir::ItemEnum(..) |
@@ -145,14 +145,14 @@ fn inferred_index(&self, param_id: ast::NodeId) -> InferredIndex {
             Some(&index) => index,
             None => {
                 bug!("no inferred index entry for {}",
-                     self.tcx().map.node_to_string(param_id));
+                     self.tcx().hir.node_to_string(param_id));
             }
         }
     }
 
     fn find_binding_for_lifetime(&self, param_id: ast::NodeId) -> ast::NodeId {
         let tcx = self.terms_cx.tcx;
-        assert!(is_lifetime(&tcx.map, param_id));
+        assert!(is_lifetime(&tcx.hir, param_id));
         match tcx.named_region_map.defs.get(&param_id) {
             Some(&rl::DefEarlyBoundRegion(_, lifetime_decl_id)) => lifetime_decl_id,
             Some(_) => bug!("should not encounter non early-bound cases"),
@@ -177,17 +177,17 @@ fn is_to_be_inferred(&self, param_id: ast::NodeId) -> bool {
             let tcx = this.terms_cx.tcx;
             let decl_id = this.find_binding_for_lifetime(param_id);
             // Currently only called on lifetimes; double-checking that.
-            assert!(is_lifetime(&tcx.map, param_id));
-            let parent_id = tcx.map.get_parent(decl_id);
-            let parent = tcx.map
+            assert!(is_lifetime(&tcx.hir, param_id));
+            let parent_id = tcx.hir.get_parent(decl_id);
+            let parent = tcx.hir
                 .find(parent_id)
-                .unwrap_or_else(|| bug!("tcx.map missing entry for id: {}", parent_id));
+                .unwrap_or_else(|| bug!("tcx.hir missing entry for id: {}", parent_id));
 
             let is_inferred;
             macro_rules! cannot_happen { () => { {
                 bug!("invalid parent: {} for {}",
-                     tcx.map.node_to_string(parent_id),
-                     tcx.map.node_to_string(param_id));
+                     tcx.hir.node_to_string(parent_id),
+                     tcx.hir.node_to_string(param_id));
             } } }
 
             match parent {
@@ -224,7 +224,7 @@ fn declared_variance(&self,
                          -> VarianceTermPtr<'a> {
         assert_eq!(param_def_id.krate, item_def_id.krate);
 
-        if let Some(param_node_id) = self.tcx().map.as_local_node_id(param_def_id) {
+        if let Some(param_node_id) = self.tcx().hir.as_local_node_id(param_def_id) {
             // Parameter on an item defined within current crate:
             // variance not yet inferred, so return a symbolic
             // variance.
@@ -400,7 +400,7 @@ fn add_constraints_from_ty(&mut self,
                     i -= generics.regions.len();
                 }
                 let def_id = generics.types[i].def_id;
-                let node_id = self.tcx().map.as_local_node_id(def_id).unwrap();
+                let node_id = self.tcx().hir.as_local_node_id(def_id).unwrap();
                 match self.terms_cx.inferred_map.get(&node_id) {
                     Some(&index) => {
                         self.add_constraint(index, variance);
@@ -487,7 +487,7 @@ fn add_constraints_from_region(&mut self,
                 assert_eq!(generics.parent, None);
                 let i = data.index as usize - generics.has_self as usize;
                 let def_id = generics.regions[i].def_id;
-                let node_id = self.tcx().map.as_local_node_id(def_id).unwrap();
+                let node_id = self.tcx().hir.as_local_node_id(def_id).unwrap();
                 if self.is_to_be_inferred(node_id) {
                     let index = self.inferred_index(node_id);
                     self.add_constraint(index, variance);
index a5c53b4c6291ce9469df680e114f7f2d5bd569c6..bdf1d0590bcc7bf48a72db776abfa4ad7003fccb 100644 (file)
@@ -125,13 +125,13 @@ fn write(&self) {
 
             debug!("item_id={} item_variances={:?}", item_id, item_variances);
 
-            let item_def_id = tcx.map.local_def_id(item_id);
+            let item_def_id = tcx.hir.local_def_id(item_id);
 
             // For unit testing: check for a special "rustc_variance"
             // attribute and report an error with various results if found.
             if tcx.has_attr(item_def_id, "rustc_variance") {
                 span_err!(tcx.sess,
-                          tcx.map.span(item_id),
+                          tcx.hir.span(item_id),
                           E0208,
                           "{:?}",
                           item_variances);
index d4d3edbcb126e8732f82b03d5ef4e1718a2a758f..0e09d34cc9bd3774c0c0ee13936cc266ce66c483 100644 (file)
@@ -132,7 +132,7 @@ fn lang_items(tcx: TyCtxt) -> Vec<(ast::NodeId, Vec<ty::Variance>)> {
     all.into_iter() // iterating over (Option<DefId>, Variance)
        .filter(|&(ref d,_)| d.is_some())
        .map(|(d, v)| (d.unwrap(), v)) // (DefId, Variance)
-       .filter_map(|(d, v)| tcx.map.as_local_node_id(d).map(|n| (n, v))) // (NodeId, Variance)
+       .filter_map(|(d, v)| tcx.hir.as_local_node_id(d).map(|n| (n, v))) // (NodeId, Variance)
        .collect()
 }
 
@@ -177,7 +177,7 @@ fn add_inferreds_for_item(&mut self,
         // "invalid item id" from "item id with no
         // parameters".
         if self.num_inferred() == inferreds_on_entry {
-            let item_def_id = self.tcx.map.local_def_id(item_id);
+            let item_def_id = self.tcx.hir.local_def_id(item_id);
             let newly_added = self.tcx
                 .item_variance_map
                 .borrow_mut()
@@ -207,7 +207,7 @@ fn add_inferred(&mut self, item_id: ast::NodeId, index: usize, param_id: ast::No
                 param_id={}, \
                 inf_index={:?}, \
                 initial_variance={:?})",
-               self.tcx.item_path_str(self.tcx.map.local_def_id(item_id)),
+               self.tcx.item_path_str(self.tcx.hir.local_def_id(item_id)),
                item_id,
                index,
                param_id,
@@ -230,7 +230,7 @@ pub fn num_inferred(&self) -> usize {
 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.map.node_to_string(item.id));
+               self.tcx.hir.node_to_string(item.id));
 
         match item.node {
             hir::ItemEnum(_, ref generics) |
index a77485477b1591330dec2162217592e8ccadb12e..eedca0ffb63270ae1d380de3a361c80f71159aed 100644 (file)
@@ -223,17 +223,17 @@ fn clean(&self, cx: &DocContext) -> ExternalCrate {
             None
         };
         let primitives = if root.is_local() {
-            cx.tcx.map.krate().module.item_ids.iter().filter_map(|&id| {
-                let item = cx.tcx.map.expect_item(id.id);
+            cx.tcx.hir.krate().module.item_ids.iter().filter_map(|&id| {
+                let item = cx.tcx.hir.expect_item(id.id);
                 match item.node {
                     hir::ItemMod(_) => {
-                        as_primitive(Def::Mod(cx.tcx.map.local_def_id(id.id)))
+                        as_primitive(Def::Mod(cx.tcx.hir.local_def_id(id.id)))
                     }
                     hir::ItemUse(ref path, hir::UseKind::Single)
                     if item.vis == hir::Visibility::Public => {
                         as_primitive(path.def).map(|(_, prim, attrs)| {
                             // Pretend the primitive is local.
-                            (cx.tcx.map.local_def_id(id.id), prim, attrs)
+                            (cx.tcx.hir.local_def_id(id.id), prim, attrs)
                         })
                     }
                     _ => None
@@ -454,7 +454,7 @@ fn clean(&self, cx: &DocContext) -> Item {
             visibility: self.vis.clean(cx),
             stability: self.stab.clean(cx),
             deprecation: self.depr.clean(cx),
-            def_id: cx.tcx.map.local_def_id(self.id),
+            def_id: cx.tcx.hir.local_def_id(self.id),
             inner: ModuleItem(Module {
                is_crate: self.is_crate,
                items: items
@@ -576,7 +576,7 @@ impl Clean<TyParam> for hir::TyParam {
     fn clean(&self, cx: &DocContext) -> TyParam {
         TyParam {
             name: self.name.clean(cx),
-            did: cx.tcx.map.local_def_id(self.id),
+            did: cx.tcx.hir.local_def_id(self.id),
             bounds: self.bounds.clean(cx),
             default: self.default.clean(cx),
         }
@@ -1067,7 +1067,7 @@ fn clean(&self, cx: &DocContext) -> Item {
             visibility: self.vis.clean(cx),
             stability: self.stab.clean(cx),
             deprecation: self.depr.clean(cx),
-            def_id: cx.tcx.map.local_def_id(self.id),
+            def_id: cx.tcx.hir.local_def_id(self.id),
             inner: FunctionItem(Function {
                 decl: (&self.decl, self.body).clean(cx),
                 generics: self.generics.clean(cx),
@@ -1122,7 +1122,7 @@ fn clean(&self, cx: &DocContext) -> Arguments {
 
 impl<'a> Clean<Arguments> for (&'a [P<hir::Ty>], hir::BodyId) {
     fn clean(&self, cx: &DocContext) -> Arguments {
-        let body = cx.tcx.map.body(self.1);
+        let body = cx.tcx.hir.body(self.1);
 
         Arguments {
             values: self.0.iter().enumerate().map(|(i, ty)| {
@@ -1151,7 +1151,7 @@ fn clean(&self, cx: &DocContext) -> FnDecl {
 impl<'a, 'tcx> Clean<FnDecl> for (DefId, &'a ty::PolyFnSig<'tcx>) {
     fn clean(&self, cx: &DocContext) -> FnDecl {
         let (did, sig) = *self;
-        let mut names = if cx.tcx.map.as_local_node_id(did).is_some() {
+        let mut names = if cx.tcx.hir.as_local_node_id(did).is_some() {
             vec![].into_iter()
         } else {
             cx.tcx.sess.cstore.fn_arg_names(did).into_iter()
@@ -1231,7 +1231,7 @@ fn clean(&self, cx: &DocContext) -> Item {
             name: Some(self.name.clean(cx)),
             attrs: self.attrs.clean(cx),
             source: self.whence.clean(cx),
-            def_id: cx.tcx.map.local_def_id(self.id),
+            def_id: cx.tcx.hir.local_def_id(self.id),
             visibility: self.vis.clean(cx),
             stability: self.stab.clean(cx),
             deprecation: self.depr.clean(cx),
@@ -1286,10 +1286,10 @@ fn clean(&self, cx: &DocContext) -> Item {
             name: Some(self.name.clean(cx)),
             attrs: self.attrs.clean(cx),
             source: self.span.clean(cx),
-            def_id: cx.tcx.map.local_def_id(self.id),
+            def_id: cx.tcx.hir.local_def_id(self.id),
             visibility: None,
-            stability: get_stability(cx, cx.tcx.map.local_def_id(self.id)),
-            deprecation: get_deprecation(cx, cx.tcx.map.local_def_id(self.id)),
+            stability: get_stability(cx, cx.tcx.hir.local_def_id(self.id)),
+            deprecation: get_deprecation(cx, cx.tcx.hir.local_def_id(self.id)),
             inner: inner
         }
     }
@@ -1318,10 +1318,10 @@ fn clean(&self, cx: &DocContext) -> Item {
             name: Some(self.name.clean(cx)),
             source: self.span.clean(cx),
             attrs: self.attrs.clean(cx),
-            def_id: cx.tcx.map.local_def_id(self.id),
+            def_id: cx.tcx.hir.local_def_id(self.id),
             visibility: self.vis.clean(cx),
-            stability: get_stability(cx, cx.tcx.map.local_def_id(self.id)),
-            deprecation: get_deprecation(cx, cx.tcx.map.local_def_id(self.id)),
+            stability: get_stability(cx, cx.tcx.hir.local_def_id(self.id)),
+            deprecation: get_deprecation(cx, cx.tcx.hir.local_def_id(self.id)),
             inner: inner
         }
     }
@@ -1703,9 +1703,9 @@ fn clean(&self, cx: &DocContext) -> Type {
                 let mut alias = None;
                 if let Def::TyAlias(def_id) = path.def {
                     // Substitute private type aliases
-                    if let Some(node_id) = cx.tcx.map.as_local_node_id(def_id) {
+                    if let Some(node_id) = cx.tcx.hir.as_local_node_id(def_id) {
                         if !cx.access_levels.borrow().is_exported(def_id) {
-                            alias = Some(&cx.tcx.map.expect_item(node_id).node);
+                            alias = Some(&cx.tcx.hir.expect_item(node_id).node);
                         }
                     }
                 };
@@ -1715,7 +1715,7 @@ fn clean(&self, cx: &DocContext) -> Type {
                     let mut ty_substs = FxHashMap();
                     let mut lt_substs = FxHashMap();
                     for (i, ty_param) in generics.ty_params.iter().enumerate() {
-                        let ty_param_def = Def::TyParam(cx.tcx.map.local_def_id(ty_param.id));
+                        let ty_param_def = Def::TyParam(cx.tcx.hir.local_def_id(ty_param.id));
                         if let Some(ty) = provided_params.types().get(i).cloned()
                                                                         .cloned() {
                             ty_substs.insert(ty_param_def, ty.unwrap().clean(cx));
@@ -1823,7 +1823,7 @@ fn clean(&self, cx: &DocContext) -> Type {
                     type_params: Vec::new(),
                     where_predicates: Vec::new()
                 },
-                decl: (cx.tcx.map.local_def_id(ast::CRATE_NODE_ID), &fty.sig).clean(cx),
+                decl: (cx.tcx.hir.local_def_id(ast::CRATE_NODE_ID), &fty.sig).clean(cx),
                 abi: fty.abi,
             }),
             ty::TyAdt(def, substs) => {
@@ -1919,9 +1919,9 @@ fn clean(&self, cx: &DocContext) -> Item {
             attrs: self.attrs.clean(cx),
             source: self.span.clean(cx),
             visibility: self.vis.clean(cx),
-            stability: get_stability(cx, cx.tcx.map.local_def_id(self.id)),
-            deprecation: get_deprecation(cx, cx.tcx.map.local_def_id(self.id)),
-            def_id: cx.tcx.map.local_def_id(self.id),
+            stability: get_stability(cx, cx.tcx.hir.local_def_id(self.id)),
+            deprecation: get_deprecation(cx, cx.tcx.hir.local_def_id(self.id)),
+            def_id: cx.tcx.hir.local_def_id(self.id),
             inner: StructFieldItem(self.ty.clean(cx)),
         }
     }
@@ -1982,7 +1982,7 @@ fn clean(&self, cx: &DocContext) -> Item {
             name: Some(self.name.clean(cx)),
             attrs: self.attrs.clean(cx),
             source: self.whence.clean(cx),
-            def_id: cx.tcx.map.local_def_id(self.id),
+            def_id: cx.tcx.hir.local_def_id(self.id),
             visibility: self.vis.clean(cx),
             stability: self.stab.clean(cx),
             deprecation: self.depr.clean(cx),
@@ -2002,7 +2002,7 @@ fn clean(&self, cx: &DocContext) -> Item {
             name: Some(self.name.clean(cx)),
             attrs: self.attrs.clean(cx),
             source: self.whence.clean(cx),
-            def_id: cx.tcx.map.local_def_id(self.id),
+            def_id: cx.tcx.hir.local_def_id(self.id),
             visibility: self.vis.clean(cx),
             stability: self.stab.clean(cx),
             deprecation: self.depr.clean(cx),
@@ -2049,7 +2049,7 @@ fn clean(&self, cx: &DocContext) -> Item {
             name: Some(self.name.clean(cx)),
             attrs: self.attrs.clean(cx),
             source: self.whence.clean(cx),
-            def_id: cx.tcx.map.local_def_id(self.id),
+            def_id: cx.tcx.hir.local_def_id(self.id),
             visibility: self.vis.clean(cx),
             stability: self.stab.clean(cx),
             deprecation: self.depr.clean(cx),
@@ -2076,7 +2076,7 @@ fn clean(&self, cx: &DocContext) -> Item {
             visibility: None,
             stability: self.stab.clean(cx),
             deprecation: self.depr.clean(cx),
-            def_id: cx.tcx.map.local_def_id(self.def.id()),
+            def_id: cx.tcx.hir.local_def_id(self.def.id()),
             inner: VariantItem(Variant {
                 kind: self.def.clean(cx),
             }),
@@ -2306,7 +2306,7 @@ fn clean(&self, cx: &DocContext) -> Item {
             name: Some(self.name.clean(cx)),
             attrs: self.attrs.clean(cx),
             source: self.whence.clean(cx),
-            def_id: cx.tcx.map.local_def_id(self.id.clone()),
+            def_id: cx.tcx.hir.local_def_id(self.id.clone()),
             visibility: self.vis.clean(cx),
             stability: self.stab.clean(cx),
             deprecation: self.depr.clean(cx),
@@ -2358,7 +2358,7 @@ fn clean(&self, cx: &DocContext) -> Item {
             name: Some(self.name.clean(cx)),
             attrs: self.attrs.clean(cx),
             source: self.whence.clean(cx),
-            def_id: cx.tcx.map.local_def_id(self.id),
+            def_id: cx.tcx.hir.local_def_id(self.id),
             visibility: self.vis.clean(cx),
             stability: self.stab.clean(cx),
             deprecation: self.depr.clean(cx),
@@ -2383,7 +2383,7 @@ fn clean(&self, cx: &DocContext) -> Item {
             name: Some(self.name.clean(cx)),
             attrs: self.attrs.clean(cx),
             source: self.whence.clean(cx),
-            def_id: cx.tcx.map.local_def_id(self.id),
+            def_id: cx.tcx.hir.local_def_id(self.id),
             visibility: self.vis.clean(cx),
             stability: self.stab.clean(cx),
             deprecation: self.depr.clean(cx),
@@ -2459,7 +2459,7 @@ fn clean(&self, cx: &DocContext) -> Vec<Item> {
             name: None,
             attrs: self.attrs.clean(cx),
             source: self.whence.clean(cx),
-            def_id: cx.tcx.map.local_def_id(self.id),
+            def_id: cx.tcx.hir.local_def_id(self.id),
             visibility: self.vis.clean(cx),
             stability: self.stab.clean(cx),
             deprecation: self.depr.clean(cx),
@@ -2542,7 +2542,7 @@ fn clean(&self, cx: &DocContext) -> Item {
             name: None,
             attrs: self.attrs.clean(cx),
             source: self.whence.clean(cx),
-            def_id: cx.tcx.map.local_def_id(self.id),
+            def_id: cx.tcx.hir.local_def_id(self.id),
             visibility: Some(Public),
             stability: None,
             deprecation: None,
@@ -2598,7 +2598,7 @@ fn clean(&self, cx: &DocContext) -> Vec<Item> {
             name: None,
             attrs: self.attrs.clean(cx),
             source: self.whence.clean(cx),
-            def_id: cx.tcx.map.local_def_id(ast::CRATE_NODE_ID),
+            def_id: cx.tcx.hir.local_def_id(ast::CRATE_NODE_ID),
             visibility: self.vis.clean(cx),
             stability: None,
             deprecation: None,
@@ -2657,10 +2657,10 @@ fn clean(&self, cx: &DocContext) -> Item {
             name: Some(self.name.clean(cx)),
             attrs: self.attrs.clean(cx),
             source: self.span.clean(cx),
-            def_id: cx.tcx.map.local_def_id(self.id),
+            def_id: cx.tcx.hir.local_def_id(self.id),
             visibility: self.vis.clean(cx),
-            stability: get_stability(cx, cx.tcx.map.local_def_id(self.id)),
-            deprecation: get_deprecation(cx, cx.tcx.map.local_def_id(self.id)),
+            stability: get_stability(cx, cx.tcx.hir.local_def_id(self.id)),
+            deprecation: get_deprecation(cx, cx.tcx.hir.local_def_id(self.id)),
             inner: inner,
         }
     }
@@ -2721,7 +2721,7 @@ fn name_from_pat(p: &hir::Pat) -> String {
 }
 
 fn print_const_expr(cx: &DocContext, body: hir::BodyId) -> String {
-    cx.tcx.map.node_to_pretty_string(body.node_id)
+    cx.tcx.hir.node_to_pretty_string(body.node_id)
 }
 
 /// Given a type Path, resolve it to a Type using the TyCtxt
index 514eb6ea843defc4d24b501278b3118d568145ff..5393e395bbe43aad2e90af3c1e66729493742754 100644 (file)
@@ -189,7 +189,7 @@ pub fn run_core(search_paths: SearchPaths,
         // to the map from defid -> nodeid
         let access_levels = AccessLevels {
             map: access_levels.map.into_iter()
-                                  .map(|(k, v)| (tcx.map.local_def_id(k), v))
+                                  .map(|(k, v)| (tcx.hir.local_def_id(k), v))
                                   .collect()
         };
 
@@ -204,11 +204,11 @@ pub fn run_core(search_paths: SearchPaths,
             export_map: export_map,
             hir_ty_to_ty: hir_ty_to_ty,
         };
-        debug!("crate: {:?}", tcx.map.krate());
+        debug!("crate: {:?}", tcx.hir.krate());
 
         let krate = {
             let mut v = RustdocVisitor::new(&ctxt);
-            v.visit(tcx.map.krate());
+            v.visit(tcx.hir.krate());
             v.clean(&ctxt)
         };
 
index b0afc3d63f47932a0bc805092e48eff4ab3af833..394eb4779898c1021b754a4612ca69e08658c501 100644 (file)
@@ -65,12 +65,12 @@ pub fn new(cx: &'a core::DocContext<'a, 'tcx>) -> RustdocVisitor<'a, 'tcx> {
     }
 
     fn stability(&self, id: ast::NodeId) -> Option<attr::Stability> {
-        self.cx.tcx.map.opt_local_def_id(id)
+        self.cx.tcx.hir.opt_local_def_id(id)
             .and_then(|def_id| self.cx.tcx.lookup_stability(def_id)).cloned()
     }
 
     fn deprecation(&self, id: ast::NodeId) -> Option<attr::Deprecation> {
-        self.cx.tcx.map.opt_local_def_id(id)
+        self.cx.tcx.hir.opt_local_def_id(id)
             .and_then(|def_id| self.cx.tcx.lookup_deprecation(def_id))
     }
 
@@ -193,7 +193,7 @@ pub fn visit_mod_contents(&mut self, span: Span, attrs: hir::HirVec<ast::Attribu
         let orig_inside_public_path = self.inside_public_path;
         self.inside_public_path &= vis == hir::Public;
         for i in &m.item_ids {
-            let item = self.cx.tcx.map.expect_item(i.id);
+            let item = self.cx.tcx.hir.expect_item(i.id);
             self.visit_item(item, None, &mut om);
         }
         self.inside_public_path = orig_inside_public_path;
@@ -246,9 +246,9 @@ fn maybe_inline_local(&mut self,
                           please_inline: bool) -> bool {
 
         fn inherits_doc_hidden(cx: &core::DocContext, mut node: ast::NodeId) -> bool {
-            while let Some(id) = cx.tcx.map.get_enclosing_scope(node) {
+            while let Some(id) = cx.tcx.hir.get_enclosing_scope(node) {
                 node = id;
-                if cx.tcx.map.attrs(node).lists("doc").has_word("hidden") {
+                if cx.tcx.hir.attrs(node).lists("doc").has_word("hidden") {
                     return true;
                 }
                 if node == ast::CRATE_NODE_ID {
@@ -264,7 +264,7 @@ fn inherits_doc_hidden(cx: &core::DocContext, mut node: ast::NodeId) -> bool {
         }
         let def_did = def.def_id();
 
-        let use_attrs = tcx.map.attrs(id);
+        let use_attrs = tcx.hir.attrs(id);
         // Don't inline doc(hidden) imports so they can be stripped at a later stage.
         let is_no_inline = use_attrs.lists("doc").has_word("no_inline") ||
                            use_attrs.lists("doc").has_word("hidden");
@@ -292,7 +292,7 @@ fn inherits_doc_hidden(cx: &core::DocContext, mut node: ast::NodeId) -> bool {
             return false
         }
 
-        let def_node_id = match tcx.map.as_local_node_id(def_did) {
+        let def_node_id = match tcx.hir.as_local_node_id(def_did) {
             Some(n) => n, None => return false
         };
 
@@ -306,14 +306,14 @@ fn inherits_doc_hidden(cx: &core::DocContext, mut node: ast::NodeId) -> bool {
 
         if !self.view_item_stack.insert(def_node_id) { return false }
 
-        let ret = match tcx.map.get(def_node_id) {
+        let ret = match tcx.hir.get(def_node_id) {
             hir_map::NodeItem(it) => {
                 let prev = mem::replace(&mut self.inlining, true);
                 if glob {
                     match it.node {
                         hir::ItemMod(ref m) => {
                             for i in &m.item_ids {
-                                let i = self.cx.tcx.map.expect_item(i.id);
+                                let i = self.cx.tcx.hir.expect_item(i.id);
                                 self.visit_item(i, None, om);
                             }
                         }
@@ -460,7 +460,7 @@ pub fn visit_item(&mut self, item: &hir::Item,
             },
             hir::ItemTrait(unsafety, ref gen, ref b, ref item_ids) => {
                 let items = item_ids.iter()
-                                    .map(|ti| self.cx.tcx.map.trait_item(ti.id).clone())
+                                    .map(|ti| self.cx.tcx.hir.trait_item(ti.id).clone())
                                     .collect();
                 let t = Trait {
                     unsafety: unsafety,
@@ -483,7 +483,7 @@ pub fn visit_item(&mut self, item: &hir::Item,
                 // regardless of where they're located.
                 if !self.inlining {
                     let items = item_ids.iter()
-                                        .map(|ii| self.cx.tcx.map.impl_item(ii.id).clone())
+                                        .map(|ii| self.cx.tcx.hir.impl_item(ii.id).clone())
                                         .collect();
                     let i = Impl {
                         unsafety: unsafety,
@@ -524,7 +524,7 @@ fn visit_local_macro(&self, def: &hir::MacroDef) -> Macro {
         let matchers = def.body.chunks(4).map(|arm| arm[0].get_span()).collect();
 
         Macro {
-            def_id: self.cx.tcx.map.local_def_id(def.id),
+            def_id: self.cx.tcx.hir.local_def_id(def.id),
             attrs: def.attrs.clone(),
             name: def.name,
             whence: def.span,
index e1b1b441894b75eeeb087697d8e658a51b1a522c..778c49d144c020da249b21ad45d479ed4a754b58 100644 (file)
@@ -53,8 +53,8 @@ fn check_fn(&mut self, cx: &LateContext,
         if let Some(other) = self.map.insert(extent, node) {
             cx.span_lint(REGION_HIERARCHY, span, &format!(
                 "different fns {:?}, {:?} with the same root extent {:?}",
-                cx.tcx.map.local_def_id(other),
-                cx.tcx.map.local_def_id(node),
+                cx.tcx.hir.local_def_id(other),
+                cx.tcx.hir.local_def_id(node),
                 extent));
         }
     }