about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2016-04-06 05:04:15 -0700
committerbors <bors@rust-lang.org>2016-04-06 05:04:15 -0700
commit943ec3bdfc9ba28e94b6d00a2b53fb2cd8b21655 (patch)
tree30b2cefa099bea233f2e257116c5ec99589aaa63 /src
parent772c600d4d6f39daa6d07d1a60ee0df3d3426978 (diff)
parent552af51ffb9f4ae08a7ee3bf27b0e8309006ca6f (diff)
downloadrust-943ec3bdfc9ba28e94b6d00a2b53fb2cd8b21655.tar.gz
rust-943ec3bdfc9ba28e94b6d00a2b53fb2cd8b21655.zip
Auto merge of #32767 - Manishearth:breakingbatch, r=eddyb
Batch up all plugin breaking changes

https://github.com/rust-lang/rust/pull/32688 already landed so we should get this into the same nightly.

cc https://github.com/rust-lang/rust/issues/31645
Diffstat (limited to 'src')
-rw-r--r--src/librustc/Cargo.toml1
-rw-r--r--src/librustc/cfg/construct.rs8
-rw-r--r--src/librustc/cfg/graphviz.rs2
-rw-r--r--src/librustc/cfg/mod.rs2
-rw-r--r--src/librustc/dep_graph/mod.rs6
-rw-r--r--src/librustc/hir/check_attr.rs (renamed from src/librustc/front/check_attr.rs)0
-rw-r--r--src/librustc/hir/def.rs (renamed from src/librustc/middle/def.rs)4
-rw-r--r--src/librustc/hir/def_id.rs (renamed from src/librustc/middle/def_id.rs)0
-rw-r--r--src/librustc/hir/fold.rs (renamed from src/librustc_front/fold.rs)8
-rw-r--r--src/librustc/hir/intravisit.rs (renamed from src/librustc_front/intravisit.rs)233
-rw-r--r--src/librustc/hir/lowering.rs (renamed from src/librustc_front/lowering.rs)11
-rw-r--r--src/librustc/hir/map/blocks.rs (renamed from src/librustc/front/map/blocks.rs)8
-rw-r--r--src/librustc/hir/map/collector.rs (renamed from src/librustc/front/map/collector.rs)12
-rw-r--r--src/librustc/hir/map/definitions.rs (renamed from src/librustc/front/map/definitions.rs)2
-rw-r--r--src/librustc/hir/map/mod.rs (renamed from src/librustc/front/map/mod.rs)248
-rw-r--r--src/librustc/hir/mod.rs (renamed from src/librustc_front/hir.rs)224
-rw-r--r--src/librustc/hir/pat_util.rs (renamed from src/librustc/middle/pat_util.rs)27
-rw-r--r--src/librustc/hir/print.rs (renamed from src/librustc_front/print/pprust.rs)8
-rw-r--r--src/librustc/hir/svh.rs (renamed from src/librustc_back/svh.rs)12
-rw-r--r--src/librustc/infer/error_reporting.rs20
-rw-r--r--src/librustc/infer/mod.rs4
-rw-r--r--src/librustc/infer/type_variable.rs2
-rw-r--r--src/librustc/lib.rs17
-rw-r--r--src/librustc/lint/context.rs49
-rw-r--r--src/librustc/lint/mod.rs4
-rw-r--r--src/librustc/middle/astconv_util.rs4
-rw-r--r--src/librustc/middle/const_val.rs2
-rw-r--r--src/librustc/middle/cstore.rs21
-rw-r--r--src/librustc/middle/dataflow.rs7
-rw-r--r--src/librustc/middle/dead.rs12
-rw-r--r--src/librustc/middle/effect.rs8
-rw-r--r--src/librustc/middle/entry.rs8
-rw-r--r--src/librustc/middle/expr_use_visitor.rs14
-rw-r--r--src/librustc/middle/intrinsicck.rs8
-rw-r--r--src/librustc/middle/lang_items.rs8
-rw-r--r--src/librustc/middle/liveness.rs16
-rw-r--r--src/librustc/middle/mem_categorization.rs10
-rw-r--r--src/librustc/middle/reachable.rs12
-rw-r--r--src/librustc/middle/region.rs11
-rw-r--r--src/librustc/middle/resolve_lifetime.rs10
-rw-r--r--src/librustc/middle/stability.rs12
-rw-r--r--src/librustc/middle/weak_lang_items.rs6
-rw-r--r--src/librustc/mir/repr.rs4
-rw-r--r--src/librustc/mir/tcx.rs2
-rw-r--r--src/librustc/mir/visit.rs2
-rw-r--r--src/librustc/traits/coherence.rs2
-rw-r--r--src/librustc/traits/error_reporting.rs2
-rw-r--r--src/librustc/traits/mod.rs2
-rw-r--r--src/librustc/traits/object_safety.rs2
-rw-r--r--src/librustc/traits/project.rs2
-rw-r--r--src/librustc/traits/select.rs4
-rw-r--r--src/librustc/traits/specialize/mod.rs2
-rw-r--r--src/librustc/traits/specialize/specialization_graph.rs2
-rw-r--r--src/librustc/traits/util.rs2
-rw-r--r--src/librustc/ty/adjustment.rs2
-rw-r--r--src/librustc/ty/contents.rs2
-rw-r--r--src/librustc/ty/context.rs10
-rw-r--r--src/librustc/ty/error.rs4
-rw-r--r--src/librustc/ty/fast_reject.rs2
-rw-r--r--src/librustc/ty/item_path.rs9
-rw-r--r--src/librustc/ty/maps.rs2
-rw-r--r--src/librustc/ty/mod.rs73
-rw-r--r--src/librustc/ty/relate.rs4
-rw-r--r--src/librustc/ty/structural_impls.rs2
-rw-r--r--src/librustc/ty/sty.rs4
-rw-r--r--src/librustc/ty/subst.rs2
-rw-r--r--src/librustc/ty/trait_def.rs4
-rw-r--r--src/librustc/ty/util.rs8
-rw-r--r--src/librustc/ty/wf.rs2
-rw-r--r--src/librustc/util/common.rs6
-rw-r--r--src/librustc/util/nodemap.rs2
-rw-r--r--src/librustc/util/ppaux.rs4
-rw-r--r--src/librustc_back/Cargo.toml1
-rw-r--r--src/librustc_back/lib.rs2
-rw-r--r--src/librustc_borrowck/Cargo.toml1
-rw-r--r--src/librustc_borrowck/borrowck/check_loans.rs2
-rw-r--r--src/librustc_borrowck/borrowck/fragments.rs2
-rw-r--r--src/librustc_borrowck/borrowck/gather_loans/gather_moves.rs2
-rw-r--r--src/librustc_borrowck/borrowck/gather_loans/mod.rs8
-rw-r--r--src/librustc_borrowck/borrowck/gather_loans/move_error.rs2
-rw-r--r--src/librustc_borrowck/borrowck/mir/mod.rs4
-rw-r--r--src/librustc_borrowck/borrowck/mod.rs17
-rw-r--r--src/librustc_borrowck/borrowck/move_data.rs6
-rw-r--r--src/librustc_borrowck/lib.rs1
-rw-r--r--src/librustc_const_eval/Cargo.toml1
-rw-r--r--src/librustc_const_eval/check_match.rs28
-rw-r--r--src/librustc_const_eval/eval.rs16
-rw-r--r--src/librustc_const_eval/lib.rs1
-rw-r--r--src/librustc_driver/Cargo.toml1
-rw-r--r--src/librustc_driver/driver.rs9
-rw-r--r--src/librustc_driver/lib.rs1
-rw-r--r--src/librustc_driver/pretty.rs29
-rw-r--r--src/librustc_driver/test.rs6
-rw-r--r--src/librustc_front/Cargo.toml15
-rw-r--r--src/librustc_front/lib.rs58
-rw-r--r--src/librustc_front/util.rs362
-rw-r--r--src/librustc_lint/Cargo.toml1
-rw-r--r--src/librustc_lint/bad_style.rs6
-rw-r--r--src/librustc_lint/builtin.rs15
-rw-r--r--src/librustc_lint/lib.rs1
-rw-r--r--src/librustc_lint/types.rs7
-rw-r--r--src/librustc_lint/unused.rs6
-rw-r--r--src/librustc_metadata/Cargo.toml1
-rw-r--r--src/librustc_metadata/astencode.rs66
-rw-r--r--src/librustc_metadata/common.rs9
-rw-r--r--src/librustc_metadata/creader.rs8
-rw-r--r--src/librustc_metadata/csearch.rs28
-rw-r--r--src/librustc_metadata/cstore.rs4
-rw-r--r--src/librustc_metadata/decoder.rs36
-rw-r--r--src/librustc_metadata/encoder.rs113
-rw-r--r--src/librustc_metadata/index.rs2
-rw-r--r--src/librustc_metadata/lib.rs1
-rw-r--r--src/librustc_metadata/loader.rs2
-rw-r--r--src/librustc_metadata/tls_context.rs2
-rw-r--r--src/librustc_metadata/tydecode.rs4
-rw-r--r--src/librustc_metadata/tyencode.rs4
-rw-r--r--src/librustc_mir/Cargo.toml1
-rw-r--r--src/librustc_mir/build/block.rs2
-rw-r--r--src/librustc_mir/build/mod.rs2
-rw-r--r--src/librustc_mir/graphviz.rs2
-rw-r--r--src/librustc_mir/hair/cx/block.rs2
-rw-r--r--src/librustc_mir/hair/cx/expr.rs15
-rw-r--r--src/librustc_mir/hair/cx/mod.rs4
-rw-r--r--src/librustc_mir/hair/cx/pattern.rs6
-rw-r--r--src/librustc_mir/hair/cx/to_ref.rs2
-rw-r--r--src/librustc_mir/hair/mod.rs4
-rw-r--r--src/librustc_mir/lib.rs1
-rw-r--r--src/librustc_mir/mir_map.rs5
-rw-r--r--src/librustc_mir/pretty.rs2
-rw-r--r--src/librustc_passes/Cargo.toml1
-rw-r--r--src/librustc_passes/consts.rs8
-rw-r--r--src/librustc_passes/lib.rs1
-rw-r--r--src/librustc_passes/loops.rs6
-rw-r--r--src/librustc_passes/rvalues.rs4
-rw-r--r--src/librustc_passes/static_recursion.rs8
-rw-r--r--src/librustc_plugin/Cargo.toml1
-rw-r--r--src/librustc_plugin/build.rs6
-rw-r--r--src/librustc_plugin/lib.rs1
-rw-r--r--src/librustc_privacy/Cargo.toml1
-rw-r--r--src/librustc_privacy/lib.rs11
-rw-r--r--src/librustc_resolve/Cargo.toml1
-rw-r--r--src/librustc_resolve/build_reduced_graph.rs22
-rw-r--r--src/librustc_resolve/check_unused.rs6
-rw-r--r--src/librustc_resolve/lib.rs56
-rw-r--r--src/librustc_resolve/resolve_imports.rs2
-rw-r--r--src/librustc_save_analysis/Cargo.toml1
-rw-r--r--src/librustc_save_analysis/csv_dumper.rs2
-rw-r--r--src/librustc_save_analysis/data.rs2
-rw-r--r--src/librustc_save_analysis/dump_visitor.rs18
-rw-r--r--src/librustc_save_analysis/lib.rs57
-rw-r--r--src/librustc_trans/Cargo.toml1
-rw-r--r--src/librustc_trans/_match.rs10
-rw-r--r--src/librustc_trans/abi.rs2
-rw-r--r--src/librustc_trans/asm.rs2
-rw-r--r--src/librustc_trans/assert_dep_graph.rs6
-rw-r--r--src/librustc_trans/back/link.rs2
-rw-r--r--src/librustc_trans/back/symbol_names.rs4
-rw-r--r--src/librustc_trans/base.rs24
-rw-r--r--src/librustc_trans/callee.rs6
-rw-r--r--src/librustc_trans/closure.rs4
-rw-r--r--src/librustc_trans/collector.rs8
-rw-r--r--src/librustc_trans/common.rs6
-rw-r--r--src/librustc_trans/consts.rs8
-rw-r--r--src/librustc_trans/context.rs4
-rw-r--r--src/librustc_trans/controlflow.rs9
-rw-r--r--src/librustc_trans/debuginfo/create_scope_map.rs7
-rw-r--r--src/librustc_trans/debuginfo/metadata.rs8
-rw-r--r--src/librustc_trans/debuginfo/mod.rs9
-rw-r--r--src/librustc_trans/debuginfo/namespace.rs144
-rw-r--r--src/librustc_trans/debuginfo/type_names.rs38
-rw-r--r--src/librustc_trans/debuginfo/utils.rs2
-rw-r--r--src/librustc_trans/expr.rs9
-rw-r--r--src/librustc_trans/inline.rs4
-rw-r--r--src/librustc_trans/intrinsic.rs2
-rw-r--r--src/librustc_trans/lib.rs3
-rw-r--r--src/librustc_trans/meth.rs2
-rw-r--r--src/librustc_trans/mir/rvalue.rs2
-rw-r--r--src/librustc_trans/monomorphize.rs6
-rw-r--r--src/librustc_trans/symbol_names_test.rs4
-rw-r--r--src/librustc_trans/tvec.rs2
-rw-r--r--src/librustc_trans/type_of.rs2
-rw-r--r--src/librustc_typeck/Cargo.toml1
-rw-r--r--src/librustc_typeck/astconv.rs8
-rw-r--r--src/librustc_typeck/check/_match.rs13
-rw-r--r--src/librustc_typeck/check/callee.rs6
-rw-r--r--src/librustc_typeck/check/cast.rs4
-rw-r--r--src/librustc_typeck/check/closure.rs2
-rw-r--r--src/librustc_typeck/check/coercion.rs2
-rw-r--r--src/librustc_typeck/check/demand.rs2
-rw-r--r--src/librustc_typeck/check/dropck.rs2
-rw-r--r--src/librustc_typeck/check/intrinsic.rs2
-rw-r--r--src/librustc_typeck/check/method/confirm.rs4
-rw-r--r--src/librustc_typeck/check/method/mod.rs6
-rw-r--r--src/librustc_typeck/check/method/probe.rs6
-rw-r--r--src/librustc_typeck/check/method/suggest.rs14
-rw-r--r--src/librustc_typeck/check/mod.rs16
-rw-r--r--src/librustc_typeck/check/op.rs13
-rw-r--r--src/librustc_typeck/check/regionck.rs11
-rw-r--r--src/librustc_typeck/check/upvar.rs4
-rw-r--r--src/librustc_typeck/check/wfcheck.rs6
-rw-r--r--src/librustc_typeck/check/writeback.rs15
-rw-r--r--src/librustc_typeck/coherence/mod.rs10
-rw-r--r--src/librustc_typeck/coherence/orphan.rs6
-rw-r--r--src/librustc_typeck/coherence/overlap.rs6
-rw-r--r--src/librustc_typeck/coherence/unsafety.rs4
-rw-r--r--src/librustc_typeck/collect.rs12
-rw-r--r--src/librustc_typeck/lib.rs12
-rw-r--r--src/librustc_typeck/variance/constraints.rs8
-rw-r--r--src/librustc_typeck/variance/terms.rs4
-rw-r--r--src/librustdoc/Cargo.toml1
-rw-r--r--src/librustdoc/clean/inline.rs16
-rw-r--r--src/librustdoc/clean/mod.rs16
-rw-r--r--src/librustdoc/clean/simplify.rs2
-rw-r--r--src/librustdoc/core.rs6
-rw-r--r--src/librustdoc/doctree.rs2
-rw-r--r--src/librustdoc/html/format.rs4
-rw-r--r--src/librustdoc/html/render.rs4
-rw-r--r--src/librustdoc/lib.rs1
-rw-r--r--src/librustdoc/passes.rs4
-rw-r--r--src/librustdoc/test.rs6
-rw-r--r--src/librustdoc/visit_ast.rs4
-rw-r--r--src/libsyntax/ast.rs57
-rw-r--r--src/libsyntax/ast_util.rs398
-rw-r--r--src/libsyntax/config.rs6
-rw-r--r--src/libsyntax/ext/build.rs8
-rw-r--r--src/libsyntax/fold.rs24
-rw-r--r--src/libsyntax/lib.rs1
-rw-r--r--src/libsyntax/parse/parser.rs43
-rw-r--r--src/libsyntax/print/pprust.rs32
-rw-r--r--src/libsyntax/test.rs16
-rw-r--r--src/libsyntax/visit.rs6
-rw-r--r--src/libsyntax_ext/deriving/generic/mod.rs63
-rw-r--r--src/rustc/Cargo.lock24
-rw-r--r--src/test/auxiliary/dummy_mir_pass.rs1
-rw-r--r--src/test/auxiliary/lint_for_crate.rs3
-rw-r--r--src/test/auxiliary/lint_group_plugin_test.rs4
-rw-r--r--src/test/run-make/execution-engine/test.rs5
-rw-r--r--src/test/run-make/pretty-print-path-suffix/foo_method.pp2
238 files changed, 1374 insertions, 2329 deletions
diff --git a/src/librustc/Cargo.toml b/src/librustc/Cargo.toml
index e7aaaef45a1..d77268219fc 100644
--- a/src/librustc/Cargo.toml
+++ b/src/librustc/Cargo.toml
@@ -19,6 +19,5 @@ rustc_back = { path = "../librustc_back" }
 rustc_bitflags = { path = "../librustc_bitflags" }
 rustc_const_math = { path = "../librustc_const_math" }
 rustc_data_structures = { path = "../librustc_data_structures" }
-rustc_front = { path = "../librustc_front" }
 serialize = { path = "../libserialize" }
 syntax = { path = "../libsyntax" }
diff --git a/src/librustc/cfg/construct.rs b/src/librustc/cfg/construct.rs
index cd1e3b5f30e..70497491355 100644
--- a/src/librustc/cfg/construct.rs
+++ b/src/librustc/cfg/construct.rs
@@ -10,13 +10,13 @@
 
 use rustc_data_structures::graph;
 use cfg::*;
-use middle::def::Def;
-use middle::pat_util;
+use hir::def::Def;
+use hir::pat_util;
 use ty::{self, TyCtxt};
 use syntax::ast;
 use syntax::ptr::P;
 
-use rustc_front::hir::{self, PatKind};
+use hir::{self, PatKind};
 
 struct CFGBuilder<'a, 'tcx: 'a> {
     tcx: &'a TyCtxt<'tcx>,
@@ -257,7 +257,7 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
                 self.match_(expr.id, &discr, &arms, pred)
             }
 
-            hir::ExprBinary(op, ref l, ref r) if ::rustc_front::util::lazy_binop(op.node) => {
+            hir::ExprBinary(op, ref l, ref r) if op.node.is_lazy() => {
                 //
                 //     [pred]
                 //       |
diff --git a/src/librustc/cfg/graphviz.rs b/src/librustc/cfg/graphviz.rs
index c867ec94b25..c651baae282 100644
--- a/src/librustc/cfg/graphviz.rs
+++ b/src/librustc/cfg/graphviz.rs
@@ -17,7 +17,7 @@ use graphviz::IntoCow;
 
 use syntax::ast;
 
-use front::map as ast_map;
+use hir::map as ast_map;
 use cfg;
 
 pub type Node<'a> = (cfg::CFGIndex, &'a cfg::CFGNode);
diff --git a/src/librustc/cfg/mod.rs b/src/librustc/cfg/mod.rs
index 8df4dc5fce5..e86bf6ebc58 100644
--- a/src/librustc/cfg/mod.rs
+++ b/src/librustc/cfg/mod.rs
@@ -14,7 +14,7 @@
 use rustc_data_structures::graph;
 use ty::TyCtxt;
 use syntax::ast;
-use rustc_front::hir;
+use hir;
 
 mod construct;
 pub mod graphviz;
diff --git a/src/librustc/dep_graph/mod.rs b/src/librustc/dep_graph/mod.rs
index 731c33868df..55ec56a4bbe 100644
--- a/src/librustc/dep_graph/mod.rs
+++ b/src/librustc/dep_graph/mod.rs
@@ -9,11 +9,11 @@
 // except according to those terms.
 
 use self::thread::{DepGraphThreadData, DepMessage};
-use middle::def_id::DefId;
+use hir::def_id::DefId;
 use syntax::ast::NodeId;
 use ty::TyCtxt;
-use rustc_front::hir;
-use rustc_front::intravisit::Visitor;
+use hir;
+use hir::intravisit::Visitor;
 use std::rc::Rc;
 
 mod dep_tracking_map;
diff --git a/src/librustc/front/check_attr.rs b/src/librustc/hir/check_attr.rs
index 085acc198d1..085acc198d1 100644
--- a/src/librustc/front/check_attr.rs
+++ b/src/librustc/hir/check_attr.rs
diff --git a/src/librustc/middle/def.rs b/src/librustc/hir/def.rs
index e6ea000936c..c270a4413bf 100644
--- a/src/librustc/middle/def.rs
+++ b/src/librustc/hir/def.rs
@@ -8,11 +8,11 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use middle::def_id::DefId;
+use hir::def_id::DefId;
 use ty::subst::ParamSpace;
 use util::nodemap::NodeMap;
 use syntax::ast;
-use rustc_front::hir;
+use hir;
 
 #[derive(Clone, Copy, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
 pub enum Def {
diff --git a/src/librustc/middle/def_id.rs b/src/librustc/hir/def_id.rs
index a3b83ec5be4..a3b83ec5be4 100644
--- a/src/librustc/middle/def_id.rs
+++ b/src/librustc/hir/def_id.rs
diff --git a/src/librustc_front/fold.rs b/src/librustc/hir/fold.rs
index e65f2fc37de..a6ff7164885 100644
--- a/src/librustc_front/fold.rs
+++ b/src/librustc/hir/fold.rs
@@ -908,14 +908,6 @@ pub fn noop_fold_item<T: Folder>(item: Item, folder: &mut T) -> Item {
     let Item { id, name, attrs, node, vis, span } = item;
     let id = folder.new_id(id);
     let node = folder.fold_item_underscore(node);
-    // FIXME: we should update the impl_pretty_name, but it uses pretty printing.
-    // let ident = match node {
-    //     // The node may have changed, recompute the "pretty" impl name.
-    //     ItemImpl(_, _, _, ref maybe_trait, ref ty, _) => {
-    //         impl_pretty_name(maybe_trait, Some(&**ty))
-    //     }
-    //     _ => ident
-    // };
 
     Item {
         id: id,
diff --git a/src/librustc_front/intravisit.rs b/src/librustc/hir/intravisit.rs
index be1cc528d88..d34d66918ca 100644
--- a/src/librustc_front/intravisit.rs
+++ b/src/librustc/hir/intravisit.rs
@@ -31,6 +31,9 @@ use syntax::attr::ThinAttributesExt;
 use syntax::codemap::Span;
 use hir::*;
 
+use std::cmp;
+use std::u32;
+
 #[derive(Copy, Clone, PartialEq, Eq)]
 pub enum FnKind<'a> {
     /// fn foo() or extern "Abi" fn foo()
@@ -835,3 +838,233 @@ pub fn walk_arm<'v, V: Visitor<'v>>(visitor: &mut V, arm: &'v Arm) {
     visitor.visit_expr(&arm.body);
     walk_list!(visitor, visit_attribute, &arm.attrs);
 }
+
+#[derive(Copy, Clone, RustcEncodable, RustcDecodable, Debug)]
+pub struct IdRange {
+    pub min: NodeId,
+    pub max: NodeId,
+}
+
+impl IdRange {
+    pub fn max() -> IdRange {
+        IdRange {
+            min: u32::MAX,
+            max: u32::MIN,
+        }
+    }
+
+    pub fn empty(&self) -> bool {
+        self.min >= self.max
+    }
+
+    pub fn add(&mut self, id: NodeId) {
+        self.min = cmp::min(self.min, id);
+        self.max = cmp::max(self.max, id + 1);
+    }
+}
+
+pub trait IdVisitingOperation {
+    fn visit_id(&mut self, node_id: NodeId);
+}
+
+pub struct IdRangeComputingVisitor {
+    pub result: IdRange,
+}
+
+impl IdRangeComputingVisitor {
+    pub fn new() -> IdRangeComputingVisitor {
+        IdRangeComputingVisitor { result: IdRange::max() }
+    }
+
+    pub fn result(&self) -> IdRange {
+        self.result
+    }
+}
+
+impl IdVisitingOperation for IdRangeComputingVisitor {
+    fn visit_id(&mut self, id: NodeId) {
+        self.result.add(id);
+    }
+}
+
+pub struct IdVisitor<'a, O: 'a> {
+    operation: &'a mut O,
+
+    // In general, the id visitor visits the contents of an item, but
+    // not including nested trait/impl items, nor other nested items.
+    // The base visitor itself always skips nested items, but not
+    // trait/impl items. This means in particular that if you start by
+    // visiting a trait or an impl, you should not visit the
+    // trait/impl items respectively.  This is handled by setting
+    // `skip_members` to true when `visit_item` is on the stack. This
+    // way, if the user begins by calling `visit_trait_item`, we will
+    // visit the trait item, but if they begin with `visit_item`, we
+    // won't visit the (nested) trait items.
+    skip_members: bool,
+}
+
+impl<'a, O: IdVisitingOperation> IdVisitor<'a, O> {
+    pub fn new(operation: &'a mut O) -> IdVisitor<'a, O> {
+        IdVisitor { operation: operation, skip_members: false }
+    }
+
+    fn visit_generics_helper(&mut self, generics: &Generics) {
+        for type_parameter in generics.ty_params.iter() {
+            self.operation.visit_id(type_parameter.id)
+        }
+        for lifetime in &generics.lifetimes {
+            self.operation.visit_id(lifetime.lifetime.id)
+        }
+    }
+}
+
+impl<'a, 'v, O: IdVisitingOperation> Visitor<'v> for IdVisitor<'a, O> {
+    fn visit_mod(&mut self, module: &Mod, _: Span, node_id: NodeId) {
+        self.operation.visit_id(node_id);
+        walk_mod(self, module)
+    }
+
+    fn visit_foreign_item(&mut self, foreign_item: &ForeignItem) {
+        self.operation.visit_id(foreign_item.id);
+        walk_foreign_item(self, foreign_item)
+    }
+
+    fn visit_item(&mut self, item: &Item) {
+        assert!(!self.skip_members);
+        self.skip_members = true;
+
+        self.operation.visit_id(item.id);
+        match item.node {
+            ItemUse(ref view_path) => {
+                match view_path.node {
+                    ViewPathSimple(_, _) |
+                    ViewPathGlob(_) => {}
+                    ViewPathList(_, ref paths) => {
+                        for path in paths {
+                            self.operation.visit_id(path.node.id())
+                        }
+                    }
+                }
+            }
+            _ => {}
+        }
+        walk_item(self, item);
+
+        self.skip_members = false;
+    }
+
+    fn visit_local(&mut self, local: &Local) {
+        self.operation.visit_id(local.id);
+        walk_local(self, local)
+    }
+
+    fn visit_block(&mut self, block: &Block) {
+        self.operation.visit_id(block.id);
+        walk_block(self, block)
+    }
+
+    fn visit_stmt(&mut self, statement: &Stmt) {
+        self.operation.visit_id(statement.node.id());
+        walk_stmt(self, statement)
+    }
+
+    fn visit_pat(&mut self, pattern: &Pat) {
+        self.operation.visit_id(pattern.id);
+        walk_pat(self, pattern)
+    }
+
+    fn visit_expr(&mut self, expression: &Expr) {
+        self.operation.visit_id(expression.id);
+        walk_expr(self, expression)
+    }
+
+    fn visit_ty(&mut self, typ: &Ty) {
+        self.operation.visit_id(typ.id);
+        walk_ty(self, typ)
+    }
+
+    fn visit_generics(&mut self, generics: &Generics) {
+        self.visit_generics_helper(generics);
+        walk_generics(self, generics)
+    }
+
+    fn visit_fn(&mut self,
+                function_kind: FnKind<'v>,
+                function_declaration: &'v FnDecl,
+                block: &'v Block,
+                span: Span,
+                node_id: NodeId) {
+        self.operation.visit_id(node_id);
+
+        match function_kind {
+            FnKind::ItemFn(_, generics, _, _, _, _, _) => {
+                self.visit_generics_helper(generics)
+            }
+            FnKind::Method(_, sig, _, _) => {
+                self.visit_generics_helper(&sig.generics)
+            }
+            FnKind::Closure(_) => {}
+        }
+
+        for argument in &function_declaration.inputs {
+            self.operation.visit_id(argument.id)
+        }
+
+        walk_fn(self, function_kind, function_declaration, block, span);
+    }
+
+    fn visit_struct_field(&mut self, struct_field: &StructField) {
+        self.operation.visit_id(struct_field.id);
+        walk_struct_field(self, struct_field)
+    }
+
+    fn visit_variant_data(&mut self,
+                          struct_def: &VariantData,
+                          _: Name,
+                          _: &Generics,
+                          _: NodeId,
+                          _: Span) {
+        self.operation.visit_id(struct_def.id());
+        walk_struct_def(self, struct_def);
+    }
+
+    fn visit_trait_item(&mut self, ti: &TraitItem) {
+        if !self.skip_members {
+            self.operation.visit_id(ti.id);
+            walk_trait_item(self, ti);
+        }
+    }
+
+    fn visit_impl_item(&mut self, ii: &ImplItem) {
+        if !self.skip_members {
+            self.operation.visit_id(ii.id);
+            walk_impl_item(self, ii);
+        }
+    }
+
+    fn visit_lifetime(&mut self, lifetime: &Lifetime) {
+        self.operation.visit_id(lifetime.id);
+    }
+
+    fn visit_lifetime_def(&mut self, def: &LifetimeDef) {
+        self.visit_lifetime(&def.lifetime);
+    }
+
+    fn visit_trait_ref(&mut self, trait_ref: &TraitRef) {
+        self.operation.visit_id(trait_ref.ref_id);
+        walk_trait_ref(self, trait_ref);
+    }
+}
+
+/// Computes the id range for a single fn body, ignoring nested items.
+pub fn compute_id_range_for_fn_body(fk: FnKind,
+                                    decl: &FnDecl,
+                                    body: &Block,
+                                    sp: Span,
+                                    id: NodeId)
+                                    -> IdRange {
+    let mut visitor = IdRangeComputingVisitor { result: IdRange::max() };
+    let mut id_visitor = IdVisitor::new(&mut visitor);
+    id_visitor.visit_fn(fk, decl, body, sp, id);
+    id_visitor.operation.result
+}
diff --git a/src/librustc_front/lowering.rs b/src/librustc/hir/lowering.rs
index 66b9e217bd3..738a04dea58 100644
--- a/src/librustc_front/lowering.rs
+++ b/src/librustc/hir/lowering.rs
@@ -621,12 +621,11 @@ pub fn lower_struct_field(lctx: &LoweringContext,
                           -> hir::StructField {
     hir::StructField {
         span: f.span,
-        id: f.node.id,
-        name: f.node.ident().map(|ident| ident.name)
-                            .unwrap_or(token::intern(&index.to_string())),
-        vis: lower_visibility(lctx, f.node.kind.visibility()),
-        ty: lower_ty(lctx, &f.node.ty),
-        attrs: lower_attrs(lctx, &f.node.attrs),
+        id: f.id,
+        name: f.ident.map(|ident| ident.name).unwrap_or(token::intern(&index.to_string())),
+        vis: lower_visibility(lctx, &f.vis),
+        ty: lower_ty(lctx, &f.ty),
+        attrs: lower_attrs(lctx, &f.attrs),
     }
 }
 
diff --git a/src/librustc/front/map/blocks.rs b/src/librustc/hir/map/blocks.rs
index 2eb3d56bb5e..7b1c692d54b 100644
--- a/src/librustc/front/map/blocks.rs
+++ b/src/librustc/hir/map/blocks.rs
@@ -23,14 +23,14 @@
 
 pub use self::Code::*;
 
-use front::map::{self, Node};
+use hir::map::{self, Node};
 use syntax::abi;
-use rustc_front::hir::{Block, FnDecl};
+use hir::{Block, FnDecl};
 use syntax::ast::{Attribute, Name, NodeId};
 use syntax::attr::ThinAttributesExt;
-use rustc_front::hir as ast;
+use hir as ast;
 use syntax::codemap::Span;
-use rustc_front::intravisit::FnKind;
+use hir::intravisit::FnKind;
 
 /// An FnLikeNode is a Node that is like a fn, in that it has a decl
 /// and a body (as well as a NodeId, a span, etc).
diff --git a/src/librustc/front/map/collector.rs b/src/librustc/hir/map/collector.rs
index 4ae03b1b9d7..94fa393ae3d 100644
--- a/src/librustc/front/map/collector.rs
+++ b/src/librustc/hir/map/collector.rs
@@ -11,10 +11,10 @@
 use super::*;
 use super::MapEntry::*;
 
-use rustc_front::hir::*;
-use rustc_front::util;
-use rustc_front::intravisit::{self, Visitor};
-use middle::def_id::{CRATE_DEF_INDEX, DefId, DefIndex};
+use hir::*;
+use hir::intravisit::Visitor;
+use hir::def_id::{CRATE_DEF_INDEX, DefId, DefIndex};
+use middle::cstore::InlinedItem;
 use std::iter::repeat;
 use syntax::ast::{NodeId, CRATE_NODE_ID, DUMMY_NODE_ID};
 use syntax::codemap::Span;
@@ -47,7 +47,7 @@ impl<'ast> NodeCollector<'ast> {
     }
 
     pub fn extend(krate: &'ast Crate,
-                  parent: &'ast InlinedParent,
+                  parent: &'ast InlinedItem,
                   parent_node: NodeId,
                   parent_def_path: DefPath,
                   parent_def_id: DefId,
@@ -305,7 +305,7 @@ impl<'ast> Visitor<'ast> for NodeCollector<'ast> {
     }
 
     fn visit_stmt(&mut self, stmt: &'ast Stmt) {
-        let id = util::stmt_id(stmt);
+        let id = stmt.node.id();
         self.insert(id, NodeStmt(stmt));
         let parent_node = self.parent_node;
         self.parent_node = id;
diff --git a/src/librustc/front/map/definitions.rs b/src/librustc/hir/map/definitions.rs
index 82574b85229..d045313cb1e 100644
--- a/src/librustc/front/map/definitions.rs
+++ b/src/librustc/hir/map/definitions.rs
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 use middle::cstore::LOCAL_CRATE;
-use middle::def_id::{DefId, DefIndex};
+use hir::def_id::{DefId, DefIndex};
 use rustc_data_structures::fnv::FnvHashMap;
 use syntax::ast;
 use syntax::parse::token::InternedString;
diff --git a/src/librustc/front/map/mod.rs b/src/librustc/hir/map/mod.rs
index 817bec58407..e1b7afda58b 100644
--- a/src/librustc/front/map/mod.rs
+++ b/src/librustc/hir/map/mod.rs
@@ -9,7 +9,6 @@
 // except according to those terms.
 
 pub use self::Node::*;
-pub use self::PathElem::*;
 use self::MapEntry::*;
 use self::collector::NodeCollector;
 pub use self::definitions::{Definitions, DefKey, DefPath, DefPathData,
@@ -19,100 +18,26 @@ use dep_graph::{DepGraph, DepNode};
 
 use middle::cstore::InlinedItem;
 use middle::cstore::InlinedItem as II;
-use middle::def_id::{CRATE_DEF_INDEX, DefId};
+use hir::def_id::{CRATE_DEF_INDEX, DefId};
 
 use syntax::abi::Abi;
 use syntax::ast::{self, Name, NodeId, DUMMY_NODE_ID};
 use syntax::attr::ThinAttributesExt;
 use syntax::codemap::{Span, Spanned};
-use syntax::parse::token;
 
-use rustc_front::hir::*;
-use rustc_front::fold::Folder;
-use rustc_front::intravisit;
-use rustc_front::print::pprust;
+use hir::*;
+use hir::fold::Folder;
+use hir::print as pprust;
 
 use arena::TypedArena;
 use std::cell::RefCell;
-use std::fmt;
 use std::io;
-use std::iter;
 use std::mem;
-use std::slice;
 
 pub mod blocks;
 mod collector;
 pub mod definitions;
 
-#[derive(Clone, Copy, PartialEq, Debug)]
-pub enum PathElem {
-    PathMod(Name),
-    PathName(Name)
-}
-
-impl PathElem {
-    pub fn name(&self) -> Name {
-        match *self {
-            PathMod(name) | PathName(name) => name
-        }
-    }
-}
-
-impl fmt::Display for PathElem {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        write!(f, "{}", self.name())
-    }
-}
-
-#[derive(Clone)]
-pub struct LinkedPathNode<'a> {
-    node: PathElem,
-    next: LinkedPath<'a>,
-}
-
-#[derive(Copy, Clone)]
-pub struct LinkedPath<'a>(Option<&'a LinkedPathNode<'a>>);
-
-impl<'a> LinkedPath<'a> {
-    pub fn empty() -> LinkedPath<'a> {
-        LinkedPath(None)
-    }
-
-    pub fn from(node: &'a LinkedPathNode) -> LinkedPath<'a> {
-        LinkedPath(Some(node))
-    }
-}
-
-impl<'a> Iterator for LinkedPath<'a> {
-    type Item = PathElem;
-
-    fn next(&mut self) -> Option<PathElem> {
-        match self.0 {
-            Some(node) => {
-                *self = node.next;
-                Some(node.node)
-            }
-            None => None
-        }
-    }
-}
-
-/// The type of the iterator used by with_path.
-pub type PathElems<'a, 'b> = iter::Chain<iter::Cloned<slice::Iter<'a, PathElem>>, LinkedPath<'b>>;
-
-pub fn path_to_string<PI: Iterator<Item=PathElem>>(path: PI) -> String {
-    let itr = token::get_ident_interner();
-
-    path.fold(String::new(), |mut s, e| {
-        let e = itr.get(e.name());
-        if !s.is_empty() {
-            s.push_str("::");
-        }
-        s.push_str(&e[..]);
-        s
-    })
-}
-
 #[derive(Copy, Clone, Debug)]
 pub enum Node<'ast> {
     NodeItem(&'ast Item),
@@ -157,7 +82,7 @@ pub enum MapEntry<'ast> {
 
     /// Roots for node trees.
     RootCrate,
-    RootInlinedParent(&'ast InlinedParent)
+    RootInlinedParent(&'ast InlinedItem)
 }
 
 impl<'ast> Clone for MapEntry<'ast> {
@@ -166,12 +91,6 @@ impl<'ast> Clone for MapEntry<'ast> {
     }
 }
 
-#[derive(Debug)]
-pub struct InlinedParent {
-    path: Vec<PathElem>,
-    ii: InlinedItem
-}
-
 impl<'ast> MapEntry<'ast> {
     fn from_node(p: NodeId, node: Node<'ast>) -> MapEntry<'ast> {
         match node {
@@ -234,7 +153,7 @@ impl<'ast> MapEntry<'ast> {
 pub struct Forest {
     krate: Crate,
     pub dep_graph: DepGraph,
-    inlined_items: TypedArena<InlinedParent>
+    inlined_items: TypedArena<InlinedItem>
 }
 
 impl Forest {
@@ -352,8 +271,10 @@ impl<'ast> Map<'ast> {
         self.definitions.borrow().def_key(def_id.index)
     }
 
-    pub fn def_path_from_id(&self, id: NodeId) -> DefPath {
-        self.def_path(self.local_def_id(id))
+    pub fn def_path_from_id(&self, id: NodeId) -> Option<DefPath> {
+        self.opt_local_def_id(id).map(|def_id| {
+            self.def_path(def_id)
+        })
     }
 
     pub fn def_path(&self, def_id: DefId) -> DefPath {
@@ -552,8 +473,8 @@ impl<'ast> Map<'ast> {
     pub fn get_parent_did(&self, id: NodeId) -> DefId {
         let parent = self.get_parent(id);
         match self.find_entry(parent) {
-            Some(RootInlinedParent(&InlinedParent {ii: II::TraitItem(did, _), ..})) => did,
-            Some(RootInlinedParent(&InlinedParent {ii: II::ImplItem(did, _), ..})) => did,
+            Some(RootInlinedParent(&II::TraitItem(did, _))) |
+            Some(RootInlinedParent(&II::ImplItem(did, _))) => did,
             _ => self.local_def_id(parent)
         }
     }
@@ -635,80 +556,21 @@ impl<'ast> Map<'ast> {
         }
     }
 
-    /// returns the name associated with the given NodeId's AST
-    pub fn get_path_elem(&self, id: NodeId) -> PathElem {
-        let node = self.get(id);
-        match node {
-            NodeItem(item) => {
-                match item.node {
-                    ItemMod(_) | ItemForeignMod(_) => {
-                        PathMod(item.name)
-                    }
-                    _ => PathName(item.name)
-                }
-            }
-            NodeForeignItem(i) => PathName(i.name),
-            NodeImplItem(ii) => PathName(ii.name),
-            NodeTraitItem(ti) => PathName(ti.name),
-            NodeVariant(v) => PathName(v.node.name),
-            NodeLifetime(lt) => PathName(lt.name),
-            NodeTyParam(tp) => PathName(tp.name),
+    /// Returns the name associated with the given NodeId's AST.
+    pub fn name(&self, id: NodeId) -> Name {
+        match self.get(id) {
+            NodeItem(i) => i.name,
+            NodeForeignItem(i) => i.name,
+            NodeImplItem(ii) => ii.name,
+            NodeTraitItem(ti) => ti.name,
+            NodeVariant(v) => v.node.name,
+            NodeLifetime(lt) => lt.name,
+            NodeTyParam(tp) => tp.name,
             NodeLocal(&Pat { node: PatKind::Ident(_,l,_), .. }) => {
-                PathName(l.node.name)
+                l.node.name
             },
-            _ => bug!("no path elem for {:?}", node)
-        }
-    }
-
-    pub fn with_path<T, F>(&self, id: NodeId, f: F) -> T where
-        F: FnOnce(PathElems) -> T,
-    {
-        self.with_path_next(id, LinkedPath::empty(), f)
-    }
-
-    pub fn path_to_string(&self, id: NodeId) -> String {
-        self.with_path(id, |path| path_to_string(path))
-    }
-
-    fn path_to_str_with_name(&self, id: NodeId, name: Name) -> String {
-        self.with_path(id, |path| {
-            path_to_string(path.chain(Some(PathName(name))))
-        })
-    }
-
-    fn with_path_next<T, F>(&self, id: NodeId, next: LinkedPath, f: F) -> T where
-        F: FnOnce(PathElems) -> T,
-    {
-        // This function reveals the name of the item and hence is a
-        // kind of read. This is inefficient, since it walks ancestors
-        // and we are walking them anyhow, but whatever.
-        self.read(id);
-
-        let parent = self.get_parent(id);
-        let parent = match self.find_entry(id) {
-            Some(EntryForeignItem(..)) => {
-                // Anonymous extern items go in the parent scope.
-                self.get_parent(parent)
-            }
-            // But tuple struct ctors don't have names, so use the path of its
-            // parent, the struct item. Similarly with closure expressions.
-            Some(EntryStructCtor(..)) | Some(EntryExpr(..)) => {
-                return self.with_path_next(parent, next, f);
-            }
-            _ => parent
-        };
-        if parent == id {
-            match self.find_entry(id) {
-                Some(RootInlinedParent(data)) => {
-                    f(data.path.iter().cloned().chain(next))
-                }
-                _ => f([].iter().cloned().chain(next))
-            }
-        } else {
-            self.with_path_next(parent, LinkedPath::from(&LinkedPathNode {
-                node: self.get_path_elem(id),
-                next: next
-            }), f)
+            NodeStructCtor(_) => self.name(self.get_parent(id)),
+            _ => bug!("no name for {}", self.node_to_string(id))
         }
     }
 
@@ -959,7 +821,6 @@ pub fn map_crate<'ast>(forest: &'ast mut Forest) -> Map<'ast> {
 /// Used for items loaded from external crate that are being inlined into this
 /// crate.
 pub fn map_decoded_item<'ast, F: FoldOps>(map: &Map<'ast>,
-                                          parent_path: Vec<PathElem>,
                                           parent_def_path: DefPath,
                                           parent_def_id: DefId,
                                           ii: InlinedItem,
@@ -979,27 +840,24 @@ pub fn map_decoded_item<'ast, F: FoldOps>(map: &Map<'ast>,
         II::Foreign(i) => II::Foreign(i.map(|i| fld.fold_foreign_item(i)))
     };
 
-    let ii_parent = map.forest.inlined_items.alloc(InlinedParent {
-        path: parent_path,
-        ii: ii
-    });
+    let ii = map.forest.inlined_items.alloc(ii);
 
     let ii_parent_id = fld.new_id(DUMMY_NODE_ID);
     let mut collector =
         NodeCollector::extend(
             map.krate(),
-            ii_parent,
+            ii,
             ii_parent_id,
             parent_def_path,
             parent_def_id,
             mem::replace(&mut *map.map.borrow_mut(), vec![]),
             mem::replace(&mut *map.definitions.borrow_mut(), Definitions::new()));
-    ii_parent.ii.visit(&mut collector);
+    ii.visit(&mut collector);
 
     *map.map.borrow_mut() = collector.map;
     *map.definitions.borrow_mut() = collector.definitions;
 
-    &ii_parent.ii
+    ii
 }
 
 pub trait NodePrinter {
@@ -1033,9 +891,24 @@ fn node_id_to_string(map: &Map, id: NodeId, include_id: bool) -> String {
     let id_str = format!(" (id={})", id);
     let id_str = if include_id { &id_str[..] } else { "" };
 
+    let path_str = || {
+        // This functionality is used for debugging, try to use TyCtxt to get
+        // the user-friendly path, otherwise fall back to stringifying DefPath.
+        ::ty::tls::with_opt(|tcx| {
+            if let Some(tcx) = tcx {
+                tcx.node_path_str(id)
+            } else if let Some(path) = map.def_path_from_id(id) {
+                path.data.into_iter().map(|elem| {
+                    elem.data.to_string()
+                }).collect::<Vec<_>>().join("::")
+            } else {
+                String::from("<missing path>")
+            }
+        })
+    };
+
     match map.find(id) {
         Some(NodeItem(item)) => {
-            let path_str = map.path_to_str_with_name(id, item.name);
             let item_str = match item.node {
                 ItemExternCrate(..) => "extern crate",
                 ItemUse(..) => "use",
@@ -1051,30 +924,21 @@ fn node_id_to_string(map: &Map, id: NodeId, include_id: bool) -> String {
                 ItemImpl(..) => "impl",
                 ItemDefaultImpl(..) => "default impl",
             };
-            format!("{} {}{}", item_str, path_str, id_str)
+            format!("{} {}{}", item_str, path_str(), id_str)
         }
-        Some(NodeForeignItem(item)) => {
-            let path_str = map.path_to_str_with_name(id, item.name);
-            format!("foreign item {}{}", path_str, id_str)
+        Some(NodeForeignItem(_)) => {
+            format!("foreign item {}{}", path_str(), id_str)
         }
         Some(NodeImplItem(ii)) => {
             match ii.node {
                 ImplItemKind::Const(..) => {
-                    format!("assoc const {} in {}{}",
-                            ii.name,
-                            map.path_to_string(id),
-                            id_str)
+                    format!("assoc const {} in {}{}", ii.name, path_str(), id_str)
                 }
                 ImplItemKind::Method(..) => {
-                    format!("method {} in {}{}",
-                            ii.name,
-                            map.path_to_string(id), id_str)
+                    format!("method {} in {}{}", ii.name, path_str(), id_str)
                 }
                 ImplItemKind::Type(_) => {
-                    format!("assoc type {} in {}{}",
-                            ii.name,
-                            map.path_to_string(id),
-                            id_str)
+                    format!("assoc type {} in {}{}", ii.name, path_str(), id_str)
                 }
             }
         }
@@ -1085,16 +949,12 @@ fn node_id_to_string(map: &Map, id: NodeId, include_id: bool) -> String {
                 TypeTraitItem(..) => "assoc type",
             };
 
-            format!("{} {} in {}{}",
-                    kind,
-                    ti.name,
-                    map.path_to_string(id),
-                    id_str)
+            format!("{} {} in {}{}", kind, ti.name, path_str(), id_str)
         }
         Some(NodeVariant(ref variant)) => {
             format!("variant {} in {}{}",
                     variant.node.name,
-                    map.path_to_string(id), id_str)
+                    path_str(), id_str)
         }
         Some(NodeExpr(ref expr)) => {
             format!("expr {}{}", pprust::expr_to_string(&expr), id_str)
@@ -1112,7 +972,7 @@ fn node_id_to_string(map: &Map, id: NodeId, include_id: bool) -> String {
             format!("block {}{}", pprust::block_to_string(&block), id_str)
         }
         Some(NodeStructCtor(_)) => {
-            format!("struct_ctor {}{}", map.path_to_string(id), id_str)
+            format!("struct_ctor {}{}", path_str(), id_str)
         }
         Some(NodeLifetime(ref l)) => {
             format!("lifetime {}{}",
diff --git a/src/librustc_front/hir.rs b/src/librustc/hir/mod.rs
index 86f8635f58d..edb9b783527 100644
--- a/src/librustc_front/hir.rs
+++ b/src/librustc/hir/mod.rs
@@ -33,8 +33,10 @@ pub use self::ViewPath_::*;
 pub use self::Visibility::*;
 pub use self::PathParameters::*;
 
-use intravisit::Visitor;
-use std::collections::BTreeMap;
+use hir::def::Def;
+use hir::def_id::DefId;
+use util::nodemap::{NodeMap, FnvHashSet};
+
 use syntax::codemap::{self, Span, Spanned, DUMMY_SP, ExpnId};
 use syntax::abi::Abi;
 use syntax::ast::{Name, NodeId, DUMMY_NODE_ID, TokenTree, AsmDialect};
@@ -43,9 +45,7 @@ use syntax::attr::{ThinAttributes, ThinAttributesExt};
 use syntax::parse::token::InternedString;
 use syntax::ptr::P;
 
-use print::pprust;
-use util;
-
+use std::collections::BTreeMap;
 use std::fmt;
 use std::hash::{Hash, Hasher};
 use serialize::{Encodable, Decodable, Encoder, Decoder};
@@ -63,9 +63,20 @@ macro_rules! hir_vec {
     ($($x:expr),*) => (
         $crate::hir::HirVec::from(vec![$($x),*])
     );
-    ($($x:expr,)*) => (vec![$($x),*])
+    ($($x:expr,)*) => (hir_vec![$($x),*])
 }
 
+pub mod check_attr;
+pub mod def;
+pub mod def_id;
+pub mod fold;
+pub mod intravisit;
+pub mod lowering;
+pub mod map;
+pub mod pat_util;
+pub mod print;
+pub mod svh;
+
 /// Identifier in HIR
 #[derive(Clone, Copy, Eq)]
 pub struct Ident {
@@ -135,7 +146,7 @@ impl fmt::Debug for Lifetime {
         write!(f,
                "lifetime({}: {})",
                self.id,
-               pprust::lifetime_to_string(self))
+               print::lifetime_to_string(self))
     }
 }
 
@@ -161,13 +172,28 @@ pub struct Path {
 
 impl fmt::Debug for Path {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        write!(f, "path({})", pprust::path_to_string(self))
+        write!(f, "path({})", print::path_to_string(self))
     }
 }
 
 impl fmt::Display for Path {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        write!(f, "{}", pprust::path_to_string(self))
+        write!(f, "{}", print::path_to_string(self))
+    }
+}
+
+impl Path {
+    /// Convert a span and an identifier to the corresponding
+    /// 1-segment path.
+    pub fn from_ident(s: Span, ident: Ident) -> Path {
+        Path {
+            span: s,
+            global: false,
+            segments: hir_vec![PathSegment {
+                identifier: ident,
+                parameters: PathParameters::none()
+            }],
+        }
     }
 }
 
@@ -344,12 +370,25 @@ pub struct Generics {
 }
 
 impl Generics {
+    pub fn empty() -> Generics {
+        Generics {
+            lifetimes: HirVec::new(),
+            ty_params: HirVec::new(),
+            where_clause: WhereClause {
+                id: DUMMY_NODE_ID,
+                predicates: HirVec::new(),
+            },
+        }
+    }
+
     pub fn is_lt_parameterized(&self) -> bool {
         !self.lifetimes.is_empty()
     }
+
     pub fn is_type_parameterized(&self) -> bool {
         !self.ty_params.is_empty()
     }
+
     pub fn is_parameterized(&self) -> bool {
         self.is_lt_parameterized() || self.is_type_parameterized()
     }
@@ -434,7 +473,9 @@ impl Crate {
     /// follows lexical scoping rules -- then you want a different
     /// approach. You should override `visit_nested_item` in your
     /// visitor and then call `intravisit::walk_crate` instead.
-    pub fn visit_all_items<'hir, V:Visitor<'hir>>(&'hir self, visitor: &mut V) {
+    pub fn visit_all_items<'hir, V>(&'hir self, visitor: &mut V)
+        where V: intravisit::Visitor<'hir>
+    {
         for (_, item) in &self.items {
             visitor.visit_item(item);
         }
@@ -479,7 +520,51 @@ pub struct Pat {
 
 impl fmt::Debug for Pat {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        write!(f, "pat({}: {})", self.id, pprust::pat_to_string(self))
+        write!(f, "pat({}: {})", self.id, print::pat_to_string(self))
+    }
+}
+
+impl Pat {
+    // FIXME(#19596) this is a workaround, but there should be a better way
+    fn walk_<G>(&self, it: &mut G) -> bool
+        where G: FnMut(&Pat) -> bool
+    {
+        if !it(self) {
+            return false;
+        }
+
+        match self.node {
+            PatKind::Ident(_, _, Some(ref p)) => p.walk_(it),
+            PatKind::Struct(_, ref fields, _) => {
+                fields.iter().all(|field| field.node.pat.walk_(it))
+            }
+            PatKind::TupleStruct(_, Some(ref s)) | PatKind::Tup(ref s) => {
+                s.iter().all(|p| p.walk_(it))
+            }
+            PatKind::Box(ref s) | PatKind::Ref(ref s, _) => {
+                s.walk_(it)
+            }
+            PatKind::Vec(ref before, ref slice, ref after) => {
+                before.iter().all(|p| p.walk_(it)) &&
+                slice.iter().all(|p| p.walk_(it)) &&
+                after.iter().all(|p| p.walk_(it))
+            }
+            PatKind::Wild |
+            PatKind::Lit(_) |
+            PatKind::Range(_, _) |
+            PatKind::Ident(_, _, _) |
+            PatKind::TupleStruct(..) |
+            PatKind::Path(..) |
+            PatKind::QPath(_, _) => {
+                true
+            }
+        }
+    }
+
+    pub fn walk<F>(&self, mut it: F) -> bool
+        where F: FnMut(&Pat) -> bool
+    {
+        self.walk_(&mut it)
     }
 }
 
@@ -597,6 +682,68 @@ pub enum BinOp_ {
     BiGt,
 }
 
+impl BinOp_ {
+    pub fn as_str(self) -> &'static str {
+        match self {
+            BiAdd => "+",
+            BiSub => "-",
+            BiMul => "*",
+            BiDiv => "/",
+            BiRem => "%",
+            BiAnd => "&&",
+            BiOr => "||",
+            BiBitXor => "^",
+            BiBitAnd => "&",
+            BiBitOr => "|",
+            BiShl => "<<",
+            BiShr => ">>",
+            BiEq => "==",
+            BiLt => "<",
+            BiLe => "<=",
+            BiNe => "!=",
+            BiGe => ">=",
+            BiGt => ">",
+        }
+    }
+
+    pub fn is_lazy(self) -> bool {
+        match self {
+            BiAnd | BiOr => true,
+            _ => false,
+        }
+    }
+
+    pub fn is_shift(self) -> bool {
+        match self {
+            BiShl | BiShr => true,
+            _ => false,
+        }
+    }
+
+    pub fn is_comparison(self) -> bool {
+        match self {
+            BiEq | BiLt | BiLe | BiNe | BiGt | BiGe => true,
+            BiAnd |
+            BiOr |
+            BiAdd |
+            BiSub |
+            BiMul |
+            BiDiv |
+            BiRem |
+            BiBitXor |
+            BiBitAnd |
+            BiBitOr |
+            BiShl |
+            BiShr => false,
+        }
+    }
+
+    /// Returns `true` if the binary operator takes its arguments by value
+    pub fn is_by_value(self) -> bool {
+        !self.is_comparison()
+    }
+}
+
 pub type BinOp = Spanned<BinOp_>;
 
 #[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)]
@@ -609,6 +756,24 @@ pub enum UnOp {
     UnNeg,
 }
 
+impl UnOp {
+    pub fn as_str(self) -> &'static str {
+        match self {
+            UnDeref => "*",
+            UnNot => "!",
+            UnNeg => "-",
+        }
+    }
+
+    /// Returns `true` if the unary operator takes its argument by value
+    pub fn is_by_value(self) -> bool {
+        match self {
+            UnNeg | UnNot => true,
+            _ => false,
+        }
+    }
+}
+
 /// A statement
 pub type Stmt = Spanned<Stmt_>;
 
@@ -618,8 +783,8 @@ impl fmt::Debug for Stmt_ {
         let spanned = codemap::dummy_spanned(self.clone());
         write!(f,
                "stmt({}: {})",
-               util::stmt_id(&spanned),
-               pprust::stmt_to_string(&spanned))
+               spanned.node.id(),
+               print::stmt_to_string(&spanned))
     }
 }
 
@@ -643,6 +808,14 @@ impl Stmt_ {
             StmtSemi(ref e, _) => e.attrs.as_attr_slice(),
         }
     }
+
+    pub fn id(&self) -> NodeId {
+        match *self {
+            StmtDecl(_, id) => id,
+            StmtExpr(_, id) => id,
+            StmtSemi(_, id) => id,
+        }
+    }
 }
 
 // FIXME (pending discussion of #1697, #2178...): local should really be
@@ -722,7 +895,7 @@ pub struct Expr {
 
 impl fmt::Debug for Expr {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        write!(f, "expr({}: {})", self.id, pprust::expr_to_string(self))
+        write!(f, "expr({}: {})", self.id, print::expr_to_string(self))
     }
 }
 
@@ -940,7 +1113,7 @@ pub struct Ty {
 
 impl fmt::Debug for Ty {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        write!(f, "type({})", pprust::ty_to_string(self))
+        write!(f, "type({})", print::ty_to_string(self))
     }
 }
 
@@ -1456,3 +1629,24 @@ impl ForeignItem_ {
         }
     }
 }
+
+/// A free variable referred to in a function.
+#[derive(Copy, Clone, RustcEncodable, RustcDecodable)]
+pub struct Freevar {
+    /// The variable being accessed free.
+    pub def: Def,
+
+    // First span where it is accessed (there can be multiple).
+    pub span: Span
+}
+
+pub type FreevarMap = NodeMap<Vec<Freevar>>;
+
+pub type CaptureModeMap = NodeMap<CaptureClause>;
+
+// Trait method resolution
+pub type TraitMap = NodeMap<Vec<DefId>>;
+
+// Map from the NodeId of a glob import to a list of items which are actually
+// imported.
+pub type GlobMap = NodeMap<FnvHashSet<Name>>;
diff --git a/src/librustc/middle/pat_util.rs b/src/librustc/hir/pat_util.rs
index b2b1344c4bb..6cc5a29062f 100644
--- a/src/librustc/middle/pat_util.rs
+++ b/src/librustc/hir/pat_util.rs
@@ -8,14 +8,13 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use middle::def::*;
-use middle::def_id::DefId;
+use hir::def::*;
+use hir::def_id::DefId;
 use ty::TyCtxt;
 use util::nodemap::FnvHashMap;
 
 use syntax::ast;
-use rustc_front::hir::{self, PatKind};
-use rustc_front::util::walk_pat;
+use hir::{self, PatKind};
 use syntax::codemap::{respan, Span, Spanned, DUMMY_SP};
 
 use std::cell::RefCell;
@@ -115,7 +114,7 @@ pub fn pat_is_binding_or_wild(dm: &DefMap, pat: &hir::Pat) -> bool {
 pub fn pat_bindings<I>(dm: &RefCell<DefMap>, pat: &hir::Pat, mut it: I) where
     I: FnMut(hir::BindingMode, ast::NodeId, Span, &Spanned<ast::Name>),
 {
-    walk_pat(pat, |p| {
+    pat.walk(|p| {
         match p.node {
           PatKind::Ident(binding_mode, ref pth, _) if pat_is_binding(&dm.borrow(), p) => {
             it(binding_mode, p.id, p.span, &respan(pth.span, pth.node.name));
@@ -128,7 +127,7 @@ pub fn pat_bindings<I>(dm: &RefCell<DefMap>, pat: &hir::Pat, mut it: I) where
 pub fn pat_bindings_ident<I>(dm: &RefCell<DefMap>, pat: &hir::Pat, mut it: I) where
     I: FnMut(hir::BindingMode, ast::NodeId, Span, &Spanned<hir::Ident>),
 {
-    walk_pat(pat, |p| {
+    pat.walk(|p| {
         match p.node {
           PatKind::Ident(binding_mode, ref pth, _) if pat_is_binding(&dm.borrow(), p) => {
             it(binding_mode, p.id, p.span, &respan(pth.span, pth.node));
@@ -143,7 +142,7 @@ pub fn pat_bindings_ident<I>(dm: &RefCell<DefMap>, pat: &hir::Pat, mut it: I) wh
 /// an ident, e.g. `foo`, or `Foo(foo)` or `foo @ Bar(..)`.
 pub fn pat_contains_bindings(dm: &DefMap, pat: &hir::Pat) -> bool {
     let mut contains_bindings = false;
-    walk_pat(pat, |p| {
+    pat.walk(|p| {
         if pat_is_binding(dm, p) {
             contains_bindings = true;
             false // there's at least one binding, can short circuit now.
@@ -188,7 +187,7 @@ pub fn arm_contains_ref_binding(dm: &RefCell<DefMap>, arm: &hir::Arm) -> Option<
 /// an ident or wildcard, e.g. `foo`, or `Foo(_)`, `foo @ Bar(..)`,
 pub fn pat_contains_bindings_or_wild(dm: &DefMap, pat: &hir::Pat) -> bool {
     let mut contains_bindings = false;
-    walk_pat(pat, |p| {
+    pat.walk(|p| {
         if pat_is_binding_or_wild(dm, p) {
             contains_bindings = true;
             false // there's at least one binding/wildcard, can short circuit now.
@@ -211,20 +210,14 @@ pub fn simple_name<'a>(pat: &'a hir::Pat) -> Option<ast::Name> {
 }
 
 pub fn def_to_path(tcx: &TyCtxt, id: DefId) -> hir::Path {
-    tcx.with_path(id, |path| hir::Path {
-        global: false,
-        segments: path.last().map(|elem| hir::PathSegment {
-            identifier: hir::Ident::from_name(elem.name()),
-            parameters: hir::PathParameters::none(),
-        }).into_iter().collect(),
-        span: DUMMY_SP,
-    })
+    let name = tcx.item_name(id);
+    hir::Path::from_ident(DUMMY_SP, hir::Ident::from_name(name))
 }
 
 /// Return variants that are necessary to exist for the pattern to match.
 pub fn necessary_variants(dm: &DefMap, pat: &hir::Pat) -> Vec<DefId> {
     let mut variants = vec![];
-    walk_pat(pat, |p| {
+    pat.walk(|p| {
         match p.node {
             PatKind::TupleStruct(..) |
             PatKind::Path(..) |
diff --git a/src/librustc_front/print/pprust.rs b/src/librustc/hir/print.rs
index 3b8e6763de0..cd2dfd44639 100644
--- a/src/librustc_front/print/pprust.rs
+++ b/src/librustc/hir/print.rs
@@ -950,7 +950,7 @@ impl<'a> State<'a> {
 
     pub fn print_variant(&mut self, v: &hir::Variant) -> io::Result<()> {
         self.head("")?;
-        let generics = ::util::empty_generics();
+        let generics = hir::Generics::empty();
         self.print_struct(&v.node.data, &generics, v.node.name, v.span, false)?;
         match v.node.disr_expr {
             Some(ref d) => {
@@ -1285,12 +1285,12 @@ impl<'a> State<'a> {
                          -> io::Result<()> {
         self.print_expr(lhs)?;
         space(&mut self.s)?;
-        self.word_space(::util::binop_to_string(op.node))?;
+        self.word_space(op.node.as_str())?;
         self.print_expr(rhs)
     }
 
     fn print_expr_unary(&mut self, op: hir::UnOp, expr: &hir::Expr) -> io::Result<()> {
-        word(&mut self.s, ::util::unop_to_string(op))?;
+        word(&mut self.s, op.as_str())?;
         self.print_expr_maybe_paren(expr)
     }
 
@@ -1434,7 +1434,7 @@ impl<'a> State<'a> {
             hir::ExprAssignOp(op, ref lhs, ref rhs) => {
                 self.print_expr(&lhs)?;
                 space(&mut self.s)?;
-                word(&mut self.s, ::util::binop_to_string(op.node))?;
+                word(&mut self.s, op.node.as_str())?;
                 self.word_space("=")?;
                 self.print_expr(&rhs)?;
             }
diff --git a/src/librustc_back/svh.rs b/src/librustc/hir/svh.rs
index ec607314f45..7ae20f68ad0 100644
--- a/src/librustc_back/svh.rs
+++ b/src/librustc/hir/svh.rs
@@ -48,8 +48,8 @@
 
 use std::fmt;
 use std::hash::{Hash, SipHasher, Hasher};
-use rustc_front::hir;
-use rustc_front::intravisit as visit;
+use hir;
+use hir::intravisit as visit;
 
 #[derive(Clone, PartialEq, Debug)]
 pub struct Svh {
@@ -134,10 +134,10 @@ mod svh_visitor {
     use syntax::ast::{self, Name, NodeId};
     use syntax::codemap::Span;
     use syntax::parse::token;
-    use rustc_front::intravisit as visit;
-    use rustc_front::intravisit::{Visitor, FnKind};
-    use rustc_front::hir::*;
-    use rustc_front::hir;
+    use hir::intravisit as visit;
+    use hir::intravisit::{Visitor, FnKind};
+    use hir::*;
+    use hir;
 
     use std::hash::{Hash, SipHasher};
 
diff --git a/src/librustc/infer/error_reporting.rs b/src/librustc/infer/error_reporting.rs
index 8079a6d1bbc..a7553f4eb1f 100644
--- a/src/librustc/infer/error_reporting.rs
+++ b/src/librustc/infer/error_reporting.rs
@@ -73,13 +73,13 @@ use super::region_inference::SameRegions;
 
 use std::collections::HashSet;
 
-use front::map as ast_map;
-use rustc_front::hir;
-use rustc_front::print::pprust;
+use hir::map as ast_map;
+use hir;
+use hir::print as pprust;
 
 use middle::cstore::CrateStore;
-use middle::def::Def;
-use middle::def_id::DefId;
+use hir::def::Def;
+use hir::def_id::DefId;
 use infer::{self, TypeOrigin};
 use middle::region;
 use ty::subst;
@@ -587,13 +587,9 @@ impl<'a, 'tcx> ErrorReporting<'tcx> for InferCtxt<'a, 'tcx> {
             // Only external crates, if either is from a local
             // module we could have false positives
             if !(did1.is_local() || did2.is_local()) && did1.krate != did2.krate {
-                let exp_path = self.tcx.with_path(did1,
-                                                  |p| p.map(|x| x.to_string())
-                                                       .collect::<Vec<_>>());
-                let found_path = self.tcx.with_path(did2,
-                                                    |p| p.map(|x| x.to_string())
-                                                         .collect::<Vec<_>>());
-                // We compare strings because PathMod and PathName can be different
+                let exp_path = self.tcx.item_path_str(did1);
+                let found_path = self.tcx.item_path_str(did2);
+                // We compare strings because DefPath can be different
                 // for imported and non-imported crates
                 if exp_path == found_path {
                     let crate_name = self.tcx.sess.cstore.crate_name(did1.krate);
diff --git a/src/librustc/infer/mod.rs b/src/librustc/infer/mod.rs
index e22fb988904..4c1216aa862 100644
--- a/src/librustc/infer/mod.rs
+++ b/src/librustc/infer/mod.rs
@@ -18,8 +18,8 @@ pub use ty::IntVarValue;
 pub use self::freshen::TypeFreshener;
 pub use self::region_inference::{GenericKind, VerifyBound};
 
-use middle::def_id::DefId;
-use rustc_front::hir;
+use hir::def_id::DefId;
+use hir;
 use middle::free_region::FreeRegionMap;
 use middle::mem_categorization as mc;
 use middle::mem_categorization::McResult;
diff --git a/src/librustc/infer/type_variable.rs b/src/librustc/infer/type_variable.rs
index 3cc076f1f00..c2a8d04ac00 100644
--- a/src/librustc/infer/type_variable.rs
+++ b/src/librustc/infer/type_variable.rs
@@ -11,7 +11,7 @@
 pub use self::RelationDir::*;
 use self::TypeVariableValue::*;
 use self::UndoEntry::*;
-use middle::def_id::{DefId};
+use hir::def_id::{DefId};
 use ty::{self, Ty};
 use syntax::codemap::Span;
 
diff --git a/src/librustc/lib.rs b/src/librustc/lib.rs
index 03a08231c74..deb20627772 100644
--- a/src/librustc/lib.rs
+++ b/src/librustc/lib.rs
@@ -38,6 +38,7 @@
 #![feature(rustc_private)]
 #![feature(slice_patterns)]
 #![feature(staged_api)]
+#![feature(step_by)]
 #![feature(str_char)]
 #![feature(question_mark)]
 #![cfg_attr(test, feature(test))]
@@ -51,7 +52,6 @@ extern crate graphviz;
 extern crate libc;
 extern crate rbml;
 extern crate rustc_back;
-extern crate rustc_front;
 extern crate rustc_data_structures;
 extern crate serialize;
 extern crate collections;
@@ -72,19 +72,9 @@ mod macros;
 // registered before they are used.
 pub mod diagnostics;
 
-pub mod back {
-    pub use rustc_back::rpath;
-    pub use rustc_back::svh;
-}
-
 pub mod cfg;
 pub mod dep_graph;
-
-pub mod front {
-    pub mod check_attr;
-    pub mod map;
-}
-
+pub mod hir;
 pub mod infer;
 pub mod lint;
 
@@ -96,8 +86,6 @@ pub mod middle {
     pub mod cstore;
     pub mod dataflow;
     pub mod dead;
-    pub mod def;
-    pub mod def_id;
     pub mod dependency_format;
     pub mod effect;
     pub mod entry;
@@ -106,7 +94,6 @@ pub mod middle {
     pub mod lang_items;
     pub mod liveness;
     pub mod mem_categorization;
-    pub mod pat_util;
     pub mod privacy;
     pub mod reachable;
     pub mod region;
diff --git a/src/librustc/lint/context.rs b/src/librustc/lint/context.rs
index e78ff513ac4..1c6dd265889 100644
--- a/src/librustc/lint/context.rs
+++ b/src/librustc/lint/context.rs
@@ -39,16 +39,15 @@ use std::cell::RefCell;
 use std::cmp;
 use std::default::Default as StdDefault;
 use std::mem;
-use syntax::ast_util::{self, IdVisitingOperation};
 use syntax::attr::{self, AttrMetaMethods};
 use syntax::codemap::Span;
 use syntax::errors::DiagnosticBuilder;
 use syntax::parse::token::InternedString;
 use syntax::ast;
 use syntax::attr::ThinAttributesExt;
-use rustc_front::hir;
-use rustc_front::util;
-use rustc_front::intravisit as hir_visit;
+use hir;
+use hir::intravisit as hir_visit;
+use hir::intravisit::{IdVisitor, IdVisitingOperation};
 use syntax::visit as ast_visit;
 
 /// Information about the registered lints.
@@ -654,16 +653,6 @@ impl<'a> EarlyContext<'a> {
             level_stack: vec![],
         }
     }
-
-    fn visit_ids<F>(&mut self, f: F)
-        where F: FnOnce(&mut ast_util::IdVisitor<EarlyContext>)
-    {
-        let mut v = ast_util::IdVisitor {
-            operation: self,
-            visited_outermost: false,
-        };
-        f(&mut v);
-    }
 }
 
 impl<'a, 'tcx> LateContext<'a, 'tcx> {
@@ -685,9 +674,9 @@ impl<'a, 'tcx> LateContext<'a, 'tcx> {
     }
 
     fn visit_ids<F>(&mut self, f: F)
-        where F: FnOnce(&mut util::IdVisitor<LateContext>)
+        where F: FnOnce(&mut IdVisitor<LateContext>)
     {
-        let mut v = util::IdVisitor::new(self);
+        let mut v = IdVisitor::new(self);
         f(&mut v);
     }
 }
@@ -928,7 +917,6 @@ impl<'a, 'v> ast_visit::Visitor<'v> for EarlyContext<'a> {
     fn visit_item(&mut self, it: &ast::Item) {
         self.with_lint_attrs(&it.attrs, |cx| {
             run_lints!(cx, check_item, early_passes, it);
-            cx.visit_ids(|v| v.visit_item(it));
             ast_visit::walk_item(cx, it);
             run_lints!(cx, check_item_post, early_passes, it);
         })
@@ -978,7 +966,7 @@ impl<'a, 'v> ast_visit::Visitor<'v> for EarlyContext<'a> {
     }
 
     fn visit_struct_field(&mut self, s: &ast::StructField) {
-        self.with_lint_attrs(&s.node.attrs, |cx| {
+        self.with_lint_attrs(&s.attrs, |cx| {
             run_lints!(cx, check_struct_field, early_passes, s);
             ast_visit::walk_struct_field(cx, s);
         })
@@ -1042,7 +1030,6 @@ impl<'a, 'v> ast_visit::Visitor<'v> for EarlyContext<'a> {
     fn visit_trait_item(&mut self, trait_item: &ast::TraitItem) {
         self.with_lint_attrs(&trait_item.attrs, |cx| {
             run_lints!(cx, check_trait_item, early_passes, trait_item);
-            cx.visit_ids(|v| v.visit_trait_item(trait_item));
             ast_visit::walk_trait_item(cx, trait_item);
             run_lints!(cx, check_trait_item_post, early_passes, trait_item);
         });
@@ -1051,7 +1038,6 @@ impl<'a, 'v> ast_visit::Visitor<'v> for EarlyContext<'a> {
     fn visit_impl_item(&mut self, impl_item: &ast::ImplItem) {
         self.with_lint_attrs(&impl_item.attrs, |cx| {
             run_lints!(cx, check_impl_item, early_passes, impl_item);
-            cx.visit_ids(|v| v.visit_impl_item(impl_item));
             ast_visit::walk_impl_item(cx, impl_item);
             run_lints!(cx, check_impl_item_post, early_passes, impl_item);
         });
@@ -1099,18 +1085,6 @@ impl<'a, 'tcx> IdVisitingOperation for LateContext<'a, 'tcx> {
         }
     }
 }
-impl<'a> IdVisitingOperation for EarlyContext<'a> {
-    fn visit_id(&mut self, id: ast::NodeId) {
-        match self.sess.lints.borrow_mut().remove(&id) {
-            None => {}
-            Some(lints) => {
-                for (lint_id, span, msg) in lints {
-                    self.span_lint(lint_id.lint, span, &msg[..])
-                }
-            }
-        }
-    }
-}
 
 // This lint pass is defined here because it touches parts of the `LateContext`
 // that we don't want to expose. It records the lint level at certain AST
@@ -1292,11 +1266,12 @@ pub fn check_ast_crate(sess: &Session, krate: &ast::Crate) {
 
     // Visit the whole crate.
     cx.with_lint_attrs(&krate.attrs, |cx| {
-        cx.visit_id(ast::CRATE_NODE_ID);
-        cx.visit_ids(|v| {
-            v.visited_outermost = true;
-            ast_visit::walk_crate(v, krate);
-        });
+        // Lints may be assigned to the whole crate.
+        if let Some(lints) = cx.sess.lints.borrow_mut().remove(&ast::CRATE_NODE_ID) {
+            for (lint_id, span, msg) in lints {
+                cx.span_lint(lint_id.lint, span, &msg[..])
+            }
+        }
 
         // since the root module isn't visited as an item (because it isn't an
         // item), warn for it here.
diff --git a/src/librustc/lint/mod.rs b/src/librustc/lint/mod.rs
index 133d0163a8c..28994e1a7c4 100644
--- a/src/librustc/lint/mod.rs
+++ b/src/librustc/lint/mod.rs
@@ -34,10 +34,10 @@ pub use self::LintSource::*;
 use std::hash;
 use std::ascii::AsciiExt;
 use syntax::codemap::Span;
-use rustc_front::intravisit::FnKind;
+use hir::intravisit::FnKind;
 use syntax::visit as ast_visit;
 use syntax::ast;
-use rustc_front::hir;
+use hir;
 
 pub use lint::context::{LateContext, EarlyContext, LintContext, LintStore,
                         raw_emit_lint, check_crate, check_ast_crate, gather_attrs,
diff --git a/src/librustc/middle/astconv_util.rs b/src/librustc/middle/astconv_util.rs
index b86d74545cb..2a27732b953 100644
--- a/src/librustc/middle/astconv_util.rs
+++ b/src/librustc/middle/astconv_util.rs
@@ -14,11 +14,11 @@
  * Almost certainly this could (and should) be refactored out of existence.
  */
 
-use middle::def::Def;
+use hir::def::Def;
 use ty::{Ty, TyCtxt};
 
 use syntax::codemap::Span;
-use rustc_front::hir as ast;
+use hir as ast;
 
 pub fn prohibit_type_params(tcx: &TyCtxt, segments: &[ast::PathSegment]) {
     for segment in segments {
diff --git a/src/librustc/middle/const_val.rs b/src/librustc/middle/const_val.rs
index a939389c460..3621cb267d9 100644
--- a/src/librustc/middle/const_val.rs
+++ b/src/librustc/middle/const_val.rs
@@ -11,7 +11,7 @@
 use syntax::parse::token::InternedString;
 use syntax::ast;
 use std::rc::Rc;
-use middle::def_id::DefId;
+use hir::def_id::DefId;
 use std::hash;
 use std::mem::transmute;
 use rustc_const_math::*;
diff --git a/src/librustc/middle/cstore.rs b/src/librustc/middle/cstore.rs
index 4efb40abdb0..1f6328187a5 100644
--- a/src/librustc/middle/cstore.rs
+++ b/src/librustc/middle/cstore.rs
@@ -22,12 +22,12 @@
 // are *mostly* used as a part of that interface, but these should
 // probably get a better home if someone can find one.
 
-use back::svh::Svh;
-use front::map as hir_map;
-use middle::def::{self, Def};
+use hir::svh::Svh;
+use hir::map as hir_map;
+use hir::def::{self, Def};
 use middle::lang_items;
 use ty::{self, Ty, TyCtxt, VariantKind};
-use middle::def_id::{DefId, DefIndex};
+use hir::def_id::{DefId, DefIndex};
 use mir::repr::Mir;
 use mir::mir_map::MirMap;
 use session::Session;
@@ -38,15 +38,13 @@ use std::cell::RefCell;
 use std::rc::Rc;
 use std::path::PathBuf;
 use syntax::ast;
-use syntax::ast_util::{IdVisitingOperation};
 use syntax::attr;
 use syntax::codemap::Span;
 use syntax::ptr::P;
 use syntax::parse::token::InternedString;
 use rustc_back::target::Target;
-use rustc_front::hir;
-use rustc_front::intravisit::Visitor;
-use rustc_front::util::IdVisitor;
+use hir;
+use hir::intravisit::{IdVisitor, IdVisitingOperation, Visitor};
 
 pub use self::DefLike::{DlDef, DlField, DlImpl};
 pub use self::NativeLibraryKind::{NativeStatic, NativeFramework, NativeUnknown};
@@ -168,9 +166,7 @@ pub trait CrateStore<'tcx> : Any {
     fn repr_attrs(&self, def: DefId) -> Vec<attr::ReprAttr>;
     fn item_type(&self, tcx: &TyCtxt<'tcx>, def: DefId)
                  -> ty::TypeScheme<'tcx>;
-    fn relative_item_path(&self, def: DefId) -> Vec<hir_map::PathElem>;
     fn visible_parent_map<'a>(&'a self) -> ::std::cell::RefMut<'a, DefIdMap<DefId>>;
-    fn extern_item_path(&self, def: DefId) -> Vec<hir_map::PathElem>;
     fn item_name(&self, def: DefId) -> ast::Name;
     fn item_predicates(&self, tcx: &TyCtxt<'tcx>, def: DefId)
                        -> ty::GenericPredicates<'tcx>;
@@ -347,12 +343,9 @@ impl<'tcx> CrateStore<'tcx> for DummyCrateStore {
     fn repr_attrs(&self, def: DefId) -> Vec<attr::ReprAttr> { bug!("repr_attrs") }
     fn item_type(&self, tcx: &TyCtxt<'tcx>, def: DefId)
                  -> ty::TypeScheme<'tcx> { bug!("item_type") }
-    fn relative_item_path(&self, def: DefId)
-                          -> Vec<hir_map::PathElem> { bug!("relative_item_path") }
     fn visible_parent_map<'a>(&'a self) -> ::std::cell::RefMut<'a, DefIdMap<DefId>> {
         bug!("visible_parent_map")
     }
-    fn extern_item_path(&self, def: DefId) -> Vec<hir_map::PathElem> { bug!("extern_item_path") }
     fn item_name(&self, def: DefId) -> ast::Name { bug!("item_name") }
     fn item_predicates(&self, tcx: &TyCtxt<'tcx>, def: DefId)
                        -> ty::GenericPredicates<'tcx> { bug!("item_predicates") }
@@ -506,7 +499,7 @@ pub mod tls {
     use std::mem;
     use ty::{self, Ty, TyCtxt};
     use ty::subst::Substs;
-    use middle::def_id::DefId;
+    use hir::def_id::DefId;
 
     pub trait EncodingContext<'tcx> {
         fn tcx<'a>(&'a self) -> &'a TyCtxt<'tcx>;
diff --git a/src/librustc/middle/dataflow.rs b/src/librustc/middle/dataflow.rs
index 6468187e219..1aaaa4bcd77 100644
--- a/src/librustc/middle/dataflow.rs
+++ b/src/librustc/middle/dataflow.rs
@@ -21,13 +21,12 @@ use std::io;
 use std::mem;
 use std::usize;
 use syntax::ast;
-use syntax::ast_util::IdRange;
 use syntax::print::pp;
 use syntax::print::pprust::PrintState;
 use util::nodemap::NodeMap;
-use rustc_front::hir;
-use rustc_front::intravisit;
-use rustc_front::print::pprust;
+use hir;
+use hir::intravisit::{self, IdRange};
+use hir::print as pprust;
 
 
 #[derive(Copy, Clone, Debug)]
diff --git a/src/librustc/middle/dead.rs b/src/librustc/middle/dead.rs
index 18bea745858..dcdc02c9df6 100644
--- a/src/librustc/middle/dead.rs
+++ b/src/librustc/middle/dead.rs
@@ -13,14 +13,14 @@
 // from live codes are live, and everything else is dead.
 
 use dep_graph::DepNode;
-use front::map as ast_map;
-use rustc_front::hir::{self, PatKind};
-use rustc_front::intravisit::{self, Visitor};
+use hir::map as ast_map;
+use hir::{self, pat_util, PatKind};
+use hir::intravisit::{self, Visitor};
 
-use middle::{pat_util, privacy};
+use middle::privacy;
 use ty::{self, TyCtxt};
-use middle::def::Def;
-use middle::def_id::{DefId};
+use hir::def::Def;
+use hir::def_id::{DefId};
 use lint;
 
 use std::collections::HashSet;
diff --git a/src/librustc/middle/effect.rs b/src/librustc/middle/effect.rs
index fa949073f4e..ac7a1b8aa0d 100644
--- a/src/librustc/middle/effect.rs
+++ b/src/librustc/middle/effect.rs
@@ -13,15 +13,15 @@
 use self::RootUnsafeContext::*;
 
 use dep_graph::DepNode;
-use middle::def::Def;
+use hir::def::Def;
 use ty::{self, Ty, TyCtxt};
 use ty::MethodCall;
 
 use syntax::ast;
 use syntax::codemap::Span;
-use rustc_front::hir;
-use rustc_front::intravisit;
-use rustc_front::intravisit::{FnKind, Visitor};
+use hir;
+use hir::intravisit;
+use hir::intravisit::{FnKind, Visitor};
 
 #[derive(Copy, Clone)]
 struct UnsafeContext {
diff --git a/src/librustc/middle/entry.rs b/src/librustc/middle/entry.rs
index 67e96816abf..602889375e9 100644
--- a/src/librustc/middle/entry.rs
+++ b/src/librustc/middle/entry.rs
@@ -10,15 +10,15 @@
 
 
 use dep_graph::DepNode;
-use front::map as ast_map;
-use middle::def_id::{CRATE_DEF_INDEX};
+use hir::map as ast_map;
+use hir::def_id::{CRATE_DEF_INDEX};
 use session::{config, Session};
 use syntax::ast::NodeId;
 use syntax::attr;
 use syntax::codemap::Span;
 use syntax::entry::EntryPointType;
-use rustc_front::hir::{Item, ItemFn};
-use rustc_front::intravisit::Visitor;
+use hir::{Item, ItemFn};
+use hir::intravisit::Visitor;
 
 struct EntryContext<'a, 'tcx: 'a> {
     session: &'a Session,
diff --git a/src/librustc/middle/expr_use_visitor.rs b/src/librustc/middle/expr_use_visitor.rs
index bfc96005bc8..c4d6f100671 100644
--- a/src/librustc/middle/expr_use_visitor.rs
+++ b/src/librustc/middle/expr_use_visitor.rs
@@ -19,14 +19,14 @@ pub use self::MatchMode::*;
 use self::TrackMatchMode::*;
 use self::OverloadedCallType::*;
 
-use middle::pat_util;
-use middle::def::Def;
-use middle::def_id::{DefId};
+use hir::pat_util;
+use hir::def::Def;
+use hir::def_id::{DefId};
 use infer;
 use middle::mem_categorization as mc;
 use ty::{self, TyCtxt, adjustment};
 
-use rustc_front::hir::{self, PatKind};
+use hir::{self, PatKind};
 
 use syntax::ast;
 use syntax::ptr::P;
@@ -479,7 +479,7 @@ impl<'d,'t,'a,'tcx> ExprUseVisitor<'d,'t,'a,'tcx> {
             }
 
             hir::ExprUnary(op, ref lhs) => {
-                let pass_args = if ::rustc_front::util::is_by_value_unop(op) {
+                let pass_args = if op.is_by_value() {
                     PassArgs::ByValue
                 } else {
                     PassArgs::ByRef
@@ -491,7 +491,7 @@ impl<'d,'t,'a,'tcx> ExprUseVisitor<'d,'t,'a,'tcx> {
             }
 
             hir::ExprBinary(op, ref lhs, ref rhs) => {
-                let pass_args = if ::rustc_front::util::is_by_value_binop(op.node) {
+                let pass_args = if op.node.is_by_value() {
                     PassArgs::ByValue
                 } else {
                     PassArgs::ByRef
@@ -524,7 +524,7 @@ impl<'d,'t,'a,'tcx> ExprUseVisitor<'d,'t,'a,'tcx> {
 
             hir::ExprAssignOp(op, ref lhs, ref rhs) => {
                 // NB All our assignment operations take the RHS by value
-                assert!(::rustc_front::util::is_by_value_binop(op.node));
+                assert!(op.node.is_by_value());
 
                 if !self.walk_overloaded_operator(expr, lhs, vec![rhs], PassArgs::ByValue) {
                     self.mutate_expr(expr, &lhs, MutateMode::WriteAndRead);
diff --git a/src/librustc/middle/intrinsicck.rs b/src/librustc/middle/intrinsicck.rs
index fd74ccac975..767c5adc81e 100644
--- a/src/librustc/middle/intrinsicck.rs
+++ b/src/librustc/middle/intrinsicck.rs
@@ -9,8 +9,8 @@
 // except according to those terms.
 
 use dep_graph::DepNode;
-use middle::def::Def;
-use middle::def_id::DefId;
+use hir::def::Def;
+use hir::def_id::DefId;
 use ty::subst::{Subst, Substs, EnumeratedItems};
 use ty::{TransmuteRestriction, TyCtxt};
 use ty::{self, Ty, TypeFoldable};
@@ -20,8 +20,8 @@ use std::fmt;
 use syntax::abi::Abi::RustIntrinsic;
 use syntax::ast;
 use syntax::codemap::Span;
-use rustc_front::intravisit::{self, Visitor, FnKind};
-use rustc_front::hir;
+use hir::intravisit::{self, Visitor, FnKind};
+use hir;
 
 pub fn check_crate(tcx: &TyCtxt) {
     let mut visitor = IntrinsicCheckingVisitor {
diff --git a/src/librustc/middle/lang_items.rs b/src/librustc/middle/lang_items.rs
index bb0b8ed91df..86531ced8df 100644
--- a/src/librustc/middle/lang_items.rs
+++ b/src/librustc/middle/lang_items.rs
@@ -22,10 +22,10 @@
 pub use self::LangItem::*;
 
 use dep_graph::DepNode;
-use front::map as hir_map;
+use hir::map as hir_map;
 use session::Session;
 use middle::cstore::CrateStore;
-use middle::def_id::DefId;
+use hir::def_id::DefId;
 use ty;
 use middle::weak_lang_items;
 use util::nodemap::FnvHashMap;
@@ -33,8 +33,8 @@ use util::nodemap::FnvHashMap;
 use syntax::ast;
 use syntax::attr::AttrMetaMethods;
 use syntax::parse::token::InternedString;
-use rustc_front::intravisit::Visitor;
-use rustc_front::hir;
+use hir::intravisit::Visitor;
+use hir;
 
 // The actual lang items defined come at the end of this file in one handy table.
 // So you probably just want to nip down to the end.
diff --git a/src/librustc/middle/liveness.rs b/src/librustc/middle/liveness.rs
index 4451e7ac472..35991ae56c8 100644
--- a/src/librustc/middle/liveness.rs
+++ b/src/librustc/middle/liveness.rs
@@ -110,8 +110,8 @@ use self::LiveNodeKind::*;
 use self::VarKind::*;
 
 use dep_graph::DepNode;
-use middle::def::*;
-use middle::pat_util;
+use hir::def::*;
+use hir::pat_util;
 use ty::{self, TyCtxt, ParameterEnvironment};
 use traits::{self, ProjectionMode};
 use infer;
@@ -128,10 +128,10 @@ use syntax::codemap::{BytePos, original_sp, Span};
 use syntax::parse::token::special_idents;
 use syntax::ptr::P;
 
-use rustc_front::hir::Expr;
-use rustc_front::hir;
-use rustc_front::print::pprust::{expr_to_string, block_to_string};
-use rustc_front::intravisit::{self, Visitor, FnKind};
+use hir::Expr;
+use hir;
+use hir::print::{expr_to_string, block_to_string};
+use hir::intravisit::{self, Visitor, FnKind};
 
 /// For use with `propagate_through_loop`.
 enum LoopKind<'a> {
@@ -484,7 +484,7 @@ fn visit_expr(ir: &mut IrMaps, expr: &Expr) {
         ir.add_live_node_for_node(expr.id, ExprNode(expr.span));
         intravisit::walk_expr(ir, expr);
       }
-      hir::ExprBinary(op, _, _) if ::rustc_front::util::lazy_binop(op.node) => {
+      hir::ExprBinary(op, _, _) if op.node.is_lazy() => {
         ir.add_live_node_for_node(expr.id, ExprNode(expr.span));
         intravisit::walk_expr(ir, expr);
       }
@@ -1142,7 +1142,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
             self.propagate_through_exprs(&exprs[..], succ)
           }
 
-          hir::ExprBinary(op, ref l, ref r) if ::rustc_front::util::lazy_binop(op.node) => {
+          hir::ExprBinary(op, ref l, ref r) if op.node.is_lazy() => {
             let r_succ = self.propagate_through_expr(&r, succ);
 
             let ln = self.live_node(expr.id, expr.span);
diff --git a/src/librustc/middle/mem_categorization.rs b/src/librustc/middle/mem_categorization.rs
index ef031ad13f1..2f77552c389 100644
--- a/src/librustc/middle/mem_categorization.rs
+++ b/src/librustc/middle/mem_categorization.rs
@@ -71,16 +71,16 @@ pub use self::deref_kind::*;
 
 use self::Aliasability::*;
 
-use middle::def_id::DefId;
-use front::map as ast_map;
+use hir::def_id::DefId;
+use hir::map as ast_map;
 use infer;
 use middle::const_qualif::ConstQualif;
-use middle::def::Def;
+use hir::def::Def;
 use ty::adjustment;
 use ty::{self, Ty, TyCtxt};
 
-use rustc_front::hir::{MutImmutable, MutMutable, PatKind};
-use rustc_front::hir;
+use hir::{MutImmutable, MutMutable, PatKind};
+use hir;
 use syntax::ast;
 use syntax::codemap::Span;
 
diff --git a/src/librustc/middle/reachable.rs b/src/librustc/middle/reachable.rs
index 149e895717c..63bccc2d02e 100644
--- a/src/librustc/middle/reachable.rs
+++ b/src/librustc/middle/reachable.rs
@@ -16,9 +16,9 @@
 // reachable as well.
 
 use dep_graph::DepNode;
-use front::map as ast_map;
-use middle::def::Def;
-use middle::def_id::DefId;
+use hir::map as ast_map;
+use hir::def::Def;
+use hir::def_id::DefId;
 use ty::{self, TyCtxt};
 use middle::privacy;
 use session::config;
@@ -28,9 +28,9 @@ use std::collections::HashSet;
 use syntax::abi::Abi;
 use syntax::ast;
 use syntax::attr;
-use rustc_front::hir;
-use rustc_front::intravisit::Visitor;
-use rustc_front::intravisit;
+use hir;
+use hir::intravisit::Visitor;
+use hir::intravisit;
 
 // Returns true if the given set of generics implies that the item it's
 // associated with must be inlined.
diff --git a/src/librustc/middle/region.rs b/src/librustc/middle/region.rs
index 2cde6ce9320..f8c0b63bf11 100644
--- a/src/librustc/middle/region.rs
+++ b/src/librustc/middle/region.rs
@@ -17,7 +17,7 @@
 //! `middle/infer/region_inference/README.md`
 
 use dep_graph::DepNode;
-use front::map as ast_map;
+use hir::map as ast_map;
 use session::Session;
 use util::nodemap::{FnvHashMap, NodeMap, NodeSet};
 use middle::cstore::InlinedItem;
@@ -30,10 +30,9 @@ use std::mem;
 use syntax::codemap::{self, Span};
 use syntax::ast::{self, NodeId};
 
-use rustc_front::hir;
-use rustc_front::intravisit::{self, Visitor, FnKind};
-use rustc_front::hir::{Block, Item, FnDecl, Arm, Pat, PatKind, Stmt, Expr, Local};
-use rustc_front::util::stmt_id;
+use hir;
+use hir::intravisit::{self, Visitor, FnKind};
+use hir::{Block, Item, FnDecl, Arm, Pat, PatKind, Stmt, Expr, Local};
 
 #[derive(Clone, PartialEq, PartialOrd, Eq, Ord, Hash, RustcEncodable,
            RustcDecodable, Copy)]
@@ -765,7 +764,7 @@ fn resolve_pat(visitor: &mut RegionResolutionVisitor, pat: &hir::Pat) {
 }
 
 fn resolve_stmt(visitor: &mut RegionResolutionVisitor, stmt: &hir::Stmt) {
-    let stmt_id = stmt_id(stmt);
+    let stmt_id = stmt.node.id();
     debug!("resolve_stmt(stmt.id={:?})", stmt_id);
 
     // Every statement will clean up the temporaries created during
diff --git a/src/librustc/middle/resolve_lifetime.rs b/src/librustc/middle/resolve_lifetime.rs
index d3757629d30..585b65b9f5e 100644
--- a/src/librustc/middle/resolve_lifetime.rs
+++ b/src/librustc/middle/resolve_lifetime.rs
@@ -19,9 +19,9 @@ pub use self::DefRegion::*;
 use self::ScopeChain::*;
 
 use dep_graph::DepNode;
-use front::map::Map;
+use hir::map::Map;
 use session::Session;
-use middle::def::{Def, DefMap};
+use hir::def::{Def, DefMap};
 use middle::region;
 use ty::subst;
 use ty;
@@ -32,9 +32,9 @@ use syntax::codemap::Span;
 use syntax::parse::token::special_idents;
 use util::nodemap::NodeMap;
 
-use rustc_front::hir;
-use rustc_front::print::pprust::lifetime_to_string;
-use rustc_front::intravisit::{self, Visitor, FnKind};
+use hir;
+use hir::print::lifetime_to_string;
+use hir::intravisit::{self, Visitor, FnKind};
 
 #[derive(Clone, Copy, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable, Debug)]
 pub enum DefRegion {
diff --git a/src/librustc/middle/stability.rs b/src/librustc/middle/stability.rs
index e589743222b..6c7c7f160f4 100644
--- a/src/librustc/middle/stability.rs
+++ b/src/librustc/middle/stability.rs
@@ -14,12 +14,12 @@
 pub use self::StabilityLevel::*;
 
 use dep_graph::DepNode;
-use front::map as hir_map;
+use hir::map as hir_map;
 use session::Session;
 use lint;
 use middle::cstore::{CrateStore, LOCAL_CRATE};
-use middle::def::Def;
-use middle::def_id::{CRATE_DEF_INDEX, DefId};
+use hir::def::Def;
+use hir::def_id::{CRATE_DEF_INDEX, DefId};
 use ty::{self, TyCtxt};
 use middle::privacy::AccessLevels;
 use syntax::parse::token::InternedString;
@@ -30,9 +30,9 @@ use syntax::feature_gate::{GateIssue, emit_feature_err};
 use syntax::attr::{self, Stability, Deprecation, AttrMetaMethods};
 use util::nodemap::{DefIdMap, FnvHashSet, FnvHashMap};
 
-use rustc_front::hir;
-use rustc_front::hir::{Item, Generics, StructField, Variant, PatKind};
-use rustc_front::intravisit::{self, Visitor};
+use hir;
+use hir::{Item, Generics, StructField, Variant, PatKind};
+use hir::intravisit::{self, Visitor};
 
 use std::mem::replace;
 use std::cmp::Ordering;
diff --git a/src/librustc/middle/weak_lang_items.rs b/src/librustc/middle/weak_lang_items.rs
index 6059d7ee74e..74bb41785cb 100644
--- a/src/librustc/middle/weak_lang_items.rs
+++ b/src/librustc/middle/weak_lang_items.rs
@@ -18,9 +18,9 @@ use middle::lang_items;
 use syntax::ast;
 use syntax::codemap::Span;
 use syntax::parse::token::InternedString;
-use rustc_front::intravisit::Visitor;
-use rustc_front::intravisit;
-use rustc_front::hir;
+use hir::intravisit::Visitor;
+use hir::intravisit;
+use hir;
 
 use std::collections::HashSet;
 
diff --git a/src/librustc/mir/repr.rs b/src/librustc/mir/repr.rs
index a33ee6bd204..28437fa1336 100644
--- a/src/librustc/mir/repr.rs
+++ b/src/librustc/mir/repr.rs
@@ -11,12 +11,12 @@
 use graphviz::IntoCow;
 use middle::const_val::ConstVal;
 use rustc_const_math::{ConstUsize, ConstInt};
-use middle::def_id::DefId;
+use hir::def_id::DefId;
 use ty::subst::Substs;
 use ty::{self, AdtDef, ClosureSubsts, FnOutput, Region, Ty};
 use util::ppaux;
 use rustc_back::slice;
-use rustc_front::hir::InlineAsm;
+use hir::InlineAsm;
 use std::ascii;
 use std::borrow::{Cow};
 use std::fmt::{self, Debug, Formatter, Write};
diff --git a/src/librustc/mir/tcx.rs b/src/librustc/mir/tcx.rs
index ecac5d2f73f..d710417bf20 100644
--- a/src/librustc/mir/tcx.rs
+++ b/src/librustc/mir/tcx.rs
@@ -17,7 +17,7 @@ use mir::repr::*;
 use ty::subst::{Subst, Substs};
 use ty::{self, AdtDef, Ty, TyCtxt};
 use ty::fold::{TypeFoldable, TypeFolder, TypeVisitor};
-use rustc_front::hir;
+use hir;
 
 #[derive(Copy, Clone, Debug)]
 pub enum LvalueTy<'tcx> {
diff --git a/src/librustc/mir/visit.rs b/src/librustc/mir/visit.rs
index 403c749fe4b..ae803f50231 100644
--- a/src/librustc/mir/visit.rs
+++ b/src/librustc/mir/visit.rs
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 use middle::const_val::ConstVal;
-use middle::def_id::DefId;
+use hir::def_id::DefId;
 use ty::subst::Substs;
 use ty::{ClosureSubsts, FnOutput, Region, Ty};
 use mir::repr::*;
diff --git a/src/librustc/traits/coherence.rs b/src/librustc/traits/coherence.rs
index a0ac5148526..6710d2a653c 100644
--- a/src/librustc/traits/coherence.rs
+++ b/src/librustc/traits/coherence.rs
@@ -13,7 +13,7 @@
 use super::{SelectionContext, Obligation, ObligationCause};
 
 use middle::cstore::LOCAL_CRATE;
-use middle::def_id::DefId;
+use hir::def_id::DefId;
 use ty::subst::TypeSpace;
 use ty::{self, Ty, TyCtxt};
 use infer::{self, InferCtxt, TypeOrigin};
diff --git a/src/librustc/traits/error_reporting.rs b/src/librustc/traits/error_reporting.rs
index f15b9ee44ce..9357dda2583 100644
--- a/src/librustc/traits/error_reporting.rs
+++ b/src/librustc/traits/error_reporting.rs
@@ -24,7 +24,7 @@ use super::{
 };
 
 use fmt_macros::{Parser, Piece, Position};
-use middle::def_id::DefId;
+use hir::def_id::DefId;
 use infer::InferCtxt;
 use ty::{self, ToPredicate, ToPolyTraitRef, TraitRef, Ty, TyCtxt, TypeFoldable};
 use ty::fast_reject;
diff --git a/src/librustc/traits/mod.rs b/src/librustc/traits/mod.rs
index 867bd054fa9..a160465e2e8 100644
--- a/src/librustc/traits/mod.rs
+++ b/src/librustc/traits/mod.rs
@@ -15,7 +15,7 @@ pub use self::FulfillmentErrorCode::*;
 pub use self::Vtable::*;
 pub use self::ObligationCauseCode::*;
 
-use middle::def_id::DefId;
+use hir::def_id::DefId;
 use middle::free_region::FreeRegionMap;
 use ty::subst;
 use ty::{self, Ty, TypeFoldable};
diff --git a/src/librustc/traits/object_safety.rs b/src/librustc/traits/object_safety.rs
index 7cd2ac5938d..9af2cfbd04d 100644
--- a/src/librustc/traits/object_safety.rs
+++ b/src/librustc/traits/object_safety.rs
@@ -20,7 +20,7 @@
 use super::supertraits;
 use super::elaborate_predicates;
 
-use middle::def_id::DefId;
+use hir::def_id::DefId;
 use ty::subst::{self, SelfSpace, TypeSpace};
 use traits;
 use ty::{self, ToPolyTraitRef, Ty, TyCtxt, TypeFoldable};
diff --git a/src/librustc/traits/project.rs b/src/librustc/traits/project.rs
index d4d61ec0244..a0d6f5f912b 100644
--- a/src/librustc/traits/project.rs
+++ b/src/librustc/traits/project.rs
@@ -23,7 +23,7 @@ use super::VtableClosureData;
 use super::VtableImplData;
 use super::util;
 
-use middle::def_id::DefId;
+use hir::def_id::DefId;
 use infer::{self, InferOk, TypeOrigin};
 use ty::subst::Subst;
 use ty::{self, ToPredicate, ToPolyTraitRef, Ty, TyCtxt};
diff --git a/src/librustc/traits/select.rs b/src/librustc/traits/select.rs
index f68386feddb..8d7df6e44ae 100644
--- a/src/librustc/traits/select.rs
+++ b/src/librustc/traits/select.rs
@@ -36,7 +36,7 @@ use super::{VtableImplData, VtableObjectData, VtableBuiltinData,
 use super::object_safety;
 use super::util;
 
-use middle::def_id::DefId;
+use hir::def_id::DefId;
 use infer;
 use infer::{InferCtxt, InferOk, TypeFreshener, TypeOrigin};
 use ty::subst::{Subst, Substs, TypeSpace};
@@ -49,7 +49,7 @@ use std::cell::RefCell;
 use std::fmt;
 use std::rc::Rc;
 use syntax::abi::Abi;
-use rustc_front::hir;
+use hir;
 use util::common::ErrorReported;
 use util::nodemap::FnvHashMap;
 
diff --git a/src/librustc/traits/specialize/mod.rs b/src/librustc/traits/specialize/mod.rs
index 88f4129d886..63647515a97 100644
--- a/src/librustc/traits/specialize/mod.rs
+++ b/src/librustc/traits/specialize/mod.rs
@@ -21,7 +21,7 @@ use super::{SelectionContext, FulfillmentContext};
 use super::util::{fresh_type_vars_for_impl, impl_trait_ref_and_oblig};
 
 use middle::cstore::CrateStore;
-use middle::def_id::DefId;
+use hir::def_id::DefId;
 use infer::{self, InferCtxt, TypeOrigin};
 use middle::region;
 use ty::subst::{Subst, Substs};
diff --git a/src/librustc/traits/specialize/specialization_graph.rs b/src/librustc/traits/specialize/specialization_graph.rs
index d3146697ee6..51b0b6b8b38 100644
--- a/src/librustc/traits/specialize/specialization_graph.rs
+++ b/src/librustc/traits/specialize/specialization_graph.rs
@@ -14,7 +14,7 @@ use std::rc::Rc;
 use super::{Overlap, specializes};
 
 use middle::cstore::CrateStore;
-use middle::def_id::DefId;
+use hir::def_id::DefId;
 use infer;
 use traits::{self, ProjectionMode};
 use ty::{self, TyCtxt, ImplOrTraitItem, TraitDef, TypeFoldable};
diff --git a/src/librustc/traits/util.rs b/src/librustc/traits/util.rs
index befca878bc0..7668b8bf202 100644
--- a/src/librustc/traits/util.rs
+++ b/src/librustc/traits/util.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use middle::def_id::DefId;
+use hir::def_id::DefId;
 use infer::InferCtxt;
 use ty::subst::{Subst, Substs};
 use ty::{self, Ty, TyCtxt, ToPredicate, ToPolyTraitRef};
diff --git a/src/librustc/ty/adjustment.rs b/src/librustc/ty/adjustment.rs
index 90ccdeea928..41008823c85 100644
--- a/src/librustc/ty/adjustment.rs
+++ b/src/librustc/ty/adjustment.rs
@@ -17,7 +17,7 @@ use ty::LvaluePreference::{NoPreference};
 use syntax::ast;
 use syntax::codemap::Span;
 
-use rustc_front::hir;
+use hir;
 
 #[derive(Copy, Clone)]
 pub enum AutoAdjustment<'tcx> {
diff --git a/src/librustc/ty/contents.rs b/src/librustc/ty/contents.rs
index ba237184a9f..f5dedb13248 100644
--- a/src/librustc/ty/contents.rs
+++ b/src/librustc/ty/contents.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use middle::def_id::{DefId};
+use hir::def_id::{DefId};
 use ty::{self, Ty, TyCtxt};
 use util::common::MemoizationMap;
 use util::nodemap::FnvHashMap;
diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs
index 2074339f2e6..bdba700f49a 100644
--- a/src/librustc/ty/context.rs
+++ b/src/librustc/ty/context.rs
@@ -11,13 +11,13 @@
 //! type context book-keeping
 
 use dep_graph::{DepGraph, DepTrackingMap};
-use front::map as ast_map;
+use hir::map as ast_map;
 use session::Session;
 use lint;
 use middle;
 use middle::cstore::{CrateStore, LOCAL_CRATE};
-use middle::def::DefMap;
-use middle::def_id::DefId;
+use hir::def::DefMap;
+use hir::def_id::DefId;
 use middle::free_region::FreeRegionMap;
 use middle::region::RegionMaps;
 use middle::resolve_lifetime;
@@ -27,7 +27,7 @@ use traits;
 use ty::{self, TraitRef, Ty, TypeAndMut};
 use ty::{TyS, TypeVariants};
 use ty::{AdtDef, ClosureSubsts, ExistentialBounds, Region};
-use ty::{FreevarMap};
+use hir::FreevarMap;
 use ty::{BareFnTy, InferTy, ParamTy, ProjectionTy, TraitTy};
 use ty::{TyVar, TyVid, IntVar, IntVid, FloatVar, FloatVid};
 use ty::TypeVariants::*;
@@ -45,7 +45,7 @@ use syntax::ast::{self, Name, NodeId};
 use syntax::attr;
 use syntax::parse::token::{self, special_idents};
 
-use rustc_front::hir;
+use hir;
 
 /// Internal storage
 pub struct CtxtArenas<'tcx> {
diff --git a/src/librustc/ty/error.rs b/src/librustc/ty/error.rs
index 9ab48505828..73bafc5e850 100644
--- a/src/librustc/ty/error.rs
+++ b/src/librustc/ty/error.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use middle::def_id::DefId;
+use hir::def_id::DefId;
 use ty::subst;
 use infer::type_variable;
 use ty::{self, BoundRegion, Region, Ty, TyCtxt};
@@ -19,7 +19,7 @@ use syntax::ast::{self, Name};
 use syntax::codemap::Span;
 use syntax::errors::DiagnosticBuilder;
 
-use rustc_front::hir;
+use hir;
 
 #[derive(Clone, Copy, Debug)]
 pub struct ExpectedFound<T> {
diff --git a/src/librustc/ty/fast_reject.rs b/src/librustc/ty/fast_reject.rs
index 0865e059f59..29647253ad2 100644
--- a/src/librustc/ty/fast_reject.rs
+++ b/src/librustc/ty/fast_reject.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use middle::def_id::DefId;
+use hir::def_id::DefId;
 use ty::{self, Ty, TyCtxt};
 use syntax::ast;
 
diff --git a/src/librustc/ty/item_path.rs b/src/librustc/ty/item_path.rs
index caf7e6fe629..5c1e19aee7b 100644
--- a/src/librustc/ty/item_path.rs
+++ b/src/librustc/ty/item_path.rs
@@ -8,9 +8,9 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use front::map::DefPathData;
+use hir::map::DefPathData;
 use middle::cstore::LOCAL_CRATE;
-use middle::def_id::{DefId, CRATE_DEF_INDEX};
+use hir::def_id::{DefId, CRATE_DEF_INDEX};
 use ty::{self, Ty, TyCtxt};
 use syntax::ast;
 
@@ -24,6 +24,11 @@ impl<'tcx> TyCtxt<'tcx> {
         buffer.into_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))
+    }
+
     /// Returns a string identifying this def-id. This string is
     /// suitable for user output. It always begins with a crate identifier.
     pub fn absolute_item_path_str(&self, def_id: DefId) -> String {
diff --git a/src/librustc/ty/maps.rs b/src/librustc/ty/maps.rs
index 77b6b03e48f..65a96e79ff4 100644
--- a/src/librustc/ty/maps.rs
+++ b/src/librustc/ty/maps.rs
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 use dep_graph::{DepNode, DepTrackingMapConfig};
-use middle::def_id::DefId;
+use hir::def_id::DefId;
 use ty;
 use std::marker::PhantomData;
 use std::rc::Rc;
diff --git a/src/librustc/ty/mod.rs b/src/librustc/ty/mod.rs
index edfad09ae1f..444fea0918f 100644
--- a/src/librustc/ty/mod.rs
+++ b/src/librustc/ty/mod.rs
@@ -19,12 +19,11 @@ pub use self::LvaluePreference::*;
 pub use self::fold::TypeFoldable;
 
 use dep_graph::{self, DepNode};
-use front::map as ast_map;
-use front::map::LinkedPath;
+use hir::map as ast_map;
 use middle;
 use middle::cstore::{self, CrateStore, LOCAL_CRATE};
-use middle::def::{self, Def, ExportMap};
-use middle::def_id::DefId;
+use hir::def::{self, Def, ExportMap};
+use hir::def_id::DefId;
 use middle::lang_items::{FnTraitLangItem, FnMutTraitLangItem, FnOnceTraitLangItem};
 use middle::region::{CodeExtent};
 use traits;
@@ -33,7 +32,7 @@ use ty::fold::TypeFolder;
 use ty::subst::{Subst, Substs, VecPerParamSpace};
 use ty::walk::TypeWalker;
 use util::common::MemoizationMap;
-use util::nodemap::{NodeMap, NodeSet};
+use util::nodemap::NodeSet;
 use util::nodemap::FnvHashMap;
 
 use serialize::{Encodable, Encoder, Decodable, Decoder};
@@ -44,7 +43,6 @@ use std::iter;
 use std::rc::Rc;
 use std::slice;
 use std::vec::IntoIter;
-use std::collections::{HashMap, HashSet};
 use syntax::ast::{self, CrateNum, Name, NodeId};
 use syntax::attr::{self, AttrMetaMethods};
 use syntax::codemap::{DUMMY_SP, Span};
@@ -52,9 +50,9 @@ use syntax::parse::token::InternedString;
 
 use rustc_const_math::ConstInt;
 
-use rustc_front::hir;
-use rustc_front::hir::{ItemImpl, ItemTrait, PatKind};
-use rustc_front::intravisit::Visitor;
+use hir;
+use hir::{ItemImpl, ItemTrait, PatKind};
+use hir::intravisit::Visitor;
 
 pub use self::sty::{Binder, DebruijnIndex};
 pub use self::sty::{BuiltinBound, BuiltinBounds, ExistentialBounds};
@@ -115,7 +113,7 @@ pub struct CrateAnalysis<'a> {
     pub access_levels: middle::privacy::AccessLevels,
     pub reachable: NodeSet,
     pub name: &'a str,
-    pub glob_map: Option<GlobMap>,
+    pub glob_map: Option<hir::GlobMap>,
 }
 
 #[derive(Copy, Clone)]
@@ -2232,39 +2230,9 @@ impl<'tcx> TyCtxt<'tcx> {
         }
     }
 
-    pub fn with_path<T, F>(&self, id: DefId, f: F) -> T where
-        F: FnOnce(ast_map::PathElems) -> T,
-    {
-        if let Some(id) = self.map.as_local_node_id(id) {
-            self.map.with_path(id, f)
-        } else {
-            let mut path: Vec<_>;
-            if let Some(extern_crate) = self.sess.cstore.extern_crate(id.krate) {
-                if !extern_crate.direct {
-                    // this comes from some crate that we don't have a direct
-                    // path to; we'll settle for just prepending the name of
-                    // the crate.
-                    path = self.sess.cstore.extern_item_path(id)
-                } else {
-                    // start with the path to the extern crate, then
-                    // add the relative path to the actual item
-                    fn collector(elems: ast_map::PathElems) -> Vec<ast_map::PathElem> {
-                        elems.collect()
-                    }
-                    path = self.with_path(extern_crate.def_id, collector);
-                    path.extend(self.sess.cstore.relative_item_path(id));
-                }
-            } else {
-                // if this was injected, just make a path with name of crate
-                path = self.sess.cstore.extern_item_path(id);
-            }
-            f(path.iter().cloned().chain(LinkedPath::empty()))
-        }
-    }
-
     pub fn item_name(&self, id: DefId) -> ast::Name {
         if let Some(id) = self.map.as_local_node_id(id) {
-            self.map.get_path_elem(id).name()
+            self.map.name(id)
         } else {
             self.sess.cstore.item_name(id)
         }
@@ -2724,30 +2692,9 @@ pub enum ExplicitSelfCategory {
     ByBox,
 }
 
-/// A free variable referred to in a function.
-#[derive(Copy, Clone, RustcEncodable, RustcDecodable)]
-pub struct Freevar {
-    /// The variable being accessed free.
-    pub def: Def,
-
-    // First span where it is accessed (there can be multiple).
-    pub span: Span
-}
-
-pub type FreevarMap = NodeMap<Vec<Freevar>>;
-
-pub type CaptureModeMap = NodeMap<hir::CaptureClause>;
-
-// Trait method resolution
-pub type TraitMap = NodeMap<Vec<DefId>>;
-
-// Map from the NodeId of a glob import to a list of items which are actually
-// imported.
-pub type GlobMap = HashMap<NodeId, HashSet<Name>>;
-
 impl<'tcx> TyCtxt<'tcx> {
     pub fn with_freevars<T, F>(&self, fid: NodeId, f: F) -> T where
-        F: FnOnce(&[Freevar]) -> T,
+        F: FnOnce(&[hir::Freevar]) -> T,
     {
         match self.freevars.borrow().get(&fid) {
             None => f(&[]),
diff --git a/src/librustc/ty/relate.rs b/src/librustc/ty/relate.rs
index b39cb5ef939..f14e680e9e0 100644
--- a/src/librustc/ty/relate.rs
+++ b/src/librustc/ty/relate.rs
@@ -13,13 +13,13 @@
 //! can be other things. Examples of type relations are subtyping,
 //! type equality, etc.
 
-use middle::def_id::DefId;
+use hir::def_id::DefId;
 use ty::subst::{ParamSpace, Substs};
 use ty::{self, Ty, TyCtxt, TypeFoldable};
 use ty::error::{ExpectedFound, TypeError};
 use std::rc::Rc;
 use syntax::abi;
-use rustc_front::hir as ast;
+use hir as ast;
 
 pub type RelateResult<'tcx, T> = Result<T, TypeError<'tcx>>;
 
diff --git a/src/librustc/ty/structural_impls.rs b/src/librustc/ty/structural_impls.rs
index 82cc9e7f2e3..bbf6d0329b4 100644
--- a/src/librustc/ty/structural_impls.rs
+++ b/src/librustc/ty/structural_impls.rs
@@ -17,7 +17,7 @@ use std::rc::Rc;
 use syntax::abi;
 use syntax::ptr::P;
 
-use rustc_front::hir;
+use hir;
 
 ///////////////////////////////////////////////////////////////////////////
 // Lift implementations
diff --git a/src/librustc/ty/sty.rs b/src/librustc/ty/sty.rs
index fee0aaff445..c0fb60d4dd3 100644
--- a/src/librustc/ty/sty.rs
+++ b/src/librustc/ty/sty.rs
@@ -11,7 +11,7 @@
 //! This module contains TypeVariants and its major components
 
 use middle::cstore;
-use middle::def_id::DefId;
+use hir::def_id::DefId;
 use middle::region;
 use ty::subst::{self, Substs};
 use traits;
@@ -28,7 +28,7 @@ use syntax::parse::token::special_idents;
 
 use serialize::{Decodable, Decoder};
 
-use rustc_front::hir;
+use hir;
 
 use self::FnOutput::*;
 use self::InferTy::*;
diff --git a/src/librustc/ty/subst.rs b/src/librustc/ty/subst.rs
index 93157f28482..dd547da59e9 100644
--- a/src/librustc/ty/subst.rs
+++ b/src/librustc/ty/subst.rs
@@ -13,7 +13,7 @@
 pub use self::ParamSpace::*;
 
 use middle::cstore;
-use middle::def_id::DefId;
+use hir::def_id::DefId;
 use ty::{self, Ty, TyCtxt};
 use ty::fold::{TypeFoldable, TypeFolder};
 
diff --git a/src/librustc/ty/trait_def.rs b/src/librustc/ty/trait_def.rs
index 3ebf2ba4c84..94f4e31efc6 100644
--- a/src/librustc/ty/trait_def.rs
+++ b/src/librustc/ty/trait_def.rs
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 use dep_graph::DepNode;
-use middle::def_id::DefId;
+use hir::def_id::DefId;
 use traits::{self, specialization_graph};
 use ty;
 use ty::fast_reject;
@@ -17,7 +17,7 @@ use ty::{Ty, TyCtxt, TraitRef};
 use std::borrow::{Borrow};
 use std::cell::{Cell, Ref, RefCell};
 use syntax::ast::Name;
-use rustc_front::hir;
+use hir;
 use util::nodemap::FnvHashMap;
 
 /// As `TypeScheme` but for a trait ref.
diff --git a/src/librustc/ty/util.rs b/src/librustc/ty/util.rs
index 6e8363f629b..354744b2787 100644
--- a/src/librustc/ty/util.rs
+++ b/src/librustc/ty/util.rs
@@ -10,11 +10,11 @@
 
 //! misc. type-system utilities too small to deserve their own file
 
-use back::svh::Svh;
-use middle::def_id::DefId;
+use hir::svh::Svh;
+use hir::def_id::DefId;
 use ty::subst;
 use infer;
-use middle::pat_util;
+use hir::pat_util;
 use traits::{self, ProjectionMode};
 use ty::{self, Ty, TyCtxt, TypeAndMut, TypeFlags, TypeFoldable};
 use ty::{Disr, ParameterEnvironment};
@@ -28,7 +28,7 @@ use syntax::ast::{self, Name};
 use syntax::attr::{self, AttrMetaMethods, SignedInt, UnsignedInt};
 use syntax::codemap::Span;
 
-use rustc_front::hir;
+use hir;
 
 pub trait IntTypeExt {
     fn to_ty<'tcx>(&self, cx: &TyCtxt<'tcx>) -> Ty<'tcx>;
diff --git a/src/librustc/ty/wf.rs b/src/librustc/ty/wf.rs
index e6c4e90babb..9ea634bb41c 100644
--- a/src/librustc/ty/wf.rs
+++ b/src/librustc/ty/wf.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use middle::def_id::DefId;
+use hir::def_id::DefId;
 use infer::InferCtxt;
 use ty::outlives::{self, Component};
 use ty::subst::Substs;
diff --git a/src/librustc/util/common.rs b/src/librustc/util/common.rs
index 888a623b24a..bdfb97549d5 100644
--- a/src/librustc/util/common.rs
+++ b/src/librustc/util/common.rs
@@ -19,9 +19,9 @@ use std::iter::repeat;
 use std::path::Path;
 use std::time::Instant;
 
-use rustc_front::hir;
-use rustc_front::intravisit;
-use rustc_front::intravisit::Visitor;
+use hir;
+use hir::intravisit;
+use hir::intravisit::Visitor;
 
 // The name of the associated type for `Fn` return types
 pub const FN_OUTPUT_NAME: &'static str = "Output";
diff --git a/src/librustc/util/nodemap.rs b/src/librustc/util/nodemap.rs
index 4a45797602d..69bcc9cbfff 100644
--- a/src/librustc/util/nodemap.rs
+++ b/src/librustc/util/nodemap.rs
@@ -12,7 +12,7 @@
 
 #![allow(non_snake_case)]
 
-use middle::def_id::DefId;
+use hir::def_id::DefId;
 use syntax::ast;
 
 pub use rustc_data_structures::fnv::FnvHashMap;
diff --git a/src/librustc/util/ppaux.rs b/src/librustc/util/ppaux.rs
index 20f16a1d255..a84a42fc2b5 100644
--- a/src/librustc/util/ppaux.rs
+++ b/src/librustc/util/ppaux.rs
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 
-use middle::def_id::DefId;
+use hir::def_id::DefId;
 use ty::subst::{self, Subst};
 use ty::{BrAnon, BrEnv, BrFresh, BrNamed};
 use ty::{TyBool, TyChar, TyStruct, TyEnum};
@@ -23,7 +23,7 @@ use std::fmt;
 use syntax::abi::Abi;
 use syntax::parse::token;
 use syntax::ast::CRATE_NODE_ID;
-use rustc_front::hir;
+use hir;
 
 pub fn verbose() -> bool {
     ty::tls::with(|tcx| tcx.sess.verbose())
diff --git a/src/librustc_back/Cargo.toml b/src/librustc_back/Cargo.toml
index 2cf6cbc4bcf..85e861b405a 100644
--- a/src/librustc_back/Cargo.toml
+++ b/src/librustc_back/Cargo.toml
@@ -11,7 +11,6 @@ crate-type = ["dylib"]
 [dependencies]
 syntax = { path = "../libsyntax" }
 serialize = { path = "../libserialize" }
-rustc_front = { path = "../librustc_front" }
 log = { path = "../liblog" }
 
 [features]
diff --git a/src/librustc_back/lib.rs b/src/librustc_back/lib.rs
index 80dec2cd281..25edaf4b8e4 100644
--- a/src/librustc_back/lib.rs
+++ b/src/librustc_back/lib.rs
@@ -45,13 +45,11 @@
 extern crate syntax;
 extern crate libc;
 extern crate serialize;
-extern crate rustc_front;
 #[macro_use] extern crate log;
 
 pub mod tempdir;
 pub mod rpath;
 pub mod sha2;
-pub mod svh;
 pub mod target;
 pub mod slice;
 pub mod dynamic_lib;
diff --git a/src/librustc_borrowck/Cargo.toml b/src/librustc_borrowck/Cargo.toml
index fdb97bd8d2d..6da87f97fb7 100644
--- a/src/librustc_borrowck/Cargo.toml
+++ b/src/librustc_borrowck/Cargo.toml
@@ -13,5 +13,4 @@ log = { path = "../liblog" }
 syntax = { path = "../libsyntax" }
 graphviz = { path = "../libgraphviz" }
 rustc = { path = "../librustc" }
-rustc_front = { path = "../librustc_front" }
 rustc_mir = { path = "../librustc_mir" }
diff --git a/src/librustc_borrowck/borrowck/check_loans.rs b/src/librustc_borrowck/borrowck/check_loans.rs
index aa2b7ed2cde..d79ba213aca 100644
--- a/src/librustc_borrowck/borrowck/check_loans.rs
+++ b/src/librustc_borrowck/borrowck/check_loans.rs
@@ -30,7 +30,7 @@ use rustc::ty::{self, TyCtxt};
 use rustc::traits::ProjectionMode;
 use syntax::ast;
 use syntax::codemap::Span;
-use rustc_front::hir;
+use rustc::hir;
 
 use std::rc::Rc;
 
diff --git a/src/librustc_borrowck/borrowck/fragments.rs b/src/librustc_borrowck/borrowck/fragments.rs
index d1b30bb2746..0b1c4efa9ac 100644
--- a/src/librustc_borrowck/borrowck/fragments.rs
+++ b/src/librustc_borrowck/borrowck/fragments.rs
@@ -20,7 +20,7 @@ use borrowck::LoanPathKind::{LpVar, LpUpvar, LpDowncast, LpExtend};
 use borrowck::LoanPathElem::{LpDeref, LpInterior};
 use borrowck::move_data::InvalidMovePathIndex;
 use borrowck::move_data::{MoveData, MovePathIndex};
-use rustc::middle::def_id::{DefId};
+use rustc::hir::def_id::{DefId};
 use rustc::ty::{self, TyCtxt};
 use rustc::middle::mem_categorization as mc;
 
diff --git a/src/librustc_borrowck/borrowck/gather_loans/gather_moves.rs b/src/librustc_borrowck/borrowck/gather_loans/gather_moves.rs
index 489c8be4e38..c85d69fa8a6 100644
--- a/src/librustc_borrowck/borrowck/gather_loans/gather_moves.rs
+++ b/src/librustc_borrowck/borrowck/gather_loans/gather_moves.rs
@@ -23,7 +23,7 @@ use rustc::ty;
 use std::rc::Rc;
 use syntax::ast;
 use syntax::codemap::Span;
-use rustc_front::hir::{self, PatKind};
+use rustc::hir::{self, PatKind};
 
 struct GatherMoveInfo<'tcx> {
     id: ast::NodeId,
diff --git a/src/librustc_borrowck/borrowck/gather_loans/mod.rs b/src/librustc_borrowck/borrowck/gather_loans/mod.rs
index c759722c24b..893c27f0ede 100644
--- a/src/librustc_borrowck/borrowck/gather_loans/mod.rs
+++ b/src/librustc_borrowck/borrowck/gather_loans/mod.rs
@@ -29,10 +29,10 @@ use rustc::traits::ProjectionMode;
 use syntax::ast;
 use syntax::codemap::Span;
 use syntax::ast::NodeId;
-use rustc_front::hir;
-use rustc_front::hir::Expr;
-use rustc_front::intravisit;
-use rustc_front::intravisit::Visitor;
+use rustc::hir;
+use rustc::hir::Expr;
+use rustc::hir::intravisit;
+use rustc::hir::intravisit::Visitor;
 
 use self::restrictions::RestrictionResult;
 
diff --git a/src/librustc_borrowck/borrowck/gather_loans/move_error.rs b/src/librustc_borrowck/borrowck/gather_loans/move_error.rs
index f5e3bc4f6fb..3d94f5b186f 100644
--- a/src/librustc_borrowck/borrowck/gather_loans/move_error.rs
+++ b/src/librustc_borrowck/borrowck/gather_loans/move_error.rs
@@ -16,7 +16,7 @@ use rustc::ty;
 use syntax::ast;
 use syntax::codemap;
 use syntax::errors::DiagnosticBuilder;
-use rustc_front::hir;
+use rustc::hir;
 
 pub struct MoveErrorCollector<'tcx> {
     errors: Vec<MoveError<'tcx>>
diff --git a/src/librustc_borrowck/borrowck/mir/mod.rs b/src/librustc_borrowck/borrowck/mir/mod.rs
index d1335811858..672faea58f5 100644
--- a/src/librustc_borrowck/borrowck/mir/mod.rs
+++ b/src/librustc_borrowck/borrowck/mir/mod.rs
@@ -13,8 +13,8 @@ use borrowck::BorrowckCtxt;
 use syntax::ast;
 use syntax::codemap::Span;
 
-use rustc_front::hir;
-use rustc_front::intravisit::{FnKind};
+use rustc::hir;
+use rustc::hir::intravisit::{FnKind};
 
 use rustc::mir::repr::{BasicBlock, BasicBlockData, Mir, Statement, Terminator};
 
diff --git a/src/librustc_borrowck/borrowck/mod.rs b/src/librustc_borrowck/borrowck/mod.rs
index 1dfa4da46aa..d7c928b8d6e 100644
--- a/src/librustc_borrowck/borrowck/mod.rs
+++ b/src/librustc_borrowck/borrowck/mod.rs
@@ -21,14 +21,14 @@ pub use self::MovedValueUseKind::*;
 use self::InteriorKind::*;
 
 use rustc::dep_graph::DepNode;
-use rustc::front::map as hir_map;
-use rustc::front::map::blocks::FnParts;
+use rustc::hir::map as hir_map;
+use rustc::hir::map::blocks::FnParts;
 use rustc::cfg;
 use rustc::middle::dataflow::DataFlowContext;
 use rustc::middle::dataflow::BitwiseOperator;
 use rustc::middle::dataflow::DataFlowOperator;
 use rustc::middle::dataflow::KillFrom;
-use rustc::middle::def_id::DefId;
+use rustc::hir::def_id::DefId;
 use rustc::middle::expr_use_visitor as euv;
 use rustc::middle::free_region::FreeRegionMap;
 use rustc::middle::mem_categorization as mc;
@@ -44,11 +44,10 @@ use syntax::attr::AttrMetaMethods;
 use syntax::codemap::Span;
 use syntax::errors::DiagnosticBuilder;
 
-use rustc_front::hir;
-use rustc_front::hir::{FnDecl, Block};
-use rustc_front::intravisit;
-use rustc_front::intravisit::{Visitor, FnKind};
-use rustc_front::util as hir_util;
+use rustc::hir;
+use rustc::hir::{FnDecl, Block};
+use rustc::hir::intravisit;
+use rustc::hir::intravisit::{Visitor, FnKind};
 
 use rustc::mir::mir_map::MirMap;
 
@@ -210,7 +209,7 @@ fn build_borrowck_dataflow_data<'a, 'tcx>(this: &mut BorrowckCtxt<'a, 'tcx>,
 {
     // Check the body of fn items.
     let tcx = this.tcx;
-    let id_range = hir_util::compute_id_range_for_fn_body(fk, decl, body, sp, id);
+    let id_range = intravisit::compute_id_range_for_fn_body(fk, decl, body, sp, id);
     let (all_loans, move_data) =
         gather_loans::gather_loans_in_fn(this, id, decl, body);
 
diff --git a/src/librustc_borrowck/borrowck/move_data.rs b/src/librustc_borrowck/borrowck/move_data.rs
index b31f74c6476..80e408e9a6e 100644
--- a/src/librustc_borrowck/borrowck/move_data.rs
+++ b/src/librustc_borrowck/borrowck/move_data.rs
@@ -28,9 +28,9 @@ use std::cell::RefCell;
 use std::rc::Rc;
 use std::usize;
 use syntax::ast;
-use syntax::ast_util;
 use syntax::codemap::Span;
-use rustc_front::hir;
+use rustc::hir;
+use rustc::hir::intravisit::IdRange;
 
 #[path="fragments.rs"]
 pub mod fragments;
@@ -602,7 +602,7 @@ impl<'a, 'tcx> FlowedMoveData<'a, 'tcx> {
     pub fn new(move_data: MoveData<'tcx>,
                tcx: &'a TyCtxt<'tcx>,
                cfg: &cfg::CFG,
-               id_range: ast_util::IdRange,
+               id_range: IdRange,
                decl: &hir::FnDecl,
                body: &hir::Block)
                -> FlowedMoveData<'a, 'tcx> {
diff --git a/src/librustc_borrowck/lib.rs b/src/librustc_borrowck/lib.rs
index 6f21fcd9230..e38677de662 100644
--- a/src/librustc_borrowck/lib.rs
+++ b/src/librustc_borrowck/lib.rs
@@ -34,7 +34,6 @@
 extern crate graphviz as dot;
 #[macro_use]
 extern crate rustc;
-extern crate rustc_front;
 extern crate rustc_mir;
 extern crate core; // for NonZero
 
diff --git a/src/librustc_const_eval/Cargo.toml b/src/librustc_const_eval/Cargo.toml
index f38c60cd1fa..c572284a6bb 100644
--- a/src/librustc_const_eval/Cargo.toml
+++ b/src/librustc_const_eval/Cargo.toml
@@ -12,7 +12,6 @@ crate-type = ["dylib"]
 log = { path = "../liblog" }
 serialize = { path = "../libserialize" }
 rustc = { path = "../librustc" }
-rustc_front = { path = "../librustc_front" }
 rustc_back = { path = "../librustc_back" }
 rustc_const_math = { path = "../librustc_const_math" }
 syntax = { path = "../libsyntax" }
diff --git a/src/librustc_const_eval/check_match.rs b/src/librustc_const_eval/check_match.rs
index a46d72840b7..1e662d456d1 100644
--- a/src/librustc_const_eval/check_match.rs
+++ b/src/librustc_const_eval/check_match.rs
@@ -17,14 +17,14 @@ use rustc::middle::const_val::ConstVal;
 use ::{eval_const_expr, eval_const_expr_partial, compare_const_vals};
 use ::{const_expr_to_pat, lookup_const_by_id};
 use ::EvalHint::ExprTypeChecked;
-use rustc::middle::def::*;
-use rustc::middle::def_id::{DefId};
+use rustc::hir::def::*;
+use rustc::hir::def_id::{DefId};
 use rustc::middle::expr_use_visitor::{ConsumeMode, Delegate, ExprUseVisitor};
 use rustc::middle::expr_use_visitor::{LoanCause, MutateMode};
 use rustc::middle::expr_use_visitor as euv;
 use rustc::infer;
 use rustc::middle::mem_categorization::{cmt};
-use rustc::middle::pat_util::*;
+use rustc::hir::pat_util::*;
 use rustc::traits::ProjectionMode;
 use rustc::ty::*;
 use rustc::ty;
@@ -32,17 +32,15 @@ use std::cmp::Ordering;
 use std::fmt;
 use std::iter::{FromIterator, IntoIterator, repeat};
 
-use rustc_front::hir;
-use rustc_front::hir::{Pat, PatKind};
-use rustc_front::intravisit::{self, Visitor, FnKind};
-use rustc_front::util as front_util;
+use rustc::hir;
+use rustc::hir::{Pat, PatKind};
+use rustc::hir::intravisit::{self, IdVisitor, IdVisitingOperation, Visitor, FnKind};
 use rustc_back::slice;
 
 use syntax::ast::{self, DUMMY_NODE_ID, NodeId};
-use syntax::ast_util;
 use syntax::codemap::{Span, Spanned, DUMMY_SP};
-use rustc_front::fold::{Folder, noop_fold_pat};
-use rustc_front::print::pprust::pat_to_string;
+use rustc::hir::fold::{Folder, noop_fold_pat};
+use rustc::hir::print::pat_to_string;
 use syntax::ptr::P;
 use rustc::util::nodemap::FnvHashMap;
 
@@ -241,7 +239,7 @@ fn check_expr(cx: &mut MatchCheckCtxt, ex: &hir::Expr) {
 }
 
 fn check_for_bindings_named_the_same_as_variants(cx: &MatchCheckCtxt, pat: &Pat) {
-    front_util::walk_pat(pat, |p| {
+    pat.walk(|p| {
         match p.node {
             PatKind::Ident(hir::BindByValue(hir::MutImmutable), ident, None) => {
                 let pat_ty = cx.tcx.pat_ty(p);
@@ -274,7 +272,7 @@ fn check_for_bindings_named_the_same_as_variants(cx: &MatchCheckCtxt, pat: &Pat)
 
 // Check that we do not match against a static NaN (#6804)
 fn check_for_static_nan(cx: &MatchCheckCtxt, pat: &Pat) {
-    front_util::walk_pat(pat, |p| {
+    pat.walk(|p| {
         if let PatKind::Lit(ref expr) = p.node {
             match eval_const_expr_partial(cx.tcx, &expr, ExprTypeChecked, None) {
                 Ok(ConstVal::Float(f)) if f.is_nan() => {
@@ -461,7 +459,7 @@ struct RenamingRecorder<'map> {
     renaming_map: &'map mut FnvHashMap<(NodeId, Span), NodeId>
 }
 
-impl<'map> ast_util::IdVisitingOperation for RenamingRecorder<'map> {
+impl<'map> IdVisitingOperation for RenamingRecorder<'map> {
     fn visit_id(&mut self, node_id: NodeId) {
         let key = (node_id, self.origin_span);
         self.renaming_map.insert(key, self.substituted_node_id);
@@ -518,7 +516,7 @@ impl<'a, 'tcx> Folder for StaticInliner<'a, 'tcx> {
                 renaming_map: renaming_map,
             };
 
-            let mut id_visitor = front_util::IdVisitor::new(&mut renaming_recorder);
+            let mut id_visitor = IdVisitor::new(&mut renaming_recorder);
 
             id_visitor.visit_expr(const_expr);
         }
@@ -1100,7 +1098,7 @@ fn check_legality_of_move_bindings(cx: &MatchCheckCtxt,
     };
 
     for pat in pats {
-        front_util::walk_pat(&pat, |p| {
+        pat.walk(|p| {
             if pat_is_binding(&def_map.borrow(), &p) {
                 match p.node {
                     PatKind::Ident(hir::BindByValue(_), _, ref sub) => {
diff --git a/src/librustc_const_eval/eval.rs b/src/librustc_const_eval/eval.rs
index 5a00b4573de..45a90bf0068 100644
--- a/src/librustc_const_eval/eval.rs
+++ b/src/librustc_const_eval/eval.rs
@@ -15,13 +15,13 @@ use rustc::middle::const_val::ConstVal;
 use self::ErrKind::*;
 use self::EvalHint::*;
 
-use rustc::front::map as ast_map;
-use rustc::front::map::blocks::FnLikeNode;
+use rustc::hir::map as ast_map;
+use rustc::hir::map::blocks::FnLikeNode;
 use rustc::middle::cstore::{self, CrateStore, InlinedItem};
 use rustc::{infer, traits};
-use rustc::middle::def::Def;
-use rustc::middle::def_id::DefId;
-use rustc::middle::pat_util::def_to_path;
+use rustc::hir::def::Def;
+use rustc::hir::def_id::DefId;
+use rustc::hir::pat_util::def_to_path;
 use rustc::ty::{self, Ty, TyCtxt, subst};
 use rustc::ty::util::IntTypeExt;
 use rustc::traits::ProjectionMode;
@@ -31,9 +31,9 @@ use rustc::lint;
 
 use graphviz::IntoCow;
 use syntax::ast;
-use rustc_front::hir::{Expr, PatKind};
-use rustc_front::hir;
-use rustc_front::intravisit::FnKind;
+use rustc::hir::{Expr, PatKind};
+use rustc::hir;
+use rustc::hir::intravisit::FnKind;
 use syntax::codemap::Span;
 use syntax::ptr::P;
 use syntax::codemap;
diff --git a/src/librustc_const_eval/lib.rs b/src/librustc_const_eval/lib.rs
index b74fc121e39..085888dc21f 100644
--- a/src/librustc_const_eval/lib.rs
+++ b/src/librustc_const_eval/lib.rs
@@ -33,7 +33,6 @@
 #[macro_use] extern crate syntax;
 #[macro_use] extern crate log;
 #[macro_use] extern crate rustc;
-extern crate rustc_front;
 extern crate rustc_back;
 extern crate rustc_const_math;
 extern crate graphviz;
diff --git a/src/librustc_driver/Cargo.toml b/src/librustc_driver/Cargo.toml
index 0d2ae14d7d1..bac5900f3ed 100644
--- a/src/librustc_driver/Cargo.toml
+++ b/src/librustc_driver/Cargo.toml
@@ -17,7 +17,6 @@ rustc = { path = "../librustc" }
 rustc_back = { path = "../librustc_back" }
 rustc_borrowck = { path = "../librustc_borrowck" }
 rustc_const_eval = { path = "../librustc_const_eval" }
-rustc_front = { path = "../librustc_front" }
 rustc_lint = { path = "../librustc_lint" }
 rustc_llvm = { path = "../librustc_llvm" }
 rustc_mir = { path = "../librustc_mir" }
diff --git a/src/librustc_driver/driver.rs b/src/librustc_driver/driver.rs
index 4255d4fc8b0..f661b2a38b6 100644
--- a/src/librustc_driver/driver.rs
+++ b/src/librustc_driver/driver.rs
@@ -9,8 +9,8 @@
 // except according to those terms.
 
 use rustc::dep_graph::DepGraph;
-use rustc::front;
-use rustc::front::map as hir_map;
+use rustc::hir;
+use rustc::hir::map as hir_map;
 use rustc_mir as mir;
 use rustc::mir::mir_map::MirMap;
 use rustc::session::{Session, CompileResult, compile_result_from_err_count};
@@ -35,8 +35,7 @@ use rustc_typeck as typeck;
 use rustc_privacy;
 use rustc_plugin::registry::Registry;
 use rustc_plugin as plugin;
-use rustc_front::hir;
-use rustc_front::lowering::{lower_crate, LoweringContext};
+use rustc::hir::lowering::{lower_crate, LoweringContext};
 use rustc_passes::{no_asm, loops, consts, const_fn, rvalues, static_recursion};
 use rustc_const_eval::check_match;
 use super::Compilation;
@@ -155,7 +154,7 @@ pub fn compile_input(sess: &Session,
         }
 
         time(sess.time_passes(), "attribute checking", || {
-            front::check_attr::check_crate(sess, &expanded_crate);
+            hir::check_attr::check_crate(sess, &expanded_crate);
         });
 
         time(sess.time_passes(),
diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs
index 3444b770cc8..b4b53d30e3c 100644
--- a/src/librustc_driver/lib.rs
+++ b/src/librustc_driver/lib.rs
@@ -42,7 +42,6 @@ extern crate rustc_back;
 extern crate rustc_borrowck;
 extern crate rustc_const_eval;
 extern crate rustc_passes;
-extern crate rustc_front;
 extern crate rustc_lint;
 extern crate rustc_plugin;
 extern crate rustc_privacy;
diff --git a/src/librustc_driver/pretty.rs b/src/librustc_driver/pretty.rs
index 31345cfdc41..cde5ba19859 100644
--- a/src/librustc_driver/pretty.rs
+++ b/src/librustc_driver/pretty.rs
@@ -50,11 +50,11 @@ use std::option;
 use std::path::PathBuf;
 use std::str::FromStr;
 
-use rustc::front::map as hir_map;
-use rustc::front::map::{blocks, NodePrinter};
-use rustc_front::hir;
-use rustc_front::lowering::{lower_crate, LoweringContext};
-use rustc_front::print::pprust as pprust_hir;
+use rustc::hir::map as hir_map;
+use rustc::hir::map::{blocks, NodePrinter};
+use rustc::hir;
+use rustc::hir::lowering::{lower_crate, LoweringContext};
+use rustc::hir::print as pprust_hir;
 
 use rustc::mir::mir_map::MirMap;
 
@@ -256,6 +256,15 @@ trait HirPrinterSupport<'ast>: pprust_hir::PpAnn {
     /// (Rust does not yet support upcasting from a trait object to
     /// an object for one of its super-traits.)
     fn pp_ann<'a>(&'a self) -> &'a 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| {
+            path.data.into_iter().map(|elem| {
+                elem.data.to_string()
+            }).collect::<Vec<_>>().join("::")
+        })
+    }
 }
 
 struct NoAnn<'ast> {
@@ -452,6 +461,10 @@ impl<'b, 'tcx> HirPrinterSupport<'tcx> for TypedAnnotation<'b, 'tcx> {
     fn pp_ann<'a>(&'a self) -> &'a pprust_hir::PpAnn {
         self
     }
+
+    fn node_path(&self, id: ast::NodeId) -> Option<String> {
+        Some(self.tcx.node_path_str(id))
+    }
 }
 
 impl<'a, 'tcx> pprust_hir::PpAnn for TypedAnnotation<'a, 'tcx> {
@@ -794,7 +807,7 @@ pub fn pretty_print_input(sess: Session,
                                        |annotation, (out,uii), _| {
                 debug!("pretty printing source code {:?}", s);
                 let sess = annotation.sess();
-                let ast_map = annotation.ast_map().expect("--pretty missing ast_map");
+                let ast_map = annotation.ast_map().expect("--unpretty missing HIR map");
                 let mut pp_state =
                     pprust_hir::State::new_from_input(sess.codemap(),
                                                       sess.diagnostic(),
@@ -808,7 +821,9 @@ pub fn pretty_print_input(sess: Session,
                     let node = ast_map.get(node_id);
                     pp_state.print_node(&node)?;
                     pp::space(&mut pp_state.s)?;
-                    pp_state.synth_comment(ast_map.path_to_string(node_id))?;
+                    let path = annotation.node_path(node_id)
+                                         .expect("--unpretty missing node paths");
+                    pp_state.synth_comment(path)?;
                     pp::hardbreak(&mut pp_state.s)?;
                 }
                 pp::eof(&mut pp_state.s)
diff --git a/src/librustc_driver/test.rs b/src/librustc_driver/test.rs
index ce0d42203b9..fc12d546288 100644
--- a/src/librustc_driver/test.rs
+++ b/src/librustc_driver/test.rs
@@ -27,7 +27,7 @@ use rustc::ty::{self, Ty, TyCtxt, TypeFoldable};
 use rustc::ty::relate::TypeRelation;
 use rustc::infer::{self, InferOk, InferResult, TypeOrigin};
 use rustc_metadata::cstore::CStore;
-use rustc::front::map as hir_map;
+use rustc::hir::map as hir_map;
 use rustc::session::{self, config};
 use std::rc::Rc;
 use syntax::ast;
@@ -39,8 +39,8 @@ use syntax::errors::{Level, RenderSpan};
 use syntax::parse::token;
 use syntax::feature_gate::UnstableFeatures;
 
-use rustc_front::lowering::{lower_crate, LoweringContext};
-use rustc_front::hir;
+use rustc::hir::lowering::{lower_crate, LoweringContext};
+use rustc::hir;
 
 struct Env<'a, 'tcx: 'a> {
     infcx: &'a infer::InferCtxt<'a, 'tcx>,
diff --git a/src/librustc_front/Cargo.toml b/src/librustc_front/Cargo.toml
deleted file mode 100644
index bf40cdbd330..00000000000
--- a/src/librustc_front/Cargo.toml
+++ /dev/null
@@ -1,15 +0,0 @@
-[package]
-authors = ["The Rust Project Developers"]
-name = "rustc_front"
-version = "0.0.0"
-
-[lib]
-name = "rustc_front"
-path = "lib.rs"
-crate-type = ["dylib"]
-
-[dependencies]
-log = { path = "../liblog" }
-syntax = { path = "../libsyntax" }
-serialize = { path = "../libserialize" }
-rustc_bitflags = { path = "../librustc_bitflags" }
diff --git a/src/librustc_front/lib.rs b/src/librustc_front/lib.rs
deleted file mode 100644
index b9e3b71cf1a..00000000000
--- a/src/librustc_front/lib.rs
+++ /dev/null
@@ -1,58 +0,0 @@
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-//! The Rust compiler.
-//!
-//! # Note
-//!
-//! This API is completely unstable and subject to change.
-
-#![crate_name = "rustc_front"]
-#![unstable(feature = "rustc_private", issue = "27812")]
-#![crate_type = "dylib"]
-#![crate_type = "rlib"]
-#![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
-       html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
-       html_root_url = "http://doc.rust-lang.org/nightly/")]
-#![cfg_attr(not(stage0), deny(warnings))]
-
-#![feature(associated_consts)]
-#![feature(box_patterns)]
-#![feature(box_syntax)]
-#![feature(const_fn)]
-#![feature(quote)]
-#![feature(rustc_diagnostic_macros)]
-#![feature(rustc_private)]
-#![feature(slice_patterns)]
-#![feature(staged_api)]
-#![feature(str_char)]
-#![feature(question_mark)]
-
-extern crate serialize;
-#[macro_use]
-extern crate log;
-#[macro_use]
-extern crate syntax;
-#[macro_use]
-#[no_link]
-extern crate rustc_bitflags;
-
-extern crate serialize as rustc_serialize; // used by deriving
-
-#[macro_use]
-pub mod hir;
-pub mod lowering;
-pub mod fold;
-pub mod intravisit;
-pub mod util;
-
-pub mod print {
-    pub mod pprust;
-}
diff --git a/src/librustc_front/util.rs b/src/librustc_front/util.rs
deleted file mode 100644
index f4f9cb75eaf..00000000000
--- a/src/librustc_front/util.rs
+++ /dev/null
@@ -1,362 +0,0 @@
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-use hir;
-use hir::*;
-use intravisit::{self, Visitor, FnKind};
-use syntax::ast_util;
-use syntax::ast::{Name, NodeId, DUMMY_NODE_ID};
-use syntax::codemap::Span;
-use syntax::ptr::P;
-
-pub fn walk_pat<F>(pat: &Pat, mut it: F) -> bool
-    where F: FnMut(&Pat) -> bool
-{
-    // FIXME(#19596) this is a workaround, but there should be a better way
-    fn walk_pat_<G>(pat: &Pat, it: &mut G) -> bool
-        where G: FnMut(&Pat) -> bool
-    {
-        if !it(pat) {
-            return false;
-        }
-
-        match pat.node {
-            PatKind::Ident(_, _, Some(ref p)) => walk_pat_(&p, it),
-            PatKind::Struct(_, ref fields, _) => {
-                fields.iter().all(|field| walk_pat_(&field.node.pat, it))
-            }
-            PatKind::TupleStruct(_, Some(ref s)) | PatKind::Tup(ref s) => {
-                s.iter().all(|p| walk_pat_(&p, it))
-            }
-            PatKind::Box(ref s) | PatKind::Ref(ref s, _) => {
-                walk_pat_(&s, it)
-            }
-            PatKind::Vec(ref before, ref slice, ref after) => {
-                before.iter().all(|p| walk_pat_(&p, it)) &&
-                slice.iter().all(|p| walk_pat_(&p, it)) &&
-                after.iter().all(|p| walk_pat_(&p, it))
-            }
-            PatKind::Wild |
-            PatKind::Lit(_) |
-            PatKind::Range(_, _) |
-            PatKind::Ident(_, _, _) |
-            PatKind::TupleStruct(..) |
-            PatKind::Path(..) |
-            PatKind::QPath(_, _) => {
-                true
-            }
-        }
-    }
-
-    walk_pat_(pat, &mut it)
-}
-
-pub fn binop_to_string(op: BinOp_) -> &'static str {
-    match op {
-        BiAdd => "+",
-        BiSub => "-",
-        BiMul => "*",
-        BiDiv => "/",
-        BiRem => "%",
-        BiAnd => "&&",
-        BiOr => "||",
-        BiBitXor => "^",
-        BiBitAnd => "&",
-        BiBitOr => "|",
-        BiShl => "<<",
-        BiShr => ">>",
-        BiEq => "==",
-        BiLt => "<",
-        BiLe => "<=",
-        BiNe => "!=",
-        BiGe => ">=",
-        BiGt => ">",
-    }
-}
-
-pub fn stmt_id(s: &Stmt) -> NodeId {
-    match s.node {
-        StmtDecl(_, id) => id,
-        StmtExpr(_, id) => id,
-        StmtSemi(_, id) => id,
-    }
-}
-
-pub fn lazy_binop(b: BinOp_) -> bool {
-    match b {
-        BiAnd => true,
-        BiOr => true,
-        _ => false,
-    }
-}
-
-pub fn is_shift_binop(b: BinOp_) -> bool {
-    match b {
-        BiShl => true,
-        BiShr => true,
-        _ => false,
-    }
-}
-
-pub fn is_comparison_binop(b: BinOp_) -> bool {
-    match b {
-        BiEq | BiLt | BiLe | BiNe | BiGt | BiGe => true,
-        BiAnd |
-        BiOr |
-        BiAdd |
-        BiSub |
-        BiMul |
-        BiDiv |
-        BiRem |
-        BiBitXor |
-        BiBitAnd |
-        BiBitOr |
-        BiShl |
-        BiShr => false,
-    }
-}
-
-/// Returns `true` if the binary operator takes its arguments by value
-pub fn is_by_value_binop(b: BinOp_) -> bool {
-    !is_comparison_binop(b)
-}
-
-/// Returns `true` if the unary operator takes its argument by value
-pub fn is_by_value_unop(u: UnOp) -> bool {
-    match u {
-        UnNeg | UnNot => true,
-        _ => false,
-    }
-}
-
-pub fn unop_to_string(op: UnOp) -> &'static str {
-    match op {
-        UnDeref => "*",
-        UnNot => "!",
-        UnNeg => "-",
-    }
-}
-
-pub struct IdVisitor<'a, O: 'a> {
-    operation: &'a mut O,
-
-    // In general, the id visitor visits the contents of an item, but
-    // not including nested trait/impl items, nor other nested items.
-    // The base visitor itself always skips nested items, but not
-    // trait/impl items. This means in particular that if you start by
-    // visiting a trait or an impl, you should not visit the
-    // trait/impl items respectively.  This is handled by setting
-    // `skip_members` to true when `visit_item` is on the stack. This
-    // way, if the user begins by calling `visit_trait_item`, we will
-    // visit the trait item, but if they begin with `visit_item`, we
-    // won't visit the (nested) trait items.
-    skip_members: bool,
-}
-
-impl<'a, O: ast_util::IdVisitingOperation> IdVisitor<'a, O> {
-    pub fn new(operation: &'a mut O) -> IdVisitor<'a, O> {
-        IdVisitor { operation: operation, skip_members: false }
-    }
-
-    fn visit_generics_helper(&mut self, generics: &Generics) {
-        for type_parameter in generics.ty_params.iter() {
-            self.operation.visit_id(type_parameter.id)
-        }
-        for lifetime in &generics.lifetimes {
-            self.operation.visit_id(lifetime.lifetime.id)
-        }
-    }
-}
-
-impl<'a, 'v, O: ast_util::IdVisitingOperation> Visitor<'v> for IdVisitor<'a, O> {
-    fn visit_mod(&mut self, module: &Mod, _: Span, node_id: NodeId) {
-        self.operation.visit_id(node_id);
-        intravisit::walk_mod(self, module)
-    }
-
-    fn visit_foreign_item(&mut self, foreign_item: &ForeignItem) {
-        self.operation.visit_id(foreign_item.id);
-        intravisit::walk_foreign_item(self, foreign_item)
-    }
-
-    fn visit_item(&mut self, item: &Item) {
-        assert!(!self.skip_members);
-        self.skip_members = true;
-
-        self.operation.visit_id(item.id);
-        match item.node {
-            ItemUse(ref view_path) => {
-                match view_path.node {
-                    ViewPathSimple(_, _) |
-                    ViewPathGlob(_) => {}
-                    ViewPathList(_, ref paths) => {
-                        for path in paths {
-                            self.operation.visit_id(path.node.id())
-                        }
-                    }
-                }
-            }
-            _ => {}
-        }
-        intravisit::walk_item(self, item);
-
-        self.skip_members = false;
-    }
-
-    fn visit_local(&mut self, local: &Local) {
-        self.operation.visit_id(local.id);
-        intravisit::walk_local(self, local)
-    }
-
-    fn visit_block(&mut self, block: &Block) {
-        self.operation.visit_id(block.id);
-        intravisit::walk_block(self, block)
-    }
-
-    fn visit_stmt(&mut self, statement: &Stmt) {
-        self.operation.visit_id(stmt_id(statement));
-        intravisit::walk_stmt(self, statement)
-    }
-
-    fn visit_pat(&mut self, pattern: &Pat) {
-        self.operation.visit_id(pattern.id);
-        intravisit::walk_pat(self, pattern)
-    }
-
-    fn visit_expr(&mut self, expression: &Expr) {
-        self.operation.visit_id(expression.id);
-        intravisit::walk_expr(self, expression)
-    }
-
-    fn visit_ty(&mut self, typ: &Ty) {
-        self.operation.visit_id(typ.id);
-        intravisit::walk_ty(self, typ)
-    }
-
-    fn visit_generics(&mut self, generics: &Generics) {
-        self.visit_generics_helper(generics);
-        intravisit::walk_generics(self, generics)
-    }
-
-    fn visit_fn(&mut self,
-                function_kind: FnKind<'v>,
-                function_declaration: &'v FnDecl,
-                block: &'v Block,
-                span: Span,
-                node_id: NodeId) {
-        self.operation.visit_id(node_id);
-
-        match function_kind {
-            FnKind::ItemFn(_, generics, _, _, _, _, _) => {
-                self.visit_generics_helper(generics)
-            }
-            FnKind::Method(_, sig, _, _) => {
-                self.visit_generics_helper(&sig.generics)
-            }
-            FnKind::Closure(_) => {}
-        }
-
-        for argument in &function_declaration.inputs {
-            self.operation.visit_id(argument.id)
-        }
-
-        intravisit::walk_fn(self, function_kind, function_declaration, block, span);
-    }
-
-    fn visit_struct_field(&mut self, struct_field: &StructField) {
-        self.operation.visit_id(struct_field.id);
-        intravisit::walk_struct_field(self, struct_field)
-    }
-
-    fn visit_variant_data(&mut self,
-                          struct_def: &VariantData,
-                          _: Name,
-                          _: &hir::Generics,
-                          _: NodeId,
-                          _: Span) {
-        self.operation.visit_id(struct_def.id());
-        intravisit::walk_struct_def(self, struct_def);
-    }
-
-    fn visit_trait_item(&mut self, ti: &hir::TraitItem) {
-        if !self.skip_members {
-            self.operation.visit_id(ti.id);
-            intravisit::walk_trait_item(self, ti);
-        }
-    }
-
-    fn visit_impl_item(&mut self, ii: &hir::ImplItem) {
-        if !self.skip_members {
-            self.operation.visit_id(ii.id);
-            intravisit::walk_impl_item(self, ii);
-        }
-    }
-
-    fn visit_lifetime(&mut self, lifetime: &Lifetime) {
-        self.operation.visit_id(lifetime.id);
-    }
-
-    fn visit_lifetime_def(&mut self, def: &LifetimeDef) {
-        self.visit_lifetime(&def.lifetime);
-    }
-
-    fn visit_trait_ref(&mut self, trait_ref: &TraitRef) {
-        self.operation.visit_id(trait_ref.ref_id);
-        intravisit::walk_trait_ref(self, trait_ref);
-    }
-}
-
-/// Computes the id range for a single fn body, ignoring nested items.
-pub fn compute_id_range_for_fn_body(fk: FnKind,
-                                    decl: &FnDecl,
-                                    body: &Block,
-                                    sp: Span,
-                                    id: NodeId)
-                                    -> ast_util::IdRange {
-    let mut visitor = ast_util::IdRangeComputingVisitor { result: ast_util::IdRange::max() };
-    let mut id_visitor = IdVisitor::new(&mut visitor);
-    id_visitor.visit_fn(fk, decl, body, sp, id);
-    id_visitor.operation.result
-}
-
-pub fn is_path(e: P<Expr>) -> bool {
-    match e.node {
-        ExprPath(..) => true,
-        _ => false,
-    }
-}
-
-pub fn empty_generics() -> Generics {
-    Generics {
-        lifetimes: HirVec::new(),
-        ty_params: HirVec::new(),
-        where_clause: WhereClause {
-            id: DUMMY_NODE_ID,
-            predicates: HirVec::new(),
-        },
-    }
-}
-
-// convert a span and an identifier to the corresponding
-// 1-segment path
-pub fn ident_to_path(s: Span, ident: Ident) -> Path {
-    hir::Path {
-        span: s,
-        global: false,
-        segments: hir_vec![hir::PathSegment {
-            identifier: ident,
-            parameters: hir::AngleBracketedParameters(hir::AngleBracketedParameterData {
-                lifetimes: HirVec::new(),
-                types: HirVec::new(),
-                bindings: HirVec::new(),
-            }),
-        }],
-    }
-}
diff --git a/src/librustc_lint/Cargo.toml b/src/librustc_lint/Cargo.toml
index 4821a723279..3f0cd397e76 100644
--- a/src/librustc_lint/Cargo.toml
+++ b/src/librustc_lint/Cargo.toml
@@ -13,5 +13,4 @@ log = { path = "../liblog" }
 rustc = { path = "../librustc" }
 rustc_back = { path = "../librustc_back" }
 rustc_const_eval = { path = "../librustc_const_eval" }
-rustc_front = { path = "../librustc_front" }
 syntax = { path = "../libsyntax" }
diff --git a/src/librustc_lint/bad_style.rs b/src/librustc_lint/bad_style.rs
index ca189d0b519..d10691d12ed 100644
--- a/src/librustc_lint/bad_style.rs
+++ b/src/librustc_lint/bad_style.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use middle::def::Def;
+use rustc::hir::def::Def;
 use rustc::ty;
 use lint::{LateContext, LintContext, LintArray};
 use lint::{LintPass, LateLintPass};
@@ -17,8 +17,8 @@ use syntax::ast;
 use syntax::attr::{self, AttrMetaMethods};
 use syntax::codemap::Span;
 
-use rustc_front::hir::{self, PatKind};
-use rustc_front::intravisit::FnKind;
+use rustc::hir::{self, PatKind};
+use rustc::hir::intravisit::FnKind;
 
 #[derive(PartialEq)]
 pub enum MethodLateContext {
diff --git a/src/librustc_lint/builtin.rs b/src/librustc_lint/builtin.rs
index 339c969b01f..5e3a47701eb 100644
--- a/src/librustc_lint/builtin.rs
+++ b/src/librustc_lint/builtin.rs
@@ -28,16 +28,16 @@
 //! Use the former for unit-like structs and the latter for structs with
 //! a `pub fn new()`.
 
-use middle::def::Def;
+use rustc::hir::def::Def;
 use middle::cstore::CrateStore;
-use middle::def_id::DefId;
+use rustc::hir::def_id::DefId;
 use middle::stability;
 use rustc::{cfg, infer};
 use rustc::ty::subst::Substs;
 use rustc::ty::{self, Ty, TyCtxt};
 use rustc::ty::adjustment;
 use rustc::traits::{self, ProjectionMode};
-use rustc::front::map as hir_map;
+use rustc::hir::map as hir_map;
 use util::nodemap::{NodeSet};
 use lint::{Level, LateContext, LintContext, LintArray, Lint};
 use lint::{LintPass, LateLintPass};
@@ -48,8 +48,8 @@ use syntax::{ast};
 use syntax::attr::{self, AttrMetaMethods};
 use syntax::codemap::{self, Span};
 
-use rustc_front::hir::{self, PatKind};
-use rustc_front::intravisit::FnKind;
+use rustc::hir::{self, PatKind};
+use rustc::hir::intravisit::FnKind;
 
 use bad_style::{MethodLateContext, method_context};
 
@@ -1087,10 +1087,7 @@ impl LateLintPass for MutableTransmutes {
                 ty::TyFnDef(_, _, ref bfty) if bfty.abi == RustIntrinsic => (),
                 _ => return false
             }
-            cx.tcx.with_path(def_id, |path| match path.last() {
-                Some(ref last) => last.name().as_str() == "transmute",
-                _ => false
-            })
+            cx.tcx.item_name(def_id).as_str() == "transmute"
         }
     }
 }
diff --git a/src/librustc_lint/lib.rs b/src/librustc_lint/lib.rs
index 0780e4cd048..2075bd5edca 100644
--- a/src/librustc_lint/lib.rs
+++ b/src/librustc_lint/lib.rs
@@ -44,7 +44,6 @@ extern crate syntax;
 extern crate rustc;
 #[macro_use]
 extern crate log;
-extern crate rustc_front;
 extern crate rustc_back;
 extern crate rustc_const_eval;
 
diff --git a/src/librustc_lint/types.rs b/src/librustc_lint/types.rs
index 6eeadc77698..891731cb296 100644
--- a/src/librustc_lint/types.rs
+++ b/src/librustc_lint/types.rs
@@ -10,7 +10,7 @@
 
 #![allow(non_snake_case)]
 
-use middle::def_id::DefId;
+use rustc::hir::def_id::DefId;
 use rustc::infer;
 use rustc::ty::subst::Substs;
 use rustc::ty::{self, Ty, TyCtxt};
@@ -29,8 +29,7 @@ use syntax::abi::Abi;
 use syntax::attr::{self, AttrMetaMethods};
 use syntax::codemap::{self, Span};
 
-use rustc_front::hir;
-use rustc_front::util::is_shift_binop;
+use rustc::hir;
 
 register_long_diagnostics! {
 E0519: r##"
@@ -130,7 +129,7 @@ impl LateLintPass for TypeLimits {
                                  "comparison is useless due to type limits");
                 }
 
-                if is_shift_binop(binop.node) {
+                if binop.node.is_shift() {
                     let opt_ty_bits = match cx.tcx.node_id_to_type(l.id).sty {
                         ty::TyInt(t) => Some(int_ty_bits(t, cx.sess().target.int_type)),
                         ty::TyUint(t) => Some(uint_ty_bits(t, cx.sess().target.uint_type)),
diff --git a/src/librustc_lint/unused.rs b/src/librustc_lint/unused.rs
index 9840cd4256f..d1595f243c9 100644
--- a/src/librustc_lint/unused.rs
+++ b/src/librustc_lint/unused.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use middle::pat_util;
+use rustc::hir::pat_util;
 use rustc::ty;
 use rustc::ty::adjustment;
 use util::nodemap::FnvHashMap;
@@ -24,8 +24,8 @@ use syntax::feature_gate::{KNOWN_ATTRIBUTES, AttributeType};
 use syntax::ptr::P;
 
 use rustc_back::slice;
-use rustc_front::hir;
-use rustc_front::intravisit::FnKind;
+use rustc::hir;
+use rustc::hir::intravisit::FnKind;
 
 declare_lint! {
     pub UNUSED_MUT,
diff --git a/src/librustc_metadata/Cargo.toml b/src/librustc_metadata/Cargo.toml
index 65c2c2d1480..697cbe39c67 100644
--- a/src/librustc_metadata/Cargo.toml
+++ b/src/librustc_metadata/Cargo.toml
@@ -16,7 +16,6 @@ rustc = { path = "../librustc" }
 rustc_back = { path = "../librustc_back" }
 rustc_bitflags = { path = "../librustc_bitflags" }
 rustc_const_math = { path = "../librustc_const_math" }
-rustc_front = { path = "../librustc_front" }
 rustc_llvm = { path = "../librustc_llvm" }
 serialize = { path = "../libserialize" }
 syntax = { path = "../libsyntax" }
diff --git a/src/librustc_metadata/astencode.rs b/src/librustc_metadata/astencode.rs
index 505619d31d7..6fd9f27f0fb 100644
--- a/src/librustc_metadata/astencode.rs
+++ b/src/librustc_metadata/astencode.rs
@@ -12,12 +12,13 @@
 // FIXME: remove this after snapshot, and Results are handled
 #![allow(unused_must_use)]
 
-use rustc::front::map as ast_map;
+use rustc::hir::map as ast_map;
 use rustc::session::Session;
 
-use rustc_front::hir;
-use rustc_front::fold;
-use rustc_front::fold::Folder;
+use rustc::hir;
+use rustc::hir::fold;
+use rustc::hir::fold::Folder;
+use rustc::hir::intravisit::{IdRange, IdRangeComputingVisitor, IdVisitingOperation};
 
 use common as c;
 use cstore;
@@ -30,13 +31,13 @@ use middle::cstore::{InlinedItem, InlinedItemRef};
 use rustc::ty::adjustment;
 use rustc::ty::cast;
 use middle::const_qualif::ConstQualif;
-use middle::def::{self, Def};
-use middle::def_id::DefId;
+use rustc::hir::def::{self, Def};
+use rustc::hir::def_id::DefId;
 use middle::region;
 use rustc::ty::subst;
 use rustc::ty::{self, Ty, TyCtxt};
 
-use syntax::{ast, ast_util, codemap};
+use syntax::{ast, codemap};
 use syntax::ast::NodeIdAssigner;
 use syntax::ptr::P;
 
@@ -55,14 +56,14 @@ use serialize::EncoderHelpers;
 #[cfg(test)] use std::io::Cursor;
 #[cfg(test)] use syntax::parse;
 #[cfg(test)] use syntax::ast::NodeId;
-#[cfg(test)] use rustc_front::print::pprust;
-#[cfg(test)] use rustc_front::lowering::{lower_item, LoweringContext};
+#[cfg(test)] use rustc::hir::print as pprust;
+#[cfg(test)] use rustc::hir::lowering::{lower_item, LoweringContext};
 
 struct DecodeContext<'a, 'b, 'tcx: 'a> {
     tcx: &'a TyCtxt<'tcx>,
     cdata: &'b cstore::crate_metadata,
-    from_id_range: ast_util::IdRange,
-    to_id_range: ast_util::IdRange,
+    from_id_range: IdRange,
+    to_id_range: IdRange,
     // Cache the last used filemap for translating spans as an optimization.
     last_filemap_index: Cell<usize>,
 }
@@ -84,7 +85,7 @@ pub fn encode_inlined_item(ecx: &e::EncodeContext,
         InlinedItemRef::ImplItem(_, ii) => ii.id,
     };
     debug!("> Encoding inlined item: {} ({:?})",
-           ecx.tcx.map.path_to_string(id),
+           ecx.tcx.node_path_str(id),
            rbml_w.writer.seek(SeekFrom::Current(0)));
 
     // Folding could be avoided with a smarter encoder.
@@ -98,7 +99,7 @@ pub fn encode_inlined_item(ecx: &e::EncodeContext,
     rbml_w.end_tag();
 
     debug!("< Encoded inlined fn: {} ({:?})",
-           ecx.tcx.map.path_to_string(id),
+           ecx.tcx.node_path_str(id),
            rbml_w.writer.seek(SeekFrom::Current(0)));
 }
 
@@ -123,20 +124,12 @@ impl<'a, 'b, 'c, 'tcx> ast_map::FoldOps for &'a DecodeContext<'b, 'c, 'tcx> {
 /// ast-map.
 pub fn decode_inlined_item<'tcx>(cdata: &cstore::crate_metadata,
                                  tcx: &TyCtxt<'tcx>,
-                                 parent_path: Vec<ast_map::PathElem>,
                                  parent_def_path: ast_map::DefPath,
                                  parent_did: DefId,
                                  ast_doc: rbml::Doc,
                                  orig_did: DefId)
                                  -> &'tcx InlinedItem {
-    let mut path_as_str = None;
-    debug!("> Decoding inlined fn: {:?}::?",
-    {
-        // Do an Option dance to use the path after it is moved below.
-        let s = ast_map::path_to_string(parent_path.iter().cloned());
-        path_as_str = Some(s);
-        path_as_str.as_ref().map(|x| &x[..])
-    });
+    debug!("> Decoding inlined fn: {:?}", tcx.item_path_str(orig_did));
     let mut ast_dsr = reader::Decoder::new(ast_doc);
     let from_id_range = Decodable::decode(&mut ast_dsr).unwrap();
     let to_id_range = reserve_id_range(&tcx.sess, from_id_range);
@@ -148,7 +141,6 @@ pub fn decode_inlined_item<'tcx>(cdata: &cstore::crate_metadata,
         last_filemap_index: Cell::new(0)
     };
     let ii = ast_map::map_decoded_item(&dcx.tcx.map,
-                                       parent_path,
                                        parent_def_path,
                                        parent_did,
                                        decode_ast(ast_doc),
@@ -161,14 +153,14 @@ pub fn decode_inlined_item<'tcx>(cdata: &cstore::crate_metadata,
     };
     debug!("Fn named: {}", name);
     debug!("< Decoded inlined fn: {}::{}",
-            path_as_str.unwrap(),
+            tcx.item_path_str(parent_did),
             name);
     region::resolve_inlined_item(&tcx.sess, &tcx.region_maps, ii);
     decode_side_tables(dcx, ast_doc);
     copy_item_types(dcx, ii, orig_did);
     if let InlinedItem::Item(ref i) = *ii {
         debug!(">>> DECODED ITEM >>>\n{}\n<<< DECODED ITEM <<<",
-               ::rustc_front::print::pprust::item_to_string(&i));
+               ::rustc::hir::print::item_to_string(&i));
     }
 
     ii
@@ -178,13 +170,13 @@ pub fn decode_inlined_item<'tcx>(cdata: &cstore::crate_metadata,
 // Enumerating the IDs which appear in an AST
 
 fn reserve_id_range(sess: &Session,
-                    from_id_range: ast_util::IdRange) -> ast_util::IdRange {
+                    from_id_range: IdRange) -> IdRange {
     // Handle the case of an empty range:
     if from_id_range.empty() { return from_id_range; }
     let cnt = from_id_range.max - from_id_range.min;
     let to_id_min = sess.reserve_node_ids(cnt);
     let to_id_max = to_id_min + cnt;
-    ast_util::IdRange { min: to_id_min, max: to_id_max }
+    IdRange { min: to_id_min, max: to_id_max }
 }
 
 impl<'a, 'b, 'tcx> DecodeContext<'a, 'b, 'tcx> {
@@ -409,20 +401,20 @@ impl tr for Def {
 // ______________________________________________________________________
 // Encoding and decoding of freevar information
 
-fn encode_freevar_entry(rbml_w: &mut Encoder, fv: &ty::Freevar) {
+fn encode_freevar_entry(rbml_w: &mut Encoder, fv: &hir::Freevar) {
     (*fv).encode(rbml_w).unwrap();
 }
 
 trait rbml_decoder_helper {
     fn read_freevar_entry(&mut self, dcx: &DecodeContext)
-                          -> ty::Freevar;
+                          -> hir::Freevar;
     fn read_capture_mode(&mut self) -> hir::CaptureClause;
 }
 
 impl<'a> rbml_decoder_helper for reader::Decoder<'a> {
     fn read_freevar_entry(&mut self, dcx: &DecodeContext)
-                          -> ty::Freevar {
-        let fv: ty::Freevar = Decodable::decode(self).unwrap();
+                          -> hir::Freevar {
+        let fv: hir::Freevar = Decodable::decode(self).unwrap();
         fv.tr(dcx)
     }
 
@@ -432,9 +424,9 @@ impl<'a> rbml_decoder_helper for reader::Decoder<'a> {
     }
 }
 
-impl tr for ty::Freevar {
-    fn tr(&self, dcx: &DecodeContext) -> ty::Freevar {
-        ty::Freevar {
+impl tr for hir::Freevar {
+    fn tr(&self, dcx: &DecodeContext) -> hir::Freevar {
+        hir::Freevar {
             def: self.def.tr(dcx),
             span: self.span.tr(dcx),
         }
@@ -705,7 +697,7 @@ struct SideTableEncodingIdVisitor<'a, 'b:'a, 'c:'a, 'tcx:'c> {
     rbml_w: &'a mut Encoder<'b>,
 }
 
-impl<'a, 'b, 'c, 'tcx> ast_util::IdVisitingOperation for
+impl<'a, 'b, 'c, 'tcx> IdVisitingOperation for
         SideTableEncodingIdVisitor<'a, 'b, 'c, 'tcx> {
     fn visit_id(&mut self, id: ast::NodeId) {
         encode_side_tables_for_id(self.ecx, self.rbml_w, id)
@@ -1261,8 +1253,8 @@ fn copy_item_types(dcx: &DecodeContext, ii: &InlinedItem, orig_did: DefId) {
     }
 }
 
-fn inlined_item_id_range(v: &InlinedItem) -> ast_util::IdRange {
-    let mut visitor = ast_util::IdRangeComputingVisitor::new();
+fn inlined_item_id_range(v: &InlinedItem) -> IdRange {
+    let mut visitor = IdRangeComputingVisitor::new();
     v.visit_ids(&mut visitor);
     visitor.result()
 }
diff --git a/src/librustc_metadata/common.rs b/src/librustc_metadata/common.rs
index 22a5289f02b..ea4e2575420 100644
--- a/src/librustc_metadata/common.rs
+++ b/src/librustc_metadata/common.rs
@@ -86,13 +86,10 @@ pub const tag_item_trait_ref: usize = 0x3b;
 // discriminator value for variants
 pub const tag_disr_val: usize = 0x3c;
 
-// used to encode ast_map::PathElem
-pub const tag_path: usize = 0x3d;
-pub const tag_path_len: usize = 0x3e;
-pub const tag_path_elem_mod: usize = 0x3f;
-pub const tag_path_elem_name: usize = 0x40;
-pub const tag_item_field: usize = 0x41;
+// GAP 0x3d, 0x3e, 0x3f, 0x40
 
+pub const tag_item_field: usize = 0x41;
+// GAP 0x42
 pub const tag_item_variances: usize = 0x43;
 /*
   trait items contain tag_item_trait_item elements,
diff --git a/src/librustc_metadata/creader.rs b/src/librustc_metadata/creader.rs
index edabf43a150..df9072835b9 100644
--- a/src/librustc_metadata/creader.rs
+++ b/src/librustc_metadata/creader.rs
@@ -17,13 +17,13 @@ use cstore::{self, CStore, CrateSource, MetadataBlob};
 use decoder;
 use loader::{self, CratePaths};
 
-use rustc::back::svh::Svh;
+use rustc::hir::svh::Svh;
 use rustc::dep_graph::DepNode;
 use rustc::session::{config, Session};
 use rustc::session::search_paths::PathKind;
 use rustc::middle::cstore::{CrateStore, validate_crate_name, ExternCrate};
 use rustc::util::nodemap::FnvHashMap;
-use rustc::front::map as hir_map;
+use rustc::hir::map as hir_map;
 
 use std::cell::{RefCell, Cell};
 use std::path::PathBuf;
@@ -37,8 +37,8 @@ use syntax::parse;
 use syntax::attr;
 use syntax::attr::AttrMetaMethods;
 use syntax::parse::token::InternedString;
-use rustc_front::intravisit::Visitor;
-use rustc_front::hir;
+use rustc::hir::intravisit::Visitor;
+use rustc::hir;
 use log;
 
 pub struct LocalCrateReader<'a, 'b:'a> {
diff --git a/src/librustc_metadata/csearch.rs b/src/librustc_metadata/csearch.rs
index c11d9865516..0b90ad5b4e2 100644
--- a/src/librustc_metadata/csearch.rs
+++ b/src/librustc_metadata/csearch.rs
@@ -15,12 +15,12 @@ use loader;
 
 use middle::cstore::{CrateStore, CrateSource, ChildItem, ExternCrate, FoundAst, DefLike};
 use middle::cstore::{NativeLibraryKind, LinkMeta, LinkagePreference};
-use middle::def;
+use rustc::hir::def;
 use middle::lang_items;
 use rustc::ty::{self, Ty, TyCtxt, VariantKind};
-use middle::def_id::{DefId, DefIndex, CRATE_DEF_INDEX};
+use rustc::hir::def_id::{DefId, DefIndex, CRATE_DEF_INDEX};
 
-use rustc::front::map as hir_map;
+use rustc::hir::map as hir_map;
 use rustc::mir::repr::Mir;
 use rustc::mir::mir_map::MirMap;
 use rustc::util::nodemap::{FnvHashMap, NodeMap, NodeSet, DefIdMap};
@@ -31,9 +31,9 @@ use std::path::PathBuf;
 use syntax::ast;
 use syntax::attr;
 use syntax::parse::token;
-use rustc_back::svh::Svh;
+use rustc::hir::svh::Svh;
 use rustc_back::target::Target;
-use rustc_front::hir;
+use rustc::hir;
 
 impl<'tcx> CrateStore<'tcx> for cstore::CStore {
     fn stability(&self, def: DefId) -> Option<attr::Stability>
@@ -128,22 +128,6 @@ impl<'tcx> CrateStore<'tcx> for cstore::CStore {
         decoder::get_method_arg_names(&cdata, did.index)
     }
 
-    fn relative_item_path(&self, def: DefId) -> Vec<hir_map::PathElem> {
-        let cdata = self.get_crate_data(def.krate);
-        decoder::get_item_path(&cdata, def.index)
-    }
-
-    fn extern_item_path(&self, def: DefId) -> Vec<hir_map::PathElem> {
-        let cdata = self.get_crate_data(def.krate);
-        let path = decoder::get_item_path(&cdata, def.index);
-
-        let mut r = Vec::with_capacity(path.len() + 1);
-        let crate_name = hir_map::PathMod(token::intern(&cdata.name));
-        r.push(crate_name);
-        r.extend_from_slice(&path);
-        r
-    }
-
     fn item_name(&self, def: DefId) -> ast::Name {
         let cdata = self.get_crate_data(def.krate);
         decoder::get_item_name(&self.intr, &cdata, def.index)
@@ -552,7 +536,7 @@ impl<'tcx> CrateStore<'tcx> for cstore::CStore {
         let mut visible_parent_map = self.visible_parent_map.borrow_mut();
         if !visible_parent_map.is_empty() { return visible_parent_map; }
 
-        use rustc_front::hir;
+        use rustc::hir;
         use rustc::middle::cstore::{CrateStore, ChildItem};
         use std::collections::vec_deque::VecDeque;
         use std::collections::hash_map::Entry;
diff --git a/src/librustc_metadata/cstore.rs b/src/librustc_metadata/cstore.rs
index 5637301724b..d5a9adafe7d 100644
--- a/src/librustc_metadata/cstore.rs
+++ b/src/librustc_metadata/cstore.rs
@@ -20,10 +20,10 @@ use decoder;
 use index;
 use loader;
 
-use rustc::back::svh::Svh;
+use rustc::hir::def_id::DefId;
+use rustc::hir::svh::Svh;
 use rustc::middle::cstore::{ExternCrate};
 use rustc::util::nodemap::{FnvHashMap, NodeMap, NodeSet, DefIdMap};
-use rustc::middle::def_id::DefId;
 
 use std::cell::{RefCell, Ref, Cell};
 use std::rc::Rc;
diff --git a/src/librustc_metadata/decoder.rs b/src/librustc_metadata/decoder.rs
index e85fdb05ca8..6b53edbbff1 100644
--- a/src/librustc_metadata/decoder.rs
+++ b/src/librustc_metadata/decoder.rs
@@ -22,15 +22,15 @@ use index;
 use tls_context;
 use tydecode::TyDecoder;
 
-use rustc::back::svh::Svh;
-use rustc::front::map as hir_map;
+use rustc::hir::svh::Svh;
+use rustc::hir::map as hir_map;
 use rustc::util::nodemap::FnvHashMap;
-use rustc_front::hir;
+use rustc::hir;
 
 use middle::cstore::{LOCAL_CRATE, FoundAst, InlinedItem, LinkagePreference};
 use middle::cstore::{DefLike, DlDef, DlField, DlImpl, tls};
-use middle::def::Def;
-use middle::def_id::{DefId, DefIndex};
+use rustc::hir::def::Def;
+use rustc::hir::def_id::{DefId, DefIndex};
 use middle::lang_items;
 use rustc::ty::subst;
 use rustc::ty::{ImplContainer, TraitContainer};
@@ -255,22 +255,6 @@ fn item_trait_ref<'tcx>(doc: rbml::Doc, tcx: &TyCtxt<'tcx>, cdata: Cmd)
     doc_trait_ref(tp, tcx, cdata)
 }
 
-fn item_path(item_doc: rbml::Doc) -> Vec<hir_map::PathElem> {
-    let path_doc = reader::get_doc(item_doc, tag_path);
-    reader::docs(path_doc).filter_map(|(tag, elt_doc)| {
-        if tag == tag_path_elem_mod {
-            let s = elt_doc.as_str_slice();
-            Some(hir_map::PathMod(token::intern(s)))
-        } else if tag == tag_path_elem_name {
-            let s = elt_doc.as_str_slice();
-            Some(hir_map::PathName(token::intern(s)))
-        } else {
-            // ignore tag_path_len element
-            None
-        }
-    }).collect()
-}
-
 fn item_name(intr: &IdentInterner, item: rbml::Doc) -> ast::Name {
     let name = reader::get_doc(item, tag_paths_data_name);
     let string = name.as_str_slice();
@@ -786,10 +770,6 @@ pub fn each_top_level_item_of_crate<F, G>(intr: Rc<IdentInterner>,
                                 callback)
 }
 
-pub fn get_item_path(cdata: Cmd, id: DefIndex) -> Vec<hir_map::PathElem> {
-    item_path(cdata.lookup_item(id))
-}
-
 pub fn get_item_name(intr: &IdentInterner, cdata: Cmd, id: DefIndex) -> ast::Name {
     item_name(intr, cdata.lookup_item(id))
 }
@@ -803,14 +783,11 @@ pub fn maybe_get_item_ast<'tcx>(cdata: Cmd, tcx: &TyCtxt<'tcx>, id: DefIndex)
         krate: cdata.cnum,
         index: def_key(cdata, id).parent.unwrap()
     };
-    let mut parent_path = item_path(item_doc);
-    parent_path.pop();
     let mut parent_def_path = def_path(cdata, id);
     parent_def_path.data.pop();
     if let Some(ast_doc) = reader::maybe_get_doc(item_doc, tag_ast as usize) {
         let ii = decode_inlined_item(cdata,
                                      tcx,
-                                     parent_path,
                                      parent_def_path,
                                      parent_def_id,
                                      ast_doc,
@@ -823,15 +800,12 @@ pub fn maybe_get_item_ast<'tcx>(cdata: Cmd, tcx: &TyCtxt<'tcx>, id: DefIndex)
             krate: cdata.cnum,
             index: def_key(cdata, parent_def_id.index).parent.unwrap()
         };
-        let mut grandparent_path = parent_path;
-        grandparent_path.pop();
         let mut grandparent_def_path = parent_def_path;
         grandparent_def_path.data.pop();
         let parent_doc = cdata.lookup_item(parent_did.index);
         if let Some(ast_doc) = reader::maybe_get_doc(parent_doc, tag_ast as usize) {
             let ii = decode_inlined_item(cdata,
                                          tcx,
-                                         grandparent_path,
                                          grandparent_def_path,
                                          grandparent_def_id,
                                          ast_doc,
diff --git a/src/librustc_metadata/encoder.rs b/src/librustc_metadata/encoder.rs
index 30eabb7e8f3..d45650159e3 100644
--- a/src/librustc_metadata/encoder.rs
+++ b/src/librustc_metadata/encoder.rs
@@ -21,8 +21,8 @@ use tyencode;
 use index::{self, IndexData};
 
 use middle::cstore::{LOCAL_CRATE, CrateStore, InlinedItemRef, LinkMeta, tls};
-use middle::def;
-use middle::def_id::{CRATE_DEF_INDEX, DefId};
+use rustc::hir::def;
+use rustc::hir::def_id::{CRATE_DEF_INDEX, DefId};
 use middle::dependency_format::Linkage;
 use middle::stability;
 use rustc::ty::subst;
@@ -30,9 +30,7 @@ use rustc::traits::specialization_graph;
 use rustc::ty::{self, Ty, TyCtxt};
 use rustc::ty::util::IntTypeExt;
 
-use rustc::back::svh::Svh;
-use rustc::front::map::{LinkedPath, PathElem, PathElems};
-use rustc::front::map as ast_map;
+use rustc::hir::svh::Svh;
 use rustc::mir::mir_map::MirMap;
 use rustc::session::config;
 use rustc::util::nodemap::{FnvHashMap, NodeMap, NodeSet};
@@ -52,9 +50,9 @@ use syntax::errors::Handler;
 use syntax;
 use rbml::writer::Encoder;
 
-use rustc_front::hir::{self, PatKind};
-use rustc_front::intravisit::Visitor;
-use rustc_front::intravisit;
+use rustc::hir::{self, PatKind};
+use rustc::hir::intravisit::Visitor;
+use rustc::hir::intravisit;
 
 pub struct EncodeContext<'a, 'tcx: 'a> {
     pub diag: &'a Handler,
@@ -300,26 +298,11 @@ fn encode_enum_variant_info<'a, 'tcx>(ecx: &EncodeContext<'a, 'tcx>,
         }
         encode_bounds_and_type_for_item(rbml_w, ecx, index, variant_node_id);
 
-        ecx.tcx.map.with_path(variant_node_id, |path| encode_path(rbml_w, path));
         rbml_w.end_tag();
         disr_val = disr_val.wrap_incr();
     }
 }
 
-fn encode_path<PI: Iterator<Item=PathElem>>(rbml_w: &mut Encoder, path: PI) {
-    let path = path.collect::<Vec<_>>();
-    rbml_w.start_tag(tag_path);
-    rbml_w.wr_tagged_u32(tag_path_len, path.len() as u32);
-    for pe in &path {
-        let tag = match *pe {
-            ast_map::PathMod(_) => tag_path_elem_mod,
-            ast_map::PathName(_) => tag_path_elem_name
-        };
-        rbml_w.wr_tagged_str(tag, &pe.name().as_str());
-    }
-    rbml_w.end_tag();
-}
-
 /// Iterates through "auxiliary node IDs", which are node IDs that describe
 /// top-level items that are sub-items of the given item. Specifically:
 ///
@@ -371,7 +354,6 @@ fn encode_info_for_mod(ecx: &EncodeContext,
                        md: &hir::Mod,
                        attrs: &[ast::Attribute],
                        id: NodeId,
-                       path: PathElems,
                        name: Name,
                        vis: hir::Visibility) {
     rbml_w.start_tag(tag_items_data_item);
@@ -393,7 +375,6 @@ fn encode_info_for_mod(ecx: &EncodeContext,
         });
     }
 
-    encode_path(rbml_w, path.clone());
     encode_visibility(rbml_w, vis);
 
     let stab = stability::lookup_stability(ecx.tcx, ecx.tcx.map.local_def_id(id));
@@ -521,7 +502,6 @@ fn encode_info_for_struct_ctor<'a, 'tcx>(ecx: &EncodeContext<'a, 'tcx>,
     });
     encode_bounds_and_type_for_item(rbml_w, ecx, index, ctor_id);
     encode_name(rbml_w, name);
-    ecx.tcx.map.with_path(ctor_id, |path| encode_path(rbml_w, path));
     encode_parent_item(rbml_w, ecx.tcx.map.local_def_id(struct_id));
 
     if ecx.item_symbols.borrow().contains_key(&ctor_id) {
@@ -637,7 +617,6 @@ fn encode_info_for_associated_const<'a, 'tcx>(ecx: &EncodeContext<'a, 'tcx>,
                                               rbml_w: &mut Encoder,
                                               index: &mut CrateIndex<'tcx>,
                                               associated_const: &ty::AssociatedConst,
-                                              impl_path: PathElems,
                                               parent_id: NodeId,
                                               impl_item_opt: Option<&hir::ImplItem>) {
     debug!("encode_info_for_associated_const({:?},{:?})",
@@ -663,9 +642,6 @@ fn encode_info_for_associated_const<'a, 'tcx>(ecx: &EncodeContext<'a, 'tcx>,
     encode_stability(rbml_w, stab);
     encode_deprecation(rbml_w, depr);
 
-    let elem = ast_map::PathName(associated_const.name);
-    encode_path(rbml_w, impl_path.chain(Some(elem)));
-
     if let Some(ii) = impl_item_opt {
         encode_attributes(rbml_w, &ii.attrs);
         encode_defaultness(rbml_w, ii.defaultness);
@@ -683,7 +659,6 @@ fn encode_info_for_method<'a, 'tcx>(ecx: &EncodeContext<'a, 'tcx>,
                                     rbml_w: &mut Encoder,
                                     index: &mut CrateIndex<'tcx>,
                                     m: &ty::Method<'tcx>,
-                                    impl_path: PathElems,
                                     is_default_impl: bool,
                                     parent_id: NodeId,
                                     impl_item_opt: Option<&hir::ImplItem>) {
@@ -705,8 +680,6 @@ fn encode_info_for_method<'a, 'tcx>(ecx: &EncodeContext<'a, 'tcx>,
     let m_node_id = ecx.local_id(m.def_id);
     encode_bounds_and_type_for_item(rbml_w, ecx, index, m_node_id);
 
-    let elem = ast_map::PathName(m.name);
-    encode_path(rbml_w, impl_path.chain(Some(elem)));
     if let Some(impl_item) = impl_item_opt {
         if let hir::ImplItemKind::Method(ref sig, _) = impl_item.node {
             encode_attributes(rbml_w, &impl_item.attrs);
@@ -738,7 +711,6 @@ fn encode_info_for_associated_type<'a, 'tcx>(ecx: &EncodeContext<'a, 'tcx>,
                                              rbml_w: &mut Encoder,
                                              index: &mut CrateIndex<'tcx>,
                                              associated_type: &ty::AssociatedType<'tcx>,
-                                             impl_path: PathElems,
                                              parent_id: NodeId,
                                              impl_item_opt: Option<&hir::ImplItem>) {
     debug!("encode_info_for_associated_type({:?},{:?})",
@@ -760,9 +732,6 @@ fn encode_info_for_associated_type<'a, 'tcx>(ecx: &EncodeContext<'a, 'tcx>,
     encode_stability(rbml_w, stab);
     encode_deprecation(rbml_w, depr);
 
-    let elem = ast_map::PathName(associated_type.name);
-    encode_path(rbml_w, impl_path.chain(Some(elem)));
-
     if let Some(ii) = impl_item_opt {
         encode_attributes(rbml_w, &ii.attrs);
         encode_defaultness(rbml_w, ii.defaultness);
@@ -886,14 +855,13 @@ fn encode_xrefs<'a, 'tcx>(ecx: &EncodeContext<'a, 'tcx>,
 fn encode_info_for_item<'a, 'tcx>(ecx: &EncodeContext<'a, 'tcx>,
                                   rbml_w: &mut Encoder,
                                   item: &hir::Item,
-                                  index: &mut CrateIndex<'tcx>,
-                                  path: PathElems,
-                                  vis: hir::Visibility) {
+                                  index: &mut CrateIndex<'tcx>) {
     let tcx = ecx.tcx;
 
     debug!("encoding info for item at {}",
            tcx.sess.codemap().span_to_string(item.span));
 
+    let vis = item.vis;
     let def_id = ecx.tcx.map.local_def_id(item.id);
     let stab = stability::lookup_stability(tcx, ecx.tcx.map.local_def_id(item.id));
     let depr = stability::lookup_deprecation(tcx, ecx.tcx.map.local_def_id(item.id));
@@ -911,7 +879,6 @@ fn encode_info_for_item<'a, 'tcx>(ecx: &EncodeContext<'a, 'tcx>,
         encode_bounds_and_type_for_item(rbml_w, ecx, index, item.id);
         encode_symbol(ecx, rbml_w, item.id);
         encode_name(rbml_w, item.name);
-        encode_path(rbml_w, path);
         encode_visibility(rbml_w, vis);
         encode_stability(rbml_w, stab);
         encode_deprecation(rbml_w, depr);
@@ -925,7 +892,6 @@ fn encode_info_for_item<'a, 'tcx>(ecx: &EncodeContext<'a, 'tcx>,
         encode_family(rbml_w, 'C');
         encode_bounds_and_type_for_item(rbml_w, ecx, index, item.id);
         encode_name(rbml_w, item.name);
-        encode_path(rbml_w, path);
         encode_attributes(rbml_w, &item.attrs);
         encode_inlined_item(ecx, rbml_w, InlinedItemRef::Item(item));
         encode_mir(ecx, rbml_w, item.id);
@@ -942,7 +908,6 @@ fn encode_info_for_item<'a, 'tcx>(ecx: &EncodeContext<'a, 'tcx>,
         let tps_len = generics.ty_params.len();
         encode_bounds_and_type_for_item(rbml_w, ecx, index, item.id);
         encode_name(rbml_w, item.name);
-        encode_path(rbml_w, path);
         encode_attributes(rbml_w, &item.attrs);
         let needs_inline = tps_len > 0 || attr::requests_inline(&item.attrs);
         if needs_inline || constness == hir::Constness::Const {
@@ -966,7 +931,6 @@ fn encode_info_for_item<'a, 'tcx>(ecx: &EncodeContext<'a, 'tcx>,
                             m,
                             &item.attrs,
                             item.id,
-                            path,
                             item.name,
                             item.vis);
       }
@@ -976,7 +940,6 @@ fn encode_info_for_item<'a, 'tcx>(ecx: &EncodeContext<'a, 'tcx>,
         encode_def_id_and_key(ecx, rbml_w, def_id);
         encode_family(rbml_w, 'n');
         encode_name(rbml_w, item.name);
-        encode_path(rbml_w, path);
 
         // Encode all the items in this module.
         for foreign_item in &fm.items {
@@ -995,7 +958,6 @@ fn encode_info_for_item<'a, 'tcx>(ecx: &EncodeContext<'a, 'tcx>,
         encode_family(rbml_w, 'y');
         encode_bounds_and_type_for_item(rbml_w, ecx, index, item.id);
         encode_name(rbml_w, item.name);
-        encode_path(rbml_w, path);
         encode_visibility(rbml_w, vis);
         encode_stability(rbml_w, stab);
         encode_deprecation(rbml_w, depr);
@@ -1017,7 +979,6 @@ fn encode_info_for_item<'a, 'tcx>(ecx: &EncodeContext<'a, 'tcx>,
         }
         encode_inlined_item(ecx, rbml_w, InlinedItemRef::Item(item));
         encode_mir(ecx, rbml_w, item.id);
-        encode_path(rbml_w, path);
 
         // Encode inherent implementations for this enumeration.
         encode_inherent_implementations(ecx, rbml_w, def_id);
@@ -1053,7 +1014,6 @@ fn encode_info_for_item<'a, 'tcx>(ecx: &EncodeContext<'a, 'tcx>,
         encode_item_variances(rbml_w, ecx, item.id);
         encode_name(rbml_w, item.name);
         encode_attributes(rbml_w, &item.attrs);
-        encode_path(rbml_w, path.clone());
         encode_stability(rbml_w, stab);
         encode_deprecation(rbml_w, depr);
         encode_visibility(rbml_w, vis);
@@ -1156,7 +1116,6 @@ fn encode_info_for_item<'a, 'tcx>(ecx: &EncodeContext<'a, 'tcx>,
                 });
             encode_parent_impl(rbml_w, parent);
         }
-        encode_path(rbml_w, path.clone());
         encode_stability(rbml_w, stab);
         encode_deprecation(rbml_w, depr);
         rbml_w.end_tag();
@@ -1179,7 +1138,6 @@ fn encode_info_for_item<'a, 'tcx>(ecx: &EncodeContext<'a, 'tcx>,
                                                      rbml_w,
                                                      index,
                                                      &associated_const,
-                                                     path.clone(),
                                                      item.id,
                                                      ast_item)
                 }
@@ -1188,7 +1146,6 @@ fn encode_info_for_item<'a, 'tcx>(ecx: &EncodeContext<'a, 'tcx>,
                                            rbml_w,
                                            index,
                                            &method_type,
-                                           path.clone(),
                                            false,
                                            item.id,
                                            ast_item)
@@ -1198,7 +1155,6 @@ fn encode_info_for_item<'a, 'tcx>(ecx: &EncodeContext<'a, 'tcx>,
                                                     rbml_w,
                                                     index,
                                                     &associated_type,
-                                                    path.clone(),
                                                     item.id,
                                                     ast_item)
                 }
@@ -1250,7 +1206,6 @@ fn encode_info_for_item<'a, 'tcx>(ecx: &EncodeContext<'a, 'tcx>,
             rbml_w.wr_tagged_u64(tag_mod_child,
                                  def_to_u64(method_def_id.def_id()));
         }
-        encode_path(rbml_w, path.clone());
 
         // Encode inherent implementations for this trait.
         encode_inherent_implementations(ecx, rbml_w, def_id);
@@ -1281,10 +1236,6 @@ fn encode_info_for_item<'a, 'tcx>(ecx: &EncodeContext<'a, 'tcx>,
                     encode_def_id_and_key(ecx, rbml_w, associated_const.def_id);
                     encode_visibility(rbml_w, associated_const.vis);
 
-                    let elem = ast_map::PathName(associated_const.name);
-                    encode_path(rbml_w,
-                                path.clone().chain(Some(elem)));
-
                     encode_family(rbml_w, 'C');
 
                     encode_bounds_and_type_for_item(rbml_w, ecx, index,
@@ -1297,10 +1248,6 @@ fn encode_info_for_item<'a, 'tcx>(ecx: &EncodeContext<'a, 'tcx>,
 
                     encode_method_ty_fields(ecx, rbml_w, index, &method_ty);
 
-                    let elem = ast_map::PathName(method_ty.name);
-                    encode_path(rbml_w,
-                                path.clone().chain(Some(elem)));
-
                     match method_ty.explicit_self {
                         ty::ExplicitSelfCategory::Static => {
                             encode_family(rbml_w,
@@ -1320,11 +1267,6 @@ fn encode_info_for_item<'a, 'tcx>(ecx: &EncodeContext<'a, 'tcx>,
                 ty::TypeTraitItem(associated_type) => {
                     encode_name(rbml_w, associated_type.name);
                     encode_def_id_and_key(ecx, rbml_w, associated_type.def_id);
-
-                    let elem = ast_map::PathName(associated_type.name);
-                    encode_path(rbml_w,
-                                path.clone().chain(Some(elem)));
-
                     encode_item_sort(rbml_w, 't');
                     encode_family(rbml_w, 'y');
 
@@ -1386,10 +1328,10 @@ fn encode_info_for_item<'a, 'tcx>(ecx: &EncodeContext<'a, 'tcx>,
 fn encode_info_for_foreign_item<'a, 'tcx>(ecx: &EncodeContext<'a, 'tcx>,
                                           rbml_w: &mut Encoder,
                                           nitem: &hir::ForeignItem,
-                                          index: &mut CrateIndex<'tcx>,
-                                          path: PathElems,
-                                          abi: Abi) {
+                                          index: &mut CrateIndex<'tcx>) {
+    debug!("writing foreign item {}", ecx.tcx.node_path_str(nitem.id));
     let def_id = ecx.tcx.map.local_def_id(nitem.id);
+    let abi = ecx.tcx.map.get_foreign_abi(nitem.id);
 
     index.record(def_id, rbml_w);
     rbml_w.start_tag(tag_items_data_item);
@@ -1429,7 +1371,6 @@ fn encode_info_for_foreign_item<'a, 'tcx>(ecx: &EncodeContext<'a, 'tcx>,
         encode_name(rbml_w, nitem.name);
       }
     }
-    encode_path(rbml_w, path);
     rbml_w.end_tag();
 }
 
@@ -1454,8 +1395,6 @@ fn my_visit_expr(expr: &hir::Expr,
             ecx.tcx.closure_kind(def_id).encode(rbml_w).unwrap();
             rbml_w.end_tag();
 
-            ecx.tcx.map.with_path(expr.id, |path| encode_path(rbml_w, path));
-
             assert!(ecx.mir_map.map.contains_key(&expr.id));
             encode_mir(ecx, rbml_w, expr.id);
 
@@ -1465,31 +1404,6 @@ fn my_visit_expr(expr: &hir::Expr,
     }
 }
 
-fn my_visit_item<'a, 'tcx>(i: &hir::Item,
-                           rbml_w: &mut Encoder,
-                           ecx: &EncodeContext<'a, 'tcx>,
-                           index: &mut CrateIndex<'tcx>) {
-    ecx.tcx.map.with_path(i.id, |path| {
-        encode_info_for_item(ecx, rbml_w, i, index, path, i.vis);
-    });
-}
-
-fn my_visit_foreign_item<'a, 'tcx>(ni: &hir::ForeignItem,
-                                   rbml_w: &mut Encoder,
-                                   ecx: &EncodeContext<'a, 'tcx>,
-                                   index: &mut CrateIndex<'tcx>) {
-    debug!("writing foreign item {}::{}",
-            ecx.tcx.map.path_to_string(ni.id),
-            ni.name);
-
-    let abi = ecx.tcx.map.get_foreign_abi(ni.id);
-    ecx.tcx.map.with_path(ni.id, |path| {
-        encode_info_for_foreign_item(ecx, rbml_w,
-                                     ni, index,
-                                     path, abi);
-    });
-}
-
 struct EncodeVisitor<'a, 'b:'a, 'c:'a, 'tcx:'c> {
     rbml_w_for_visit_item: &'a mut Encoder<'b>,
     ecx: &'a EncodeContext<'c,'tcx>,
@@ -1503,11 +1417,11 @@ impl<'a, 'b, 'c, 'tcx> Visitor<'tcx> for EncodeVisitor<'a, 'b, 'c, 'tcx> {
     }
     fn visit_item(&mut self, i: &'tcx hir::Item) {
         intravisit::walk_item(self, i);
-        my_visit_item(i, self.rbml_w_for_visit_item, self.ecx, self.index);
+        encode_info_for_item(self.ecx, self.rbml_w_for_visit_item, i, self.index);
     }
     fn visit_foreign_item(&mut self, ni: &'tcx hir::ForeignItem) {
         intravisit::walk_foreign_item(self, ni);
-        my_visit_foreign_item(ni, self.rbml_w_for_visit_item, self.ecx, self.index);
+        encode_info_for_foreign_item(self.ecx, self.rbml_w_for_visit_item, ni, self.index);
     }
 }
 
@@ -1528,7 +1442,6 @@ fn encode_info_for_items<'a, 'tcx>(ecx: &EncodeContext<'a, 'tcx>,
                         &krate.module,
                         &[],
                         CRATE_NODE_ID,
-                        [].iter().cloned().chain(LinkedPath::empty()),
                         syntax::parse::token::intern(&ecx.link_meta.crate_name),
                         hir::Public);
 
diff --git a/src/librustc_metadata/index.rs b/src/librustc_metadata/index.rs
index 60bbdaddd75..9c066f9f5f1 100644
--- a/src/librustc_metadata/index.rs
+++ b/src/librustc_metadata/index.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use middle::def_id::{DefId, DefIndex};
+use rustc::hir::def_id::{DefId, DefIndex};
 use rbml;
 use std::io::{Cursor, Write};
 use std::slice;
diff --git a/src/librustc_metadata/lib.rs b/src/librustc_metadata/lib.rs
index c927f53eccd..139462d41bf 100644
--- a/src/librustc_metadata/lib.rs
+++ b/src/librustc_metadata/lib.rs
@@ -36,7 +36,6 @@ extern crate serialize;
 #[macro_use]
 extern crate rustc;
 extern crate rustc_back;
-extern crate rustc_front;
 extern crate rustc_llvm;
 extern crate rustc_const_math;
 
diff --git a/src/librustc_metadata/loader.rs b/src/librustc_metadata/loader.rs
index 87e86e221f1..c7cd8ae2dd7 100644
--- a/src/librustc_metadata/loader.rs
+++ b/src/librustc_metadata/loader.rs
@@ -216,7 +216,7 @@ use cstore::{MetadataBlob, MetadataVec, MetadataArchive};
 use decoder;
 use encoder;
 
-use rustc::back::svh::Svh;
+use rustc::hir::svh::Svh;
 use rustc::session::Session;
 use rustc::session::filesearch::{FileSearch, FileMatches, FileDoesntMatch};
 use rustc::session::search_paths::PathKind;
diff --git a/src/librustc_metadata/tls_context.rs b/src/librustc_metadata/tls_context.rs
index 6ecd7a7f50a..782c7cba26e 100644
--- a/src/librustc_metadata/tls_context.rs
+++ b/src/librustc_metadata/tls_context.rs
@@ -14,7 +14,7 @@
 use rbml::opaque::Encoder as OpaqueEncoder;
 use rbml::opaque::Decoder as OpaqueDecoder;
 use rustc::middle::cstore::tls;
-use rustc::middle::def_id::DefId;
+use rustc::hir::def_id::DefId;
 use rustc::ty::subst::Substs;
 use rustc::ty::{self, TyCtxt};
 
diff --git a/src/librustc_metadata/tydecode.rs b/src/librustc_metadata/tydecode.rs
index 28985c75a91..3004246d1d7 100644
--- a/src/librustc_metadata/tydecode.rs
+++ b/src/librustc_metadata/tydecode.rs
@@ -16,9 +16,9 @@
 
 #![allow(non_camel_case_types)]
 
-use rustc_front::hir;
+use rustc::hir;
 
-use middle::def_id::{DefId, DefIndex};
+use rustc::hir::def_id::{DefId, DefIndex};
 use middle::region;
 use rustc::ty::subst;
 use rustc::ty::subst::VecPerParamSpace;
diff --git a/src/librustc_metadata/tyencode.rs b/src/librustc_metadata/tyencode.rs
index ffaf7e2d465..f49c2e22c6a 100644
--- a/src/librustc_metadata/tyencode.rs
+++ b/src/librustc_metadata/tyencode.rs
@@ -17,7 +17,7 @@ use std::cell::RefCell;
 use std::io::Cursor;
 use std::io::prelude::*;
 
-use middle::def_id::DefId;
+use rustc::hir::def_id::DefId;
 use middle::region;
 use rustc::ty::subst;
 use rustc::ty::subst::VecPerParamSpace;
@@ -25,7 +25,7 @@ use rustc::ty::ParamTy;
 use rustc::ty::{self, Ty, TyCtxt};
 use rustc::util::nodemap::FnvHashMap;
 
-use rustc_front::hir;
+use rustc::hir;
 
 use syntax::abi::Abi;
 use syntax::ast;
diff --git a/src/librustc_mir/Cargo.toml b/src/librustc_mir/Cargo.toml
index f136618b1c9..1c41ca6f416 100644
--- a/src/librustc_mir/Cargo.toml
+++ b/src/librustc_mir/Cargo.toml
@@ -16,5 +16,4 @@ rustc_back = { path = "../librustc_back" }
 rustc_const_eval = { path = "../librustc_const_eval" }
 rustc_const_math = { path = "../librustc_const_math" }
 rustc_data_structures = { path = "../librustc_data_structures" }
-rustc_front = { path = "../librustc_front" }
 syntax = { path = "../libsyntax" }
diff --git a/src/librustc_mir/build/block.rs b/src/librustc_mir/build/block.rs
index ef48a408e79..8c98408e239 100644
--- a/src/librustc_mir/build/block.rs
+++ b/src/librustc_mir/build/block.rs
@@ -11,7 +11,7 @@
 use build::{BlockAnd, BlockAndExtension, Builder};
 use hair::*;
 use rustc::mir::repr::*;
-use rustc_front::hir;
+use rustc::hir;
 
 impl<'a,'tcx> Builder<'a,'tcx> {
     pub fn ast_block(&mut self,
diff --git a/src/librustc_mir/build/mod.rs b/src/librustc_mir/build/mod.rs
index 51069c38857..2e5b6a952b7 100644
--- a/src/librustc_mir/build/mod.rs
+++ b/src/librustc_mir/build/mod.rs
@@ -13,7 +13,7 @@ use rustc::middle::region::{CodeExtent, CodeExtentData};
 use rustc::ty::{FnOutput, Ty};
 use rustc::mir::repr::*;
 use rustc_data_structures::fnv::FnvHashMap;
-use rustc_front::hir;
+use rustc::hir;
 use std::ops::{Index, IndexMut};
 use syntax::ast;
 use syntax::codemap::Span;
diff --git a/src/librustc_mir/graphviz.rs b/src/librustc_mir/graphviz.rs
index 959b1fdef52..069bd7826bc 100644
--- a/src/librustc_mir/graphviz.rs
+++ b/src/librustc_mir/graphviz.rs
@@ -118,7 +118,7 @@ fn write_edges<W: Write>(source: BasicBlock, mir: &Mir, w: &mut W) -> io::Result
 /// all the variables and temporaries.
 fn write_graph_label<W: Write>(tcx: &ty::TyCtxt, nid: NodeId, mir: &Mir, w: &mut W)
 -> io::Result<()> {
-    write!(w, "    label=<fn {}(", dot::escape_html(&tcx.map.path_to_string(nid)))?;
+    write!(w, "    label=<fn {}(", dot::escape_html(&tcx.node_path_str(nid)))?;
 
     // fn argument types.
     for (i, arg) in mir.arg_decls.iter().enumerate() {
diff --git a/src/librustc_mir/hair/cx/block.rs b/src/librustc_mir/hair/cx/block.rs
index c7af42b776f..f0ed25902f7 100644
--- a/src/librustc_mir/hair/cx/block.rs
+++ b/src/librustc_mir/hair/cx/block.rs
@@ -12,7 +12,7 @@ use hair::*;
 use hair::cx::Cx;
 use hair::cx::to_ref::ToRef;
 use rustc::middle::region::{BlockRemainder, CodeExtentData};
-use rustc_front::hir;
+use rustc::hir;
 use syntax::ast;
 
 impl<'tcx> Mirror<'tcx> for &'tcx hir::Block {
diff --git a/src/librustc_mir/hair/cx/expr.rs b/src/librustc_mir/hair/cx/expr.rs
index 7e16883e754..12dcb32da3f 100644
--- a/src/librustc_mir/hair/cx/expr.rs
+++ b/src/librustc_mir/hair/cx/expr.rs
@@ -14,16 +14,15 @@ use rustc_const_math::ConstInt;
 use hair::cx::Cx;
 use hair::cx::block;
 use hair::cx::to_ref::ToRef;
-use rustc::front::map;
-use rustc::middle::def::Def;
+use rustc::hir::map;
+use rustc::hir::def::Def;
 use rustc::middle::const_val::ConstVal;
 use rustc_const_eval as const_eval;
 use rustc::middle::region::CodeExtent;
-use rustc::middle::pat_util;
+use rustc::hir::pat_util;
 use rustc::ty::{self, VariantDef, Ty};
 use rustc::mir::repr::*;
-use rustc_front::hir;
-use rustc_front::util as hir_util;
+use rustc::hir;
 use syntax::ptr::P;
 
 impl<'tcx> Mirror<'tcx> for &'tcx hir::Expr {
@@ -150,7 +149,7 @@ impl<'tcx> Mirror<'tcx> for &'tcx hir::Expr {
 
             hir::ExprAssignOp(op, ref lhs, ref rhs) => {
                 if cx.tcx.is_method_call(self.id) {
-                    let pass_args = if hir_util::is_by_value_binop(op.node) {
+                    let pass_args = if op.node.is_by_value() {
                         PassArgs::ByValue
                     } else {
                         PassArgs::ByRef
@@ -172,7 +171,7 @@ impl<'tcx> Mirror<'tcx> for &'tcx hir::Expr {
 
             hir::ExprBinary(op, ref lhs, ref rhs) => {
                 if cx.tcx.is_method_call(self.id) {
-                    let pass_args = if hir_util::is_by_value_binop(op.node) {
+                    let pass_args = if op.node.is_by_value() {
                         PassArgs::ByValue
                     } else {
                         PassArgs::ByRef
@@ -959,7 +958,7 @@ fn overloaded_lvalue<'a, 'tcx: 'a>(cx: &mut Cx<'a, 'tcx>,
 
 fn capture_freevar<'a, 'tcx: 'a>(cx: &mut Cx<'a, 'tcx>,
                                  closure_expr: &'tcx hir::Expr,
-                                 freevar: &ty::Freevar,
+                                 freevar: &hir::Freevar,
                                  freevar_ty: Ty<'tcx>)
                                  -> ExprRef<'tcx> {
     let id_var = freevar.def.var_id();
diff --git a/src/librustc_mir/hair/cx/mod.rs b/src/librustc_mir/hair/cx/mod.rs
index 05448a7deab..c3a5fbd967c 100644
--- a/src/librustc_mir/hair/cx/mod.rs
+++ b/src/librustc_mir/hair/cx/mod.rs
@@ -20,12 +20,12 @@ use rustc::mir::repr::*;
 
 use rustc::middle::const_val::ConstVal;
 use rustc_const_eval as const_eval;
-use rustc::middle::def_id::DefId;
+use rustc::hir::def_id::DefId;
 use rustc::infer::InferCtxt;
 use rustc::ty::subst::{Subst, Substs};
 use rustc::ty::{self, Ty, TyCtxt};
 use syntax::parse::token;
-use rustc_front::hir;
+use rustc::hir;
 use rustc_const_math::{ConstInt, ConstUsize};
 
 #[derive(Copy, Clone)]
diff --git a/src/librustc_mir/hair/cx/pattern.rs b/src/librustc_mir/hair/cx/pattern.rs
index 8ec8cd4bf81..990ba9e786c 100644
--- a/src/librustc_mir/hair/cx/pattern.rs
+++ b/src/librustc_mir/hair/cx/pattern.rs
@@ -12,11 +12,11 @@ use hair::*;
 use hair::cx::Cx;
 use rustc_data_structures::fnv::FnvHashMap;
 use rustc_const_eval as const_eval;
-use rustc::middle::def::Def;
-use rustc::middle::pat_util::{pat_is_resolved_const, pat_is_binding};
+use rustc::hir::def::Def;
+use rustc::hir::pat_util::{pat_is_resolved_const, pat_is_binding};
 use rustc::ty::{self, Ty};
 use rustc::mir::repr::*;
-use rustc_front::hir::{self, PatKind};
+use rustc::hir::{self, PatKind};
 use syntax::ast;
 use syntax::codemap::Span;
 use syntax::ptr::P;
diff --git a/src/librustc_mir/hair/cx/to_ref.rs b/src/librustc_mir/hair/cx/to_ref.rs
index 24fcc2f4fcd..63dbde47438 100644
--- a/src/librustc_mir/hair/cx/to_ref.rs
+++ b/src/librustc_mir/hair/cx/to_ref.rs
@@ -10,7 +10,7 @@
 
 use hair::*;
 
-use rustc_front::hir;
+use rustc::hir;
 use syntax::ptr::P;
 
 pub trait ToRef {
diff --git a/src/librustc_mir/hair/mod.rs b/src/librustc_mir/hair/mod.rs
index affc1872987..51f2cc2687a 100644
--- a/src/librustc_mir/hair/mod.rs
+++ b/src/librustc_mir/hair/mod.rs
@@ -17,11 +17,11 @@
 use rustc::mir::repr::{BinOp, BorrowKind, Field, Literal, Mutability, UnOp,
     TypedConstVal};
 use rustc::middle::const_val::ConstVal;
-use rustc::middle::def_id::DefId;
+use rustc::hir::def_id::DefId;
 use rustc::middle::region::CodeExtent;
 use rustc::ty::subst::Substs;
 use rustc::ty::{self, AdtDef, ClosureSubsts, Region, Ty};
-use rustc_front::hir;
+use rustc::hir;
 use syntax::ast;
 use syntax::codemap::Span;
 use self::cx::Cx;
diff --git a/src/librustc_mir/lib.rs b/src/librustc_mir/lib.rs
index dd81895ebec..ced73f34e0d 100644
--- a/src/librustc_mir/lib.rs
+++ b/src/librustc_mir/lib.rs
@@ -30,7 +30,6 @@ extern crate graphviz as dot;
 #[macro_use]
 extern crate rustc;
 extern crate rustc_data_structures;
-extern crate rustc_front;
 extern crate rustc_back;
 extern crate syntax;
 extern crate rustc_const_math;
diff --git a/src/librustc_mir/mir_map.rs b/src/librustc_mir/mir_map.rs
index 9ec88c1b59a..40334f652ee 100644
--- a/src/librustc_mir/mir_map.rs
+++ b/src/librustc_mir/mir_map.rs
@@ -17,7 +17,6 @@
 //! - `#[rustc_mir(pretty="file.mir")]`
 
 extern crate syntax;
-extern crate rustc_front;
 
 use build;
 use rustc::dep_graph::DepNode;
@@ -31,8 +30,8 @@ use rustc::traits::ProjectionMode;
 use rustc::ty::{self, Ty, TyCtxt};
 use rustc::util::common::ErrorReported;
 use rustc::util::nodemap::NodeMap;
-use rustc_front::hir;
-use rustc_front::intravisit::{self, Visitor};
+use rustc::hir;
+use rustc::hir::intravisit::{self, Visitor};
 use syntax::abi::Abi;
 use syntax::ast;
 use syntax::attr::AttrMetaMethods;
diff --git a/src/librustc_mir/pretty.rs b/src/librustc_mir/pretty.rs
index 2c50697c37f..d0c66b340d9 100644
--- a/src/librustc_mir/pretty.rs
+++ b/src/librustc_mir/pretty.rs
@@ -216,7 +216,7 @@ fn write_scope_tree(tcx: &TyCtxt,
 /// local variables (both user-defined bindings and compiler temporaries).
 fn write_mir_intro(tcx: &TyCtxt, nid: NodeId, mir: &Mir, w: &mut Write)
                    -> io::Result<()> {
-    write!(w, "fn {}(", tcx.map.path_to_string(nid))?;
+    write!(w, "fn {}(", tcx.node_path_str(nid))?;
 
     // fn argument types.
     for (i, arg) in mir.arg_decls.iter().enumerate() {
diff --git a/src/librustc_passes/Cargo.toml b/src/librustc_passes/Cargo.toml
index 02303aa7130..fa6bd3dfb67 100644
--- a/src/librustc_passes/Cargo.toml
+++ b/src/librustc_passes/Cargo.toml
@@ -12,5 +12,4 @@ crate-type = ["dylib"]
 log = { path = "../liblog" }
 rustc = { path = "../librustc" }
 rustc_const_eval = { path = "../librustc_const_eval" }
-rustc_front = { path = "../librustc_front" }
 syntax = { path = "../libsyntax" }
diff --git a/src/librustc_passes/consts.rs b/src/librustc_passes/consts.rs
index ba5d8ef45b6..4659bb389dc 100644
--- a/src/librustc_passes/consts.rs
+++ b/src/librustc_passes/consts.rs
@@ -30,8 +30,8 @@ use rustc_const_eval::{ConstEvalErr, lookup_const_fn_by_id, compare_lit_exprs};
 use rustc_const_eval::{eval_const_expr_partial, lookup_const_by_id};
 use rustc_const_eval::ErrKind::{IndexOpFeatureGated, UnimplementedConstVal};
 use rustc_const_eval::EvalHint::ExprTypeChecked;
-use rustc::middle::def::Def;
-use rustc::middle::def_id::DefId;
+use rustc::hir::def::Def;
+use rustc::hir::def_id::DefId;
 use rustc::middle::expr_use_visitor as euv;
 use rustc::infer;
 use rustc::middle::mem_categorization as mc;
@@ -42,11 +42,11 @@ use rustc::util::nodemap::NodeMap;
 use rustc::middle::const_qualif::ConstQualif;
 use rustc::lint::builtin::CONST_ERR;
 
-use rustc_front::hir::{self, PatKind};
+use rustc::hir::{self, PatKind};
 use syntax::ast;
 use syntax::codemap::Span;
 use syntax::feature_gate::UnstableFeatures;
-use rustc_front::intravisit::{self, FnKind, Visitor};
+use rustc::hir::intravisit::{self, FnKind, Visitor};
 
 use std::collections::hash_map::Entry;
 use std::cmp::Ordering;
diff --git a/src/librustc_passes/lib.rs b/src/librustc_passes/lib.rs
index 44bcdcdb364..53ae1b30f7c 100644
--- a/src/librustc_passes/lib.rs
+++ b/src/librustc_passes/lib.rs
@@ -29,7 +29,6 @@
 
 extern crate core;
 #[macro_use] extern crate rustc;
-extern crate rustc_front;
 extern crate rustc_const_eval;
 
 #[macro_use] extern crate log;
diff --git a/src/librustc_passes/loops.rs b/src/librustc_passes/loops.rs
index a89627aea82..9a58a704c52 100644
--- a/src/librustc_passes/loops.rs
+++ b/src/librustc_passes/loops.rs
@@ -12,9 +12,9 @@ use self::Context::*;
 use rustc::session::Session;
 
 use rustc::dep_graph::DepNode;
-use rustc::front::map::Map;
-use rustc_front::intravisit::{self, Visitor};
-use rustc_front::hir;
+use rustc::hir::map::Map;
+use rustc::hir::intravisit::{self, Visitor};
+use rustc::hir;
 use syntax::codemap::Span;
 
 #[derive(Clone, Copy, PartialEq)]
diff --git a/src/librustc_passes/rvalues.rs b/src/librustc_passes/rvalues.rs
index 98502f5a16e..754d5ef8f52 100644
--- a/src/librustc_passes/rvalues.rs
+++ b/src/librustc_passes/rvalues.rs
@@ -18,8 +18,8 @@ use rustc::middle::mem_categorization as mc;
 use rustc::ty::{self, TyCtxt, ParameterEnvironment};
 use rustc::traits::ProjectionMode;
 
-use rustc_front::hir;
-use rustc_front::intravisit;
+use rustc::hir;
+use rustc::hir::intravisit;
 use syntax::ast;
 use syntax::codemap::Span;
 
diff --git a/src/librustc_passes/static_recursion.rs b/src/librustc_passes/static_recursion.rs
index 2230283c977..245960a04f0 100644
--- a/src/librustc_passes/static_recursion.rs
+++ b/src/librustc_passes/static_recursion.rs
@@ -12,16 +12,16 @@
 // recursively.
 
 use rustc::dep_graph::DepNode;
-use rustc::front::map as ast_map;
+use rustc::hir::map as ast_map;
 use rustc::session::{Session, CompileResult};
-use rustc::middle::def::{Def, DefMap};
+use rustc::hir::def::{Def, DefMap};
 use rustc::util::nodemap::NodeMap;
 
 use syntax::{ast};
 use syntax::codemap::Span;
 use syntax::feature_gate::{GateIssue, emit_feature_err};
-use rustc_front::intravisit::{self, Visitor};
-use rustc_front::hir;
+use rustc::hir::intravisit::{self, Visitor};
+use rustc::hir;
 
 use std::cell::RefCell;
 
diff --git a/src/librustc_plugin/Cargo.toml b/src/librustc_plugin/Cargo.toml
index 89fa0df0306..e9a32e53a9f 100644
--- a/src/librustc_plugin/Cargo.toml
+++ b/src/librustc_plugin/Cargo.toml
@@ -13,7 +13,6 @@ log = { path = "../liblog" }
 rustc = { path = "../librustc" }
 rustc_back = { path = "../librustc_back" }
 rustc_bitflags = { path = "../librustc_bitflags" }
-rustc_front = { path = "../librustc_front" }
 rustc_metadata = { path = "../librustc_metadata" }
 rustc_mir = { path = "../librustc_mir" }
 syntax = { path = "../libsyntax" }
diff --git a/src/librustc_plugin/build.rs b/src/librustc_plugin/build.rs
index fe83b609334..4c7755b1b09 100644
--- a/src/librustc_plugin/build.rs
+++ b/src/librustc_plugin/build.rs
@@ -15,9 +15,9 @@ use syntax::attr;
 use syntax::codemap::Span;
 use syntax::errors;
 use rustc::dep_graph::DepNode;
-use rustc::front::map::Map;
-use rustc_front::intravisit::Visitor;
-use rustc_front::hir;
+use rustc::hir::map::Map;
+use rustc::hir::intravisit::Visitor;
+use rustc::hir;
 
 struct RegistrarFinder {
     registrars: Vec<(ast::NodeId, Span)> ,
diff --git a/src/librustc_plugin/lib.rs b/src/librustc_plugin/lib.rs
index 8de26083910..5fa29771c57 100644
--- a/src/librustc_plugin/lib.rs
+++ b/src/librustc_plugin/lib.rs
@@ -69,7 +69,6 @@
 
 extern crate rustc;
 extern crate rustc_back;
-extern crate rustc_front;
 extern crate rustc_metadata;
 extern crate rustc_mir;
 
diff --git a/src/librustc_privacy/Cargo.toml b/src/librustc_privacy/Cargo.toml
index 56d6ca5543a..0553e54e3aa 100644
--- a/src/librustc_privacy/Cargo.toml
+++ b/src/librustc_privacy/Cargo.toml
@@ -11,5 +11,4 @@ crate-type = ["dylib"]
 [dependencies]
 log = { path = "../liblog" }
 rustc = { path = "../librustc" }
-rustc_front = { path = "../librustc_front" }
 syntax = { path = "../libsyntax" }
diff --git a/src/librustc_privacy/lib.rs b/src/librustc_privacy/lib.rs
index 80df21e85f6..8840bd42717 100644
--- a/src/librustc_privacy/lib.rs
+++ b/src/librustc_privacy/lib.rs
@@ -25,23 +25,22 @@
 #[macro_use] extern crate syntax;
 
 #[macro_use] extern crate rustc;
-extern crate rustc_front;
 
 use std::cmp;
 use std::mem::replace;
 
-use rustc_front::hir::{self, PatKind};
-use rustc_front::intravisit::{self, Visitor};
+use rustc::hir::{self, PatKind};
+use rustc::hir::intravisit::{self, Visitor};
 
 use rustc::dep_graph::DepNode;
 use rustc::lint;
 use rustc::middle::cstore::CrateStore;
-use rustc::middle::def::{self, Def};
-use rustc::middle::def_id::DefId;
+use rustc::hir::def::{self, Def};
+use rustc::hir::def_id::DefId;
 use rustc::middle::privacy::{AccessLevel, AccessLevels};
 use rustc::ty::{self, TyCtxt};
 use rustc::util::nodemap::NodeSet;
-use rustc::front::map as ast_map;
+use rustc::hir::map as ast_map;
 
 use syntax::ast;
 use syntax::codemap::Span;
diff --git a/src/librustc_resolve/Cargo.toml b/src/librustc_resolve/Cargo.toml
index 82e952d2bee..cf477c2a956 100644
--- a/src/librustc_resolve/Cargo.toml
+++ b/src/librustc_resolve/Cargo.toml
@@ -13,5 +13,4 @@ log = { path = "../liblog" }
 syntax = { path = "../libsyntax" }
 rustc = { path = "../librustc" }
 rustc_bitflags = { path = "../librustc_bitflags" }
-rustc_front = { path = "../librustc_front" }
 arena = { path = "../libarena" }
diff --git a/src/librustc_resolve/build_reduced_graph.rs b/src/librustc_resolve/build_reduced_graph.rs
index f36a8269dc0..a422b09f96b 100644
--- a/src/librustc_resolve/build_reduced_graph.rs
+++ b/src/librustc_resolve/build_reduced_graph.rs
@@ -24,8 +24,8 @@ use {resolve_error, resolve_struct_error, ResolutionError};
 
 use rustc::middle::cstore::{CrateStore, ChildItem, DlDef};
 use rustc::lint;
-use rustc::middle::def::*;
-use rustc::middle::def_id::{CRATE_DEF_INDEX, DefId};
+use rustc::hir::def::*;
+use rustc::hir::def_id::{CRATE_DEF_INDEX, DefId};
 use rustc::ty::VariantKind;
 
 use syntax::ast::Name;
@@ -33,15 +33,15 @@ use syntax::attr::AttrMetaMethods;
 use syntax::parse::token::{special_idents, SELF_KEYWORD_NAME, SUPER_KEYWORD_NAME};
 use syntax::codemap::{Span, DUMMY_SP};
 
-use rustc_front::hir;
-use rustc_front::hir::{Block, DeclItem};
-use rustc_front::hir::{ForeignItem, ForeignItemFn, ForeignItemStatic};
-use rustc_front::hir::{Item, ItemConst, ItemEnum, ItemExternCrate, ItemFn};
-use rustc_front::hir::{ItemForeignMod, ItemImpl, ItemMod, ItemStatic, ItemDefaultImpl};
-use rustc_front::hir::{ItemStruct, ItemTrait, ItemTy, ItemUse};
-use rustc_front::hir::{PathListIdent, PathListMod, StmtDecl};
-use rustc_front::hir::{Variant, ViewPathGlob, ViewPathList, ViewPathSimple};
-use rustc_front::intravisit::{self, Visitor};
+use rustc::hir;
+use rustc::hir::{Block, DeclItem};
+use rustc::hir::{ForeignItem, ForeignItemFn, ForeignItemStatic};
+use rustc::hir::{Item, ItemConst, ItemEnum, ItemExternCrate, ItemFn};
+use rustc::hir::{ItemForeignMod, ItemImpl, ItemMod, ItemStatic, ItemDefaultImpl};
+use rustc::hir::{ItemStruct, ItemTrait, ItemTy, ItemUse};
+use rustc::hir::{PathListIdent, PathListMod, StmtDecl};
+use rustc::hir::{Variant, ViewPathGlob, ViewPathList, ViewPathSimple};
+use rustc::hir::intravisit::{self, Visitor};
 
 trait ToNameBinding<'a> {
     fn to_name_binding(self) -> NameBinding<'a>;
diff --git a/src/librustc_resolve/check_unused.rs b/src/librustc_resolve/check_unused.rs
index ea197109cab..4046c8c7783 100644
--- a/src/librustc_resolve/check_unused.rs
+++ b/src/librustc_resolve/check_unused.rs
@@ -26,9 +26,9 @@ use rustc::lint;
 use syntax::ast;
 use syntax::codemap::{Span, DUMMY_SP};
 
-use rustc_front::hir;
-use rustc_front::hir::{ViewPathGlob, ViewPathList, ViewPathSimple};
-use rustc_front::intravisit::Visitor;
+use rustc::hir;
+use rustc::hir::{ViewPathGlob, ViewPathList, ViewPathSimple};
+use rustc::hir::intravisit::Visitor;
 
 struct UnusedImportCheckVisitor<'a, 'b: 'a, 'tcx: 'b> {
     resolver: &'a mut Resolver<'b, 'tcx>,
diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs
index 98e40d73133..299a8c0299d 100644
--- a/src/librustc_resolve/lib.rs
+++ b/src/librustc_resolve/lib.rs
@@ -31,7 +31,6 @@ extern crate arena;
 #[macro_use]
 #[no_link]
 extern crate rustc_bitflags;
-extern crate rustc_front;
 #[macro_use]
 extern crate rustc;
 
@@ -49,16 +48,16 @@ use self::ParentLink::*;
 use self::FallbackChecks::*;
 
 use rustc::dep_graph::DepNode;
-use rustc::front::map as hir_map;
+use rustc::hir::map as hir_map;
 use rustc::session::Session;
 use rustc::lint;
 use rustc::middle::cstore::CrateStore;
-use rustc::middle::def::*;
-use rustc::middle::def_id::DefId;
-use rustc::middle::pat_util::pat_bindings;
+use rustc::hir::def::*;
+use rustc::hir::def_id::DefId;
+use rustc::hir::pat_util::pat_bindings;
 use rustc::ty::subst::{ParamSpace, FnSpace, TypeSpace};
-use rustc::ty::{Freevar, FreevarMap, TraitMap, GlobMap};
-use rustc::util::nodemap::{NodeMap, FnvHashMap};
+use rustc::hir::{Freevar, FreevarMap, TraitMap, GlobMap};
+use rustc::util::nodemap::{NodeMap, FnvHashMap, FnvHashSet};
 
 use syntax::ast::{self, FloatTy};
 use syntax::ast::{CRATE_NODE_ID, Name, NodeId, CrateNum, IntTy, UintTy};
@@ -68,24 +67,23 @@ use syntax::errors::DiagnosticBuilder;
 use syntax::parse::token::{self, special_names, special_idents};
 use syntax::util::lev_distance::find_best_match_for_name;
 
-use rustc_front::intravisit::{self, FnKind, Visitor};
-use rustc_front::hir;
-use rustc_front::hir::{Arm, BindByRef, BindByValue, BindingMode, Block};
-use rustc_front::hir::Crate;
-use rustc_front::hir::{Expr, ExprAgain, ExprBreak, ExprCall, ExprField};
-use rustc_front::hir::{ExprLoop, ExprWhile, ExprMethodCall};
-use rustc_front::hir::{ExprPath, ExprStruct, FnDecl};
-use rustc_front::hir::{ForeignItemFn, ForeignItemStatic, Generics};
-use rustc_front::hir::{ImplItem, Item, ItemConst, ItemEnum, ItemExternCrate};
-use rustc_front::hir::{ItemFn, ItemForeignMod, ItemImpl, ItemMod, ItemStatic, ItemDefaultImpl};
-use rustc_front::hir::{ItemStruct, ItemTrait, ItemTy, ItemUse};
-use rustc_front::hir::Local;
-use rustc_front::hir::{Pat, PatKind, Path, PrimTy};
-use rustc_front::hir::{PathSegment, PathParameters};
-use rustc_front::hir::HirVec;
-use rustc_front::hir::{TraitRef, Ty, TyBool, TyChar, TyFloat, TyInt};
-use rustc_front::hir::{TyRptr, TyStr, TyUint, TyPath, TyPtr};
-use rustc_front::util::walk_pat;
+use rustc::hir::intravisit::{self, FnKind, Visitor};
+use rustc::hir;
+use rustc::hir::{Arm, BindByRef, BindByValue, BindingMode, Block};
+use rustc::hir::Crate;
+use rustc::hir::{Expr, ExprAgain, ExprBreak, ExprCall, ExprField};
+use rustc::hir::{ExprLoop, ExprWhile, ExprMethodCall};
+use rustc::hir::{ExprPath, ExprStruct, FnDecl};
+use rustc::hir::{ForeignItemFn, ForeignItemStatic, Generics};
+use rustc::hir::{ImplItem, Item, ItemConst, ItemEnum, ItemExternCrate};
+use rustc::hir::{ItemFn, ItemForeignMod, ItemImpl, ItemMod, ItemStatic, ItemDefaultImpl};
+use rustc::hir::{ItemStruct, ItemTrait, ItemTy, ItemUse};
+use rustc::hir::Local;
+use rustc::hir::{Pat, PatKind, Path, PrimTy};
+use rustc::hir::{PathSegment, PathParameters};
+use rustc::hir::HirVec;
+use rustc::hir::{TraitRef, Ty, TyBool, TyChar, TyFloat, TyInt};
+use rustc::hir::{TyRptr, TyStr, TyUint, TyPath, TyPtr};
 
 use std::collections::{HashMap, HashSet};
 use std::cell::{Cell, RefCell};
@@ -1188,7 +1186,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
 
             emit_errors: true,
             make_glob_map: make_glob_map == MakeGlobMap::Yes,
-            glob_map: HashMap::new(),
+            glob_map: NodeMap(),
 
             callback: None,
             resolved: false,
@@ -1255,7 +1253,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
             return;
         }
 
-        let mut new_set = HashSet::new();
+        let mut new_set = FnvHashSet();
         new_set.insert(name);
         self.glob_map.insert(import_id, new_set);
     }
@@ -2245,7 +2243,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
                        // pattern that binds them
                        bindings_list: &mut HashMap<Name, NodeId>) {
         let pat_id = pattern.id;
-        walk_pat(pattern, |pattern| {
+        pattern.walk(|pattern| {
             match pattern.node {
                 PatKind::Ident(binding_mode, ref path1, ref at_rhs) => {
                     // The meaning of PatKind::Ident with no type parameters
@@ -2572,7 +2570,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
     }
 
     /// Skips `path_depth` trailing segments, which is also reflected in the
-    /// returned value. See `middle::def::PathResolution` for more info.
+    /// returned value. See `hir::def::PathResolution` for more info.
     fn resolve_path(&mut self, id: NodeId, path: &Path, path_depth: usize, namespace: Namespace)
                     -> Option<PathResolution> {
         let span = path.span;
diff --git a/src/librustc_resolve/resolve_imports.rs b/src/librustc_resolve/resolve_imports.rs
index 2aa8925fb54..738a99fbe92 100644
--- a/src/librustc_resolve/resolve_imports.rs
+++ b/src/librustc_resolve/resolve_imports.rs
@@ -22,7 +22,7 @@ use {names_to_string, module_to_string};
 use {resolve_error, ResolutionError};
 
 use rustc::lint;
-use rustc::middle::def::*;
+use rustc::hir::def::*;
 
 use syntax::ast::{NodeId, Name};
 use syntax::attr::AttrMetaMethods;
diff --git a/src/librustc_save_analysis/Cargo.toml b/src/librustc_save_analysis/Cargo.toml
index a0cf70b57a9..52fa9193472 100644
--- a/src/librustc_save_analysis/Cargo.toml
+++ b/src/librustc_save_analysis/Cargo.toml
@@ -11,5 +11,4 @@ crate-type = ["dylib"]
 [dependencies]
 log = { path = "../liblog" }
 rustc = { path = "../librustc" }
-rustc_front = { path = "../librustc_front" }
 syntax = { path = "../libsyntax" }
diff --git a/src/librustc_save_analysis/csv_dumper.rs b/src/librustc_save_analysis/csv_dumper.rs
index 3021d4e9820..0e02830db7a 100644
--- a/src/librustc_save_analysis/csv_dumper.rs
+++ b/src/librustc_save_analysis/csv_dumper.rs
@@ -10,7 +10,7 @@
 
 use std::io::Write;
 
-use rustc::middle::def_id::{DefId, DefIndex};
+use rustc::hir::def_id::{DefId, DefIndex};
 use syntax::codemap::Span;
 
 use super::data::*;
diff --git a/src/librustc_save_analysis/data.rs b/src/librustc_save_analysis/data.rs
index 649c8387eb3..7f2f2618c3c 100644
--- a/src/librustc_save_analysis/data.rs
+++ b/src/librustc_save_analysis/data.rs
@@ -15,7 +15,7 @@
 
 use std::hash::Hasher;
 
-use rustc::middle::def_id::DefId;
+use rustc::hir::def_id::DefId;
 use rustc::ty;
 use syntax::ast::{CrateNum, NodeId};
 use syntax::codemap::Span;
diff --git a/src/librustc_save_analysis/dump_visitor.rs b/src/librustc_save_analysis/dump_visitor.rs
index 35ca2a9b014..3784c95fe2b 100644
--- a/src/librustc_save_analysis/dump_visitor.rs
+++ b/src/librustc_save_analysis/dump_visitor.rs
@@ -27,8 +27,8 @@
 //! is used for recording the output in a format-agnostic way (see CsvDumper
 //! for an example).
 
-use rustc::middle::def::Def;
-use rustc::middle::def_id::DefId;
+use rustc::hir::def::Def;
+use rustc::hir::def_id::DefId;
 use rustc::session::Session;
 use rustc::ty::{self, TyCtxt};
 
@@ -42,7 +42,7 @@ use syntax::visit::{self, Visitor};
 use syntax::print::pprust::{path_to_string, ty_to_string};
 use syntax::ptr::P;
 
-use rustc_front::lowering::{lower_expr, LoweringContext};
+use rustc::hir::lowering::{lower_expr, LoweringContext};
 
 use super::{escape, generated_code, SaveContext, PathCollector};
 use super::data::*;
@@ -519,7 +519,7 @@ where D: Dump
                      span: Span,
                      typ: &ast::Ty,
                      expr: &ast::Expr) {
-        let qualname = format!("::{}", self.tcx.map.path_to_string(id));
+        let qualname = format!("::{}", self.tcx.node_path_str(id));
 
         let sub_span = self.span.sub_span_after_keyword(span, keywords::Const);
 
@@ -544,7 +544,7 @@ where D: Dump
                       item: &ast::Item,
                       def: &ast::VariantData,
                       ty_params: &ast::Generics) {
-        let qualname = format!("::{}", self.tcx.map.path_to_string(item.id));
+        let qualname = format!("::{}", self.tcx.node_path_str(item.id));
 
         let val = self.span.snippet(item.span);
         let sub_span = self.span.sub_span_after_keyword(item.span, keywords::Struct);
@@ -563,7 +563,7 @@ where D: Dump
         // fields
         for field in def.fields() {
             self.process_struct_field_def(field, item.id);
-            self.visit_ty(&field.node.ty);
+            self.visit_ty(&field.ty);
         }
 
         self.process_generic_params(ty_params, item.span, &qualname, item.id);
@@ -624,7 +624,7 @@ where D: Dump
 
             for field in variant.node.data.fields() {
                 self.process_struct_field_def(field, variant.node.data.id());
-                self.visit_ty(&field.node.ty);
+                self.visit_ty(&field.ty);
             }
         }
         self.process_generic_params(ty_params, item.span, &enum_data.qualname, enum_data.id);
@@ -677,7 +677,7 @@ where D: Dump
                      generics: &ast::Generics,
                      trait_refs: &ast::TyParamBounds,
                      methods: &[ast::TraitItem]) {
-        let qualname = format!("::{}", self.tcx.map.path_to_string(item.id));
+        let qualname = format!("::{}", self.tcx.node_path_str(item.id));
         let val = self.span.snippet(item.span);
         let sub_span = self.span.sub_span_after_keyword(item.span, keywords::Trait);
         if !self.span.filter_generated(sub_span, item.span) {
@@ -1108,7 +1108,7 @@ impl<'l, 'tcx, 'v, D: Dump + 'l> Visitor<'v> for DumpVisitor<'l, 'tcx, D> {
                 self.nest(item.id, |v| visit::walk_mod(v, m));
             }
             Ty(ref ty, ref ty_params) => {
-                let qualname = format!("::{}", self.tcx.map.path_to_string(item.id));
+                let qualname = format!("::{}", self.tcx.node_path_str(item.id));
                 let value = ty_to_string(&ty);
                 let sub_span = self.span.sub_span_after_keyword(item.span, keywords::Type);
                 if !self.span.filter_generated(sub_span, item.span) {
diff --git a/src/librustc_save_analysis/lib.rs b/src/librustc_save_analysis/lib.rs
index 36b94731e45..4596398c315 100644
--- a/src/librustc_save_analysis/lib.rs
+++ b/src/librustc_save_analysis/lib.rs
@@ -23,15 +23,14 @@
 #![feature(staged_api)]
 
 #[macro_use] extern crate rustc;
-extern crate rustc_front;
 
 #[macro_use] extern crate log;
 #[macro_use] extern crate syntax;
 
-use rustc_front::{hir, lowering};
-use rustc::front::map::NodeItem;
-use rustc::middle::def::Def;
-use rustc::middle::def_id::DefId;
+use rustc::hir::{self, lowering};
+use rustc::hir::map::NodeItem;
+use rustc::hir::def::Def;
+use rustc::hir::def_id::DefId;
 use rustc::session::config::CrateType::CrateTypeExecutable;
 use rustc::ty::{self, TyCtxt};
 
@@ -40,7 +39,6 @@ use std::fs::{self, File};
 use std::path::{Path, PathBuf};
 
 use syntax::ast::{self, NodeId, PatKind};
-use syntax::ast_util;
 use syntax::codemap::*;
 use syntax::parse::token::{self, keywords};
 use syntax::visit::{self, Visitor};
@@ -118,7 +116,7 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> {
     pub fn get_item_data(&self, item: &ast::Item) -> Option<Data> {
         match item.node {
             ast::ItemKind::Fn(..) => {
-                let name = self.tcx.map.path_to_string(item.id);
+                let name = self.tcx.node_path_str(item.id);
                 let qualname = format!("::{}", name);
                 let sub_span = self.span_utils.sub_span_after_keyword(item.span, keywords::Fn);
                 filter!(self.span_utils, sub_span, item.span, None);
@@ -132,7 +130,7 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> {
                 }))
             }
             ast::ItemKind::Static(ref typ, mt, ref expr) => {
-                let qualname = format!("::{}", self.tcx.map.path_to_string(item.id));
+                let qualname = format!("::{}", self.tcx.node_path_str(item.id));
 
                 // If the variable is immutable, save the initialising expression.
                 let (value, keyword) = match mt {
@@ -155,7 +153,7 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> {
                 }))
             }
             ast::ItemKind::Const(ref typ, ref expr) => {
-                let qualname = format!("::{}", self.tcx.map.path_to_string(item.id));
+                let qualname = format!("::{}", self.tcx.node_path_str(item.id));
                 let sub_span = self.span_utils.sub_span_after_keyword(item.span, keywords::Const);
                 filter!(self.span_utils, sub_span, item.span, None);
                 Some(Data::VariableData(VariableData {
@@ -169,7 +167,7 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> {
                 }))
             }
             ast::ItemKind::Mod(ref m) => {
-                let qualname = format!("::{}", self.tcx.map.path_to_string(item.id));
+                let qualname = format!("::{}", self.tcx.node_path_str(item.id));
 
                 let cm = self.tcx.sess.codemap();
                 let filename = cm.span_to_filename(m.inner);
@@ -186,7 +184,7 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> {
                 }))
             }
             ast::ItemKind::Enum(..) => {
-                let enum_name = format!("::{}", self.tcx.map.path_to_string(item.id));
+                let enum_name = format!("::{}", self.tcx.node_path_str(item.id));
                 let val = self.span_utils.snippet(item.span);
                 let sub_span = self.span_utils.sub_span_after_keyword(item.span, keywords::Enum);
                 filter!(self.span_utils, sub_span, item.span, None);
@@ -246,23 +244,22 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> {
 
     pub fn get_field_data(&self, field: &ast::StructField,
                           scope: NodeId) -> Option<VariableData> {
-        match field.node.kind {
-            ast::NamedField(ident, _) => {
-                let qualname = format!("::{}::{}", self.tcx.map.path_to_string(scope), ident);
-                let typ = self.tcx.node_types().get(&field.node.id).unwrap().to_string();
-                let sub_span = self.span_utils.sub_span_before_token(field.span, token::Colon);
-                filter!(self.span_utils, sub_span, field.span, None);
-                Some(VariableData {
-                    id: field.node.id,
-                    name: ident.to_string(),
-                    qualname: qualname,
-                    span: sub_span.unwrap(),
-                    scope: scope,
-                    value: "".to_owned(),
-                    type_value: typ,
-                })
-            }
-            _ => None,
+        if let Some(ident) = field.ident {
+            let qualname = format!("::{}::{}", self.tcx.node_path_str(scope), ident);
+            let typ = self.tcx.node_types().get(&field.id).unwrap().to_string();
+            let sub_span = self.span_utils.sub_span_before_token(field.span, token::Colon);
+            filter!(self.span_utils, sub_span, field.span, None);
+            Some(VariableData {
+                id: field.id,
+                name: ident.to_string(),
+                qualname: qualname,
+                span: sub_span.unwrap(),
+                scope: scope,
+                value: "".to_owned(),
+                type_value: typ,
+            })
+        } else {
+            None
         }
     }
 
@@ -278,7 +275,7 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> {
                     match item.node {
                         hir::ItemImpl(_, _, _, _, ref ty, _) => {
                             let mut result = String::from("<");
-                            result.push_str(&rustc_front::print::pprust::ty_to_string(&ty));
+                            result.push_str(&rustc::hir::print::ty_to_string(&ty));
 
                             match self.tcx.trait_of_item(self.tcx.map.local_def_id(id)) {
                                 Some(def_id) => {
@@ -671,7 +668,7 @@ impl<'v> Visitor<'v> for PathCollector {
                     ast::BindingMode::ByValue(mt) => mt,
                 };
                 // collect path for either visit_local or visit_arm
-                let path = ast_util::ident_to_path(path1.span, path1.node);
+                let path = ast::Path::from_ident(path1.span, path1.node);
                 self.collected_paths.push((p.id, path, immut, recorder::VarRef));
             }
             _ => {}
diff --git a/src/librustc_trans/Cargo.toml b/src/librustc_trans/Cargo.toml
index fb5a8e4a90e..ea4cef03b70 100644
--- a/src/librustc_trans/Cargo.toml
+++ b/src/librustc_trans/Cargo.toml
@@ -18,7 +18,6 @@ rustc_back = { path = "../librustc_back" }
 rustc_const_eval = { path = "../librustc_const_eval" }
 rustc_const_math = { path = "../librustc_const_math" }
 rustc_data_structures = { path = "../librustc_data_structures" }
-rustc_front = { path = "../librustc_front" }
 rustc_llvm = { path = "../librustc_llvm" }
 rustc_mir = { path = "../librustc_mir" }
 rustc_platform_intrinsics = { path = "../librustc_platform_intrinsics" }
diff --git a/src/librustc_trans/_match.rs b/src/librustc_trans/_match.rs
index b27929c80c2..d8b8f9f0806 100644
--- a/src/librustc_trans/_match.rs
+++ b/src/librustc_trans/_match.rs
@@ -191,14 +191,14 @@ use self::FailureHandler::*;
 use llvm::{ValueRef, BasicBlockRef};
 use rustc_const_eval::check_match::{self, StaticInliner};
 use rustc_const_eval::{compare_lit_exprs, eval_const_expr};
-use middle::def::{Def, DefMap};
-use middle::def_id::DefId;
+use rustc::hir::def::{Def, DefMap};
+use rustc::hir::def_id::DefId;
 use middle::expr_use_visitor as euv;
 use rustc::infer;
 use middle::lang_items::StrEqFnLangItem;
 use middle::mem_categorization as mc;
 use middle::mem_categorization::Categorization;
-use middle::pat_util::*;
+use rustc::hir::pat_util::*;
 use rustc::ty::subst::Substs;
 use adt;
 use base::*;
@@ -229,10 +229,10 @@ use std::cell::RefCell;
 use std::cmp::Ordering;
 use std::fmt;
 use std::rc::Rc;
-use rustc_front::hir::{self, PatKind};
+use rustc::hir::{self, PatKind};
 use syntax::ast::{self, DUMMY_NODE_ID, NodeId};
 use syntax::codemap::Span;
-use rustc_front::fold::Folder;
+use rustc::hir::fold::Folder;
 use syntax::ptr::P;
 
 #[derive(Copy, Clone, Debug)]
diff --git a/src/librustc_trans/abi.rs b/src/librustc_trans/abi.rs
index 6edc26c7009..961a32170d0 100644
--- a/src/librustc_trans/abi.rs
+++ b/src/librustc_trans/abi.rs
@@ -26,7 +26,7 @@ use machine::{llalign_of_min, llsize_of, llsize_of_real};
 use type_::Type;
 use type_of;
 
-use rustc_front::hir;
+use rustc::hir;
 use rustc::ty::{self, Ty};
 
 use libc::c_uint;
diff --git a/src/librustc_trans/asm.rs b/src/librustc_trans/asm.rs
index 41f1f4ae5f8..e27bec68375 100644
--- a/src/librustc_trans/asm.rs
+++ b/src/librustc_trans/asm.rs
@@ -18,7 +18,7 @@ use datum::{Datum, Lvalue};
 use type_of;
 use type_::Type;
 
-use rustc_front::hir as ast;
+use rustc::hir as ast;
 use std::ffi::CString;
 use syntax::ast::AsmDialect;
 use libc::{c_uint, c_char};
diff --git a/src/librustc_trans/assert_dep_graph.rs b/src/librustc_trans/assert_dep_graph.rs
index bd98b3950d4..932f66f17cc 100644
--- a/src/librustc_trans/assert_dep_graph.rs
+++ b/src/librustc_trans/assert_dep_graph.rs
@@ -39,12 +39,12 @@
 
 use graphviz as dot;
 use rustc::dep_graph::{DepGraphQuery, DepNode};
-use rustc::middle::def_id::DefId;
+use rustc::hir::def_id::DefId;
 use rustc::ty::TyCtxt;
 use rustc_data_structures::fnv::{FnvHashMap, FnvHashSet};
 use rustc_data_structures::graph::{Direction, INCOMING, OUTGOING, NodeIndex};
-use rustc_front::hir;
-use rustc_front::intravisit::Visitor;
+use rustc::hir;
+use rustc::hir::intravisit::Visitor;
 use graphviz::IntoCow;
 use std::env;
 use std::fs::File;
diff --git a/src/librustc_trans/back/link.rs b/src/librustc_trans/back/link.rs
index 7aef1d912ec..130499603e7 100644
--- a/src/librustc_trans/back/link.rs
+++ b/src/librustc_trans/back/link.rs
@@ -43,7 +43,7 @@ use syntax::ast;
 use syntax::codemap::Span;
 use syntax::attr::AttrMetaMethods;
 
-use rustc_front::hir;
+use rustc::hir;
 
 // RLIB LLVM-BYTECODE OBJECT LAYOUT
 // Version 1
diff --git a/src/librustc_trans/back/symbol_names.rs b/src/librustc_trans/back/symbol_names.rs
index a458307da40..8127d1c0e29 100644
--- a/src/librustc_trans/back/symbol_names.rs
+++ b/src/librustc_trans/back/symbol_names.rs
@@ -102,10 +102,10 @@ use monomorphize::Instance;
 use util::sha2::{Digest, Sha256};
 
 use rustc::middle::cstore;
-use rustc::middle::def_id::DefId;
+use rustc::hir::def_id::DefId;
 use rustc::ty::{self, TypeFoldable};
 use rustc::ty::item_path::{ItemPathBuffer, RootMode};
-use rustc::front::map::definitions::{DefPath, DefPathData};
+use rustc::hir::map::definitions::{DefPath, DefPathData};
 
 use std::fmt::Write;
 use syntax::parse::token::{self, InternedString};
diff --git a/src/librustc_trans/base.rs b/src/librustc_trans/base.rs
index e5667e06b44..c8ed4e629e4 100644
--- a/src/librustc_trans/base.rs
+++ b/src/librustc_trans/base.rs
@@ -36,17 +36,17 @@ use llvm::{BasicBlockRef, Linkage, ValueRef, Vector, get_param};
 use llvm;
 use rustc::cfg;
 use middle::cstore::CrateStore;
-use middle::def_id::DefId;
+use rustc::hir::def_id::DefId;
 use rustc::infer;
 use middle::lang_items::{LangItem, ExchangeMallocFnLangItem, StartFnLangItem};
 use middle::weak_lang_items;
-use middle::pat_util::simple_name;
+use rustc::hir::pat_util::simple_name;
 use rustc::ty::subst::{self, Substs};
 use rustc::traits;
 use rustc::ty::{self, Ty, TyCtxt, TypeFoldable};
 use rustc::ty::adjustment::CustomCoerceUnsized;
 use rustc::dep_graph::DepNode;
-use rustc::front::map as hir_map;
+use rustc::hir::map as hir_map;
 use rustc::util::common::time;
 use rustc::mir::mir_map::MirMap;
 use session::config::{self, NoDebugInfo, FullDebugInfo};
@@ -106,9 +106,8 @@ use syntax::codemap::{Span, DUMMY_SP};
 use syntax::parse::token::InternedString;
 use syntax::attr::AttrMetaMethods;
 use syntax::attr;
-use rustc_front;
-use rustc_front::intravisit::{self, Visitor};
-use rustc_front::hir;
+use rustc::hir::intravisit::{self, Visitor};
+use rustc::hir;
 use syntax::ast;
 
 thread_local! {
@@ -713,7 +712,7 @@ fn cast_shift_rhs<F, G>(op: hir::BinOp_,
           G: FnOnce(ValueRef, Type) -> ValueRef
 {
     // Shifts may have any size int on the rhs
-    if rustc_front::util::is_shift_binop(op) {
+    if op.is_shift() {
         let mut rhs_llty = val_ty(rhs);
         let mut lhs_llty = val_ty(lhs);
         if rhs_llty.kind() == Vector {
@@ -1352,7 +1351,7 @@ fn build_cfg(tcx: &TyCtxt, id: ast::NodeId) -> (ast::NodeId, Option<cfg::CFG>) {
         None if id == ast::DUMMY_NODE_ID => return (ast::DUMMY_NODE_ID, None),
 
         _ => bug!("unexpected variant in has_nested_returns: {}",
-                  tcx.map.path_to_string(id)),
+                  tcx.node_path_str(id)),
     };
 
     (blk.id, Some(cfg::CFG::new(tcx, blk)))
@@ -1413,9 +1412,7 @@ impl<'blk, 'tcx> FunctionContext<'blk, 'tcx> {
         let local_id = def_id.and_then(|id| ccx.tcx().map.as_local_node_id(id));
 
         debug!("FunctionContext::new(path={}, def_id={:?}, param_substs={:?})",
-            inlined_id.map_or(String::new(), |id| {
-                ccx.tcx().map.path_to_string(id).to_string()
-            }),
+            inlined_id.map_or(String::new(), |id| ccx.tcx().node_path_str(id)),
             def_id,
             param_substs);
 
@@ -1907,7 +1904,7 @@ pub fn trans_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
                           llfndecl: ValueRef,
                           param_substs: &'tcx Substs<'tcx>,
                           id: ast::NodeId) {
-    let _s = StatRecorder::new(ccx, ccx.tcx().map.path_to_string(id).to_string());
+    let _s = StatRecorder::new(ccx, ccx.tcx().node_path_str(id));
     debug!("trans_fn(param_substs={:?})", param_substs);
     let _icx = push_ctxt("trans_fn");
     let fn_ty = ccx.tcx().node_id_to_type(id);
@@ -2447,8 +2444,7 @@ pub fn exported_name<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
         _ => {
             if attr::contains_name(attrs, "no_mangle") {
                 // Don't mangle
-                let path = ccx.tcx().map.def_path_from_id(id);
-                path.data.last().unwrap().data.to_string()
+                ccx.tcx().map.name(id).as_str().to_string()
             } else {
                 match weak_lang_items::link_name(attrs) {
                     Some(name) => name.to_string(),
diff --git a/src/librustc_trans/callee.rs b/src/librustc_trans/callee.rs
index 6b0945b2bb2..392c40a6015 100644
--- a/src/librustc_trans/callee.rs
+++ b/src/librustc_trans/callee.rs
@@ -21,12 +21,12 @@ use arena::TypedArena;
 use back::symbol_names;
 use llvm::{self, ValueRef, get_params};
 use middle::cstore::LOCAL_CRATE;
-use middle::def_id::DefId;
+use rustc::hir::def_id::DefId;
 use rustc::infer;
 use rustc::ty::subst;
 use rustc::ty::subst::{Substs};
 use rustc::traits;
-use rustc::front::map as hir_map;
+use rustc::hir::map as hir_map;
 use abi::{Abi, FnType};
 use adt;
 use attributes;
@@ -54,7 +54,7 @@ use type_of;
 use value::Value;
 use Disr;
 use rustc::ty::{self, Ty, TyCtxt, TypeFoldable};
-use rustc_front::hir;
+use rustc::hir;
 
 use syntax::codemap::DUMMY_SP;
 use syntax::errors;
diff --git a/src/librustc_trans/closure.rs b/src/librustc_trans/closure.rs
index cb94c9dfeb8..6bd5fd355a7 100644
--- a/src/librustc_trans/closure.rs
+++ b/src/librustc_trans/closure.rs
@@ -11,7 +11,7 @@
 use arena::TypedArena;
 use back::symbol_names;
 use llvm::{ValueRef, get_param, get_params};
-use middle::def_id::DefId;
+use rustc::hir::def_id::DefId;
 use rustc::infer;
 use rustc::traits::ProjectionMode;
 use abi::{Abi, FnType};
@@ -35,7 +35,7 @@ use session::config::FullDebugInfo;
 
 use syntax::ast;
 
-use rustc_front::hir;
+use rustc::hir;
 
 use libc::c_uint;
 
diff --git a/src/librustc_trans/collector.rs b/src/librustc_trans/collector.rs
index 1c18f3ca393..c72a1a6bef3 100644
--- a/src/librustc_trans/collector.rs
+++ b/src/librustc_trans/collector.rs
@@ -188,11 +188,11 @@
 //! this is not implemented however: a translation item will be produced
 //! regardless of whether it is actually needed or not.
 
-use rustc_front::hir;
-use rustc_front::intravisit as hir_visit;
+use rustc::hir;
+use rustc::hir::intravisit as hir_visit;
 
-use rustc::front::map as hir_map;
-use rustc::middle::def_id::DefId;
+use rustc::hir::map as hir_map;
+use rustc::hir::def_id::DefId;
 use rustc::middle::lang_items::{ExchangeFreeFnLangItem, ExchangeMallocFnLangItem};
 use rustc::traits;
 use rustc::ty::subst::{self, Substs, Subst};
diff --git a/src/librustc_trans/common.rs b/src/librustc_trans/common.rs
index 589e6f3266e..5ce7caf5deb 100644
--- a/src/librustc_trans/common.rs
+++ b/src/librustc_trans/common.rs
@@ -17,8 +17,8 @@ use llvm;
 use llvm::{ValueRef, BasicBlockRef, BuilderRef, ContextRef, TypeKind};
 use llvm::{True, False, Bool, OperandBundleDef};
 use rustc::cfg;
-use middle::def::Def;
-use middle::def_id::DefId;
+use rustc::hir::def::Def;
+use rustc::hir::def_id::DefId;
 use rustc::infer;
 use middle::lang_items::LangItem;
 use rustc::ty::subst::Substs;
@@ -40,7 +40,7 @@ use value::Value;
 use rustc::ty::{self, Ty, TyCtxt};
 use rustc::traits::{self, SelectionContext, ProjectionMode};
 use rustc::ty::fold::{TypeFolder, TypeFoldable};
-use rustc_front::hir;
+use rustc::hir;
 use util::nodemap::NodeMap;
 
 use arena::TypedArena;
diff --git a/src/librustc_trans/consts.rs b/src/librustc_trans/consts.rs
index 3e516c0eec4..89f3b295c8d 100644
--- a/src/librustc_trans/consts.rs
+++ b/src/librustc_trans/consts.rs
@@ -15,9 +15,9 @@ use llvm::{InternalLinkage, ValueRef, Bool, True};
 use middle::const_qualif::ConstQualif;
 use rustc_const_eval::{ConstEvalErr, lookup_const_fn_by_id, lookup_const_by_id, ErrKind};
 use rustc_const_eval::eval_repeat_count;
-use middle::def::Def;
-use middle::def_id::DefId;
-use rustc::front::map as hir_map;
+use rustc::hir::def::Def;
+use rustc::hir::def_id::DefId;
+use rustc::hir::map as hir_map;
 use {abi, adt, closure, debuginfo, expr, machine};
 use base::{self, exported_name, imported_name, push_ctxt};
 use callee::Callee;
@@ -41,7 +41,7 @@ use rustc::ty::cast::{CastTy,IntTy};
 use util::nodemap::NodeMap;
 use rustc_const_math::{ConstInt, ConstMathErr, ConstUsize, ConstIsize};
 
-use rustc_front::hir;
+use rustc::hir;
 
 use std::ffi::{CStr, CString};
 use std::borrow::Cow;
diff --git a/src/librustc_trans/context.rs b/src/librustc_trans/context.rs
index 3574883c5f5..9bbc72eba36 100644
--- a/src/librustc_trans/context.rs
+++ b/src/librustc_trans/context.rs
@@ -12,8 +12,8 @@ use llvm;
 use llvm::{ContextRef, ModuleRef, ValueRef, BuilderRef};
 use rustc::dep_graph::{DepNode, DepTrackingMap, DepTrackingMapConfig};
 use middle::cstore::LinkMeta;
-use middle::def::ExportMap;
-use middle::def_id::DefId;
+use rustc::hir::def::ExportMap;
+use rustc::hir::def_id::DefId;
 use rustc::traits;
 use rustc::mir::mir_map::MirMap;
 use rustc::mir::repr as mir;
diff --git a/src/librustc_trans/controlflow.rs b/src/librustc_trans/controlflow.rs
index 6d4b02f076c..58971dec8a9 100644
--- a/src/librustc_trans/controlflow.rs
+++ b/src/librustc_trans/controlflow.rs
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 use llvm::ValueRef;
-use middle::def::Def;
+use rustc::hir::def::Def;
 use middle::lang_items::{PanicFnLangItem, PanicBoundsCheckFnLangItem};
 use rustc::ty::subst::Substs;
 use base::*;
@@ -25,8 +25,7 @@ use debuginfo::{DebugLoc, ToDebugLoc};
 use expr;
 use machine;
 
-use rustc_front::hir;
-use rustc_front::util as ast_util;
+use rustc::hir;
 
 use syntax::ast;
 use syntax::parse::token::InternedString;
@@ -49,7 +48,7 @@ pub fn trans_stmt<'blk, 'tcx>(cx: Block<'blk, 'tcx>,
 
     let mut bcx = cx;
 
-    let id = ast_util::stmt_id(s);
+    let id = s.node.id();
     let cleanup_debug_loc =
         debuginfo::get_cleanup_debug_loc_for_ast_node(bcx.ccx(), id, s.span, false);
     fcx.push_ast_cleanup_scope(cleanup_debug_loc);
@@ -70,7 +69,7 @@ pub fn trans_stmt<'blk, 'tcx>(cx: Block<'blk, 'tcx>,
         }
     }
 
-    bcx = fcx.pop_and_trans_ast_cleanup_scope(bcx, ast_util::stmt_id(s));
+    bcx = fcx.pop_and_trans_ast_cleanup_scope(bcx, s.node.id());
 
     return bcx;
 }
diff --git a/src/librustc_trans/debuginfo/create_scope_map.rs b/src/librustc_trans/debuginfo/create_scope_map.rs
index a7f2bf4a5fa..b1cfeb8125b 100644
--- a/src/librustc_trans/debuginfo/create_scope_map.rs
+++ b/src/librustc_trans/debuginfo/create_scope_map.rs
@@ -14,15 +14,14 @@ use super::utils::DIB;
 use llvm;
 use llvm::debuginfo::{DIScope, DISubprogram};
 use common::CrateContext;
-use middle::pat_util;
+use rustc::hir::pat_util;
 use rustc::util::nodemap::NodeMap;
 
 use libc::c_uint;
 use syntax::codemap::{Span, Pos};
 use syntax::{ast, codemap};
 
-use rustc_front;
-use rustc_front::hir::{self, PatKind};
+use rustc::hir::{self, PatKind};
 
 // This procedure builds the *scope map* for a given function, which maps any
 // given ast::NodeId in the function's AST to the correct DIScope metadata instance.
@@ -117,7 +116,7 @@ fn walk_block(cx: &CrateContext,
 
     // The interesting things here are statements and the concluding expression.
     for statement in &block.stmts {
-        scope_map.insert(rustc_front::util::stmt_id(statement),
+        scope_map.insert(statement.node.id(),
                          scope_stack.last().unwrap().scope_metadata);
 
         match statement.node {
diff --git a/src/librustc_trans/debuginfo/metadata.rs b/src/librustc_trans/debuginfo/metadata.rs
index 5690b18bc8e..822155f8c36 100644
--- a/src/librustc_trans/debuginfo/metadata.rs
+++ b/src/librustc_trans/debuginfo/metadata.rs
@@ -23,12 +23,12 @@ use super::{declare_local, VariableKind, VariableAccess};
 use llvm::{self, ValueRef};
 use llvm::debuginfo::{DIType, DIFile, DIScope, DIDescriptor, DICompositeType};
 
-use middle::def_id::DefId;
+use rustc::hir::def_id::DefId;
 use rustc::infer;
-use middle::pat_util;
+use rustc::hir::pat_util;
 use rustc::ty::subst;
-use rustc::front::map as hir_map;
-use rustc_front::hir::{self, PatKind};
+use rustc::hir::map as hir_map;
+use rustc::hir::{self, PatKind};
 use {type_of, adt, machine, monomorphize};
 use common::{self, CrateContext, FunctionContext, Block};
 use _match::{BindingInfo, TransBindingMode};
diff --git a/src/librustc_trans/debuginfo/mod.rs b/src/librustc_trans/debuginfo/mod.rs
index 6b92989cf46..bb999c31ffb 100644
--- a/src/librustc_trans/debuginfo/mod.rs
+++ b/src/librustc_trans/debuginfo/mod.rs
@@ -26,11 +26,10 @@ use llvm;
 use llvm::{ModuleRef, ContextRef, ValueRef};
 use llvm::debuginfo::{DIFile, DIType, DIScope, DIBuilderRef, DISubprogram, DIArray,
                       DIDescriptor, FlagPrototyped};
-use middle::def_id::DefId;
+use rustc::hir::def_id::DefId;
 use rustc::infer::normalize_associated_type;
 use rustc::ty::subst::{self, Substs};
-use rustc_front;
-use rustc_front::hir;
+use rustc::hir;
 
 use abi::Abi;
 use common::{NodeIdAndSpan, CrateContext, FunctionContext, Block};
@@ -39,7 +38,7 @@ use rustc::infer;
 use rustc::ty::{self, Ty};
 use session::config::{self, FullDebugInfo, LimitedDebugInfo, NoDebugInfo};
 use util::nodemap::{NodeMap, FnvHashMap, FnvHashSet};
-use rustc::front::map as hir_map;
+use rustc::hir::map as hir_map;
 
 use libc::c_uint;
 use std::cell::{Cell, RefCell};
@@ -239,7 +238,7 @@ pub fn create_function_debug_context<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
         return FunctionDebugContext::FunctionWithoutDebugInfo;
     }
 
-    let empty_generics = rustc_front::util::empty_generics();
+    let empty_generics = hir::Generics::empty();
 
     let fnitem = cx.tcx().map.get(fn_ast_id);
 
diff --git a/src/librustc_trans/debuginfo/namespace.rs b/src/librustc_trans/debuginfo/namespace.rs
index 445f85c52fc..5272a4fbbb7 100644
--- a/src/librustc_trans/debuginfo/namespace.rs
+++ b/src/librustc_trans/debuginfo/namespace.rs
@@ -14,11 +14,12 @@ use super::utils::{DIB, debug_context};
 
 use llvm;
 use llvm::debuginfo::DIScope;
-use rustc::middle::def_id::DefId;
-use rustc::front::map as hir_map;
+use rustc::hir::def_id::DefId;
+use rustc::hir::map as hir_map;
 use common::CrateContext;
 
 use std::ffi::CString;
+use std::iter::once;
 use std::ptr;
 use std::rc::{Rc, Weak};
 use syntax::ast;
@@ -51,85 +52,76 @@ impl NamespaceTreeNode {
     }
 }
 
-pub fn crate_root_namespace<'a>(cx: &'a CrateContext) -> &'a str {
-    &cx.link_meta().crate_name
-}
-
 pub fn namespace_for_item(cx: &CrateContext, def_id: DefId) -> Rc<NamespaceTreeNode> {
-    cx.tcx().with_path(def_id, |path| {
-        // prepend crate name if not already present
-        let krate = if def_id.is_local() {
-            let crate_namespace_name = token::intern(crate_root_namespace(cx));
-            Some(hir_map::PathMod(crate_namespace_name))
-        } else {
-            None
+    // prepend crate name.
+    // This shouldn't need a roundtrip through InternedString.
+    let krate = token::intern(&cx.tcx().crate_name(def_id.krate));
+    let krate = hir_map::DefPathData::TypeNs(krate);
+    let path = cx.tcx().def_path(def_id).data;
+    let mut path = once(krate).chain(path.into_iter().map(|e| e.data)).peekable();
+
+    let mut current_key = Vec::new();
+    let mut parent_node: Option<Rc<NamespaceTreeNode>> = None;
+
+    // Create/Lookup namespace for each element of the path.
+    loop {
+        // Emulate a for loop so we can use peek below.
+        let path_element = match path.next() {
+            Some(e) => e,
+            None => break
         };
-        let mut path = krate.into_iter().chain(path).peekable();
-
-        let mut current_key = Vec::new();
-        let mut parent_node: Option<Rc<NamespaceTreeNode>> = None;
-
-        // Create/Lookup namespace for each element of the path.
-        loop {
-            // Emulate a for loop so we can use peek below.
-            let path_element = match path.next() {
-                Some(e) => e,
-                None => break
-            };
-            // Ignore the name of the item (the last path element).
-            if path.peek().is_none() {
-                break;
-            }
-
-            let name = path_element.name();
-            current_key.push(name);
-
-            let existing_node = debug_context(cx).namespace_map.borrow()
-                                                 .get(&current_key).cloned();
-            let current_node = match existing_node {
-                Some(existing_node) => existing_node,
-                None => {
-                    // create and insert
-                    let parent_scope = match parent_node {
-                        Some(ref node) => node.scope,
-                        None => ptr::null_mut()
-                    };
-                    let namespace_name = name.as_str();
-                    let namespace_name = CString::new(namespace_name.as_bytes()).unwrap();
-                    let scope = unsafe {
-                        llvm::LLVMDIBuilderCreateNameSpace(
-                            DIB(cx),
-                            parent_scope,
-                            namespace_name.as_ptr(),
-                            // cannot reconstruct file ...
-                            ptr::null_mut(),
-                            // ... or line information, but that's not so important.
-                            0)
-                    };
-
-                    let node = Rc::new(NamespaceTreeNode {
-                        name: name,
-                        scope: scope,
-                        parent: parent_node.map(|parent| Rc::downgrade(&parent)),
-                    });
-
-                    debug_context(cx).namespace_map.borrow_mut()
-                                     .insert(current_key.clone(), node.clone());
-
-                    node
-                }
-            };
-
-            parent_node = Some(current_node);
+        // Ignore the name of the item (the last path element).
+        if path.peek().is_none() {
+            break;
         }
 
-        match parent_node {
-            Some(node) => node,
+        // This shouldn't need a roundtrip through InternedString.
+        let namespace_name = path_element.as_interned_str();
+        let name = token::intern(&namespace_name);
+        current_key.push(name);
+
+        let existing_node = debug_context(cx).namespace_map.borrow()
+                                             .get(&current_key).cloned();
+        let current_node = match existing_node {
+            Some(existing_node) => existing_node,
             None => {
-                bug!("debuginfo::namespace_for_item(): \
-                      path too short for {:?}",
-                     def_id);
+                // create and insert
+                let parent_scope = match parent_node {
+                    Some(ref node) => node.scope,
+                    None => ptr::null_mut()
+                };
+                let namespace_name = CString::new(namespace_name.as_bytes()).unwrap();
+                let scope = unsafe {
+                    llvm::LLVMDIBuilderCreateNameSpace(
+                        DIB(cx),
+                        parent_scope,
+                        namespace_name.as_ptr(),
+                        // cannot reconstruct file ...
+                        ptr::null_mut(),
+                        // ... or line information, but that's not so important.
+                        0)
+                };
+
+                let node = Rc::new(NamespaceTreeNode {
+                    name: name,
+                    scope: scope,
+                    parent: parent_node.map(|parent| Rc::downgrade(&parent)),
+                });
+
+                debug_context(cx).namespace_map.borrow_mut()
+                                 .insert(current_key.clone(), node.clone());
+
+                node
             }
+        };
+
+        parent_node = Some(current_node);
+    }
+
+    match parent_node {
+        Some(node) => node,
+        None => {
+            bug!("debuginfo::namespace_for_item: path too short for {:?}", def_id);
         }
-    })
+    }
 }
diff --git a/src/librustc_trans/debuginfo/type_names.rs b/src/librustc_trans/debuginfo/type_names.rs
index a6aa8df92db..6fdd6a2c1d1 100644
--- a/src/librustc_trans/debuginfo/type_names.rs
+++ b/src/librustc_trans/debuginfo/type_names.rs
@@ -10,15 +10,13 @@
 
 // Type Names for Debug Info.
 
-use super::namespace::crate_root_namespace;
-
 use common::CrateContext;
-use middle::def_id::DefId;
+use rustc::hir::def_id::DefId;
 use rustc::infer;
 use rustc::ty::subst;
 use rustc::ty::{self, Ty};
 
-use rustc_front::hir;
+use rustc::hir;
 
 // Compute the name of the type as it should be stored in debuginfo. Does not do
 // any caching, i.e. calling the function twice with the same type will also do
@@ -163,31 +161,15 @@ pub fn push_debuginfo_type_name<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
                       def_id: DefId,
                       qualified: bool,
                       output: &mut String) {
-        cx.tcx().with_path(def_id, |path| {
-            if qualified {
-                if def_id.is_local() {
-                    output.push_str(crate_root_namespace(cx));
-                    output.push_str("::");
-                }
-
-                let mut path_element_count = 0;
-                for path_element in path {
-                    output.push_str(&path_element.name().as_str());
-                    output.push_str("::");
-                    path_element_count += 1;
-                }
-
-                if path_element_count == 0 {
-                    bug!("debuginfo: Encountered empty item path!");
-                }
-
-                output.pop();
-                output.pop();
-            } else {
-                let name = path.last().expect("debuginfo: Empty item path?").name();
-                output.push_str(&name.as_str());
+        if qualified {
+            output.push_str(&cx.tcx().crate_name(def_id.krate));
+            for path_element in cx.tcx().def_path(def_id).data {
+                output.push_str("::");
+                output.push_str(&path_element.data.as_interned_str());
             }
-        });
+        } else {
+            output.push_str(&cx.tcx().item_name(def_id).as_str());
+        }
     }
 
     // Pushes the type parameters in the given `Substs` to the output string.
diff --git a/src/librustc_trans/debuginfo/utils.rs b/src/librustc_trans/debuginfo/utils.rs
index 61dc3dc3f8f..bef7af3aec6 100644
--- a/src/librustc_trans/debuginfo/utils.rs
+++ b/src/librustc_trans/debuginfo/utils.rs
@@ -13,7 +13,7 @@
 use super::{FunctionDebugContext, CrateDebugContext};
 use super::namespace::namespace_for_item;
 
-use middle::def_id::DefId;
+use rustc::hir::def_id::DefId;
 
 use llvm;
 use llvm::debuginfo::{DIScope, DIBuilderRef, DIDescriptor, DIArray};
diff --git a/src/librustc_trans/expr.rs b/src/librustc_trans/expr.rs
index 5e193b96278..beca81da05f 100644
--- a/src/librustc_trans/expr.rs
+++ b/src/librustc_trans/expr.rs
@@ -53,7 +53,7 @@ use self::lazy_binop_ty::*;
 
 use llvm::{self, ValueRef, TypeKind};
 use middle::const_qualif::ConstQualif;
-use middle::def::Def;
+use rustc::hir::def::Def;
 use rustc::ty::subst::Substs;
 use {_match, abi, adt, asm, base, closure, consts, controlflow};
 use base::*;
@@ -80,8 +80,7 @@ use util::common::indenter;
 use machine::{llsize_of, llsize_of_alloc};
 use type_::Type;
 
-use rustc_front;
-use rustc_front::hir;
+use rustc::hir;
 
 use syntax::{ast, codemap};
 use syntax::parse::token::InternedString;
@@ -1181,7 +1180,7 @@ fn trans_rvalue_dps_unadjusted<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
             // if not overloaded, would be RvalueDatumExpr
             let lhs = unpack_datum!(bcx, trans(bcx, &lhs));
             let mut rhs = unpack_datum!(bcx, trans(bcx, &rhs_expr));
-            if !rustc_front::util::is_by_value_binop(op.node) {
+            if !op.node.is_by_value() {
                 rhs = unpack_datum!(bcx, auto_ref(bcx, rhs, rhs_expr));
             }
 
@@ -1205,7 +1204,7 @@ fn trans_rvalue_dps_unadjusted<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
             span_bug!(
                 expr.span,
                 "augmented assignment `{}=` should always be a rvalue_stmt",
-                rustc_front::util::binop_to_string(op.node))
+                op.node.as_str())
         }
         _ => {
             span_bug!(
diff --git a/src/librustc_trans/inline.rs b/src/librustc_trans/inline.rs
index 4d18e3bd495..1eff09d67f9 100644
--- a/src/librustc_trans/inline.rs
+++ b/src/librustc_trans/inline.rs
@@ -10,14 +10,14 @@
 
 use llvm::{AvailableExternallyLinkage, InternalLinkage, SetLinkage};
 use middle::cstore::{CrateStore, FoundAst, InlinedItem};
-use middle::def_id::DefId;
+use rustc::hir::def_id::DefId;
 use rustc::ty::subst::Substs;
 use base::{push_ctxt, trans_item, trans_fn};
 use callee::Callee;
 use common::*;
 
 use rustc::dep_graph::DepNode;
-use rustc_front::hir;
+use rustc::hir;
 
 fn instantiate_inline(ccx: &CrateContext, fn_id: DefId) -> Option<DefId> {
     debug!("instantiate_inline({:?})", fn_id);
diff --git a/src/librustc_trans/intrinsic.rs b/src/librustc_trans/intrinsic.rs
index 28d5d9ac176..355de31bf59 100644
--- a/src/librustc_trans/intrinsic.rs
+++ b/src/librustc_trans/intrinsic.rs
@@ -40,7 +40,7 @@ use rustc::ty::{self, Ty, TypeFoldable};
 use Disr;
 use rustc::ty::subst::Substs;
 use rustc::dep_graph::DepNode;
-use rustc_front::hir;
+use rustc::hir;
 use syntax::ast;
 use syntax::ptr::P;
 use syntax::parse::token;
diff --git a/src/librustc_trans/lib.rs b/src/librustc_trans/lib.rs
index 8c6a68cfcf1..19a172e7f10 100644
--- a/src/librustc_trans/lib.rs
+++ b/src/librustc_trans/lib.rs
@@ -46,7 +46,6 @@ extern crate libc;
 #[macro_use] extern crate rustc;
 extern crate rustc_back;
 extern crate rustc_data_structures;
-extern crate rustc_front;
 pub extern crate rustc_llvm as llvm;
 extern crate rustc_mir;
 extern crate rustc_platform_intrinsics as intrinsics;
@@ -67,7 +66,7 @@ pub use disr::Disr;
 
 pub mod back {
     pub use rustc_back::rpath;
-    pub use rustc_back::svh;
+    pub use rustc::hir::svh;
 
     pub mod archive;
     pub mod linker;
diff --git a/src/librustc_trans/meth.rs b/src/librustc_trans/meth.rs
index 82b61e15f2b..478094c2b87 100644
--- a/src/librustc_trans/meth.rs
+++ b/src/librustc_trans/meth.rs
@@ -13,7 +13,7 @@ use std::rc::Rc;
 use arena::TypedArena;
 use back::symbol_names;
 use llvm::{ValueRef, get_params};
-use middle::def_id::DefId;
+use rustc::hir::def_id::DefId;
 use rustc::infer;
 use rustc::ty::subst::{FnSpace, Subst, Substs};
 use rustc::ty::subst;
diff --git a/src/librustc_trans/mir/rvalue.rs b/src/librustc_trans/mir/rvalue.rs
index 3f7a6c5f180..8e5d220b4f4 100644
--- a/src/librustc_trans/mir/rvalue.rs
+++ b/src/librustc_trans/mir/rvalue.rs
@@ -134,7 +134,7 @@ impl<'bcx, 'tcx> MirContext<'bcx, 'tcx> {
                     _ => {
                         // FIXME Shouldn't need to manually trigger closure instantiations.
                         if let mir::AggregateKind::Closure(def_id, substs) = *kind {
-                            use rustc_front::hir;
+                            use rustc::hir;
                             use syntax::ast::DUMMY_NODE_ID;
                             use syntax::codemap::DUMMY_SP;
                             use syntax::ptr::P;
diff --git a/src/librustc_trans/monomorphize.rs b/src/librustc_trans/monomorphize.rs
index 554e1948fe9..ef0da37f0b2 100644
--- a/src/librustc_trans/monomorphize.rs
+++ b/src/librustc_trans/monomorphize.rs
@@ -11,7 +11,7 @@
 use back::symbol_names;
 use llvm::ValueRef;
 use llvm;
-use middle::def_id::DefId;
+use rustc::hir::def_id::DefId;
 use rustc::infer::normalize_associated_type;
 use rustc::ty::subst;
 use rustc::ty::subst::{Subst, Substs};
@@ -23,10 +23,10 @@ use base;
 use common::*;
 use declare;
 use Disr;
-use rustc::front::map as hir_map;
+use rustc::hir::map as hir_map;
 use rustc::util::ppaux;
 
-use rustc_front::hir;
+use rustc::hir;
 
 use syntax::attr;
 use syntax::errors;
diff --git a/src/librustc_trans/symbol_names_test.rs b/src/librustc_trans/symbol_names_test.rs
index a75b6f736ee..2e3355968df 100644
--- a/src/librustc_trans/symbol_names_test.rs
+++ b/src/librustc_trans/symbol_names_test.rs
@@ -15,8 +15,8 @@
 //! paths etc in all kinds of annoying scenarios.
 
 use back::symbol_names;
-use rustc_front::hir;
-use rustc_front::intravisit::{self, Visitor};
+use rustc::hir;
+use rustc::hir::intravisit::{self, Visitor};
 use syntax::ast;
 use syntax::attr::AttrMetaMethods;
 
diff --git a/src/librustc_trans/tvec.rs b/src/librustc_trans/tvec.rs
index b9af02ac529..f5b9bef5313 100644
--- a/src/librustc_trans/tvec.rs
+++ b/src/librustc_trans/tvec.rs
@@ -29,7 +29,7 @@ use type_of;
 use value::Value;
 use rustc::ty::{self, Ty};
 
-use rustc_front::hir;
+use rustc::hir;
 use rustc_const_eval::eval_repeat_count;
 
 use syntax::ast;
diff --git a/src/librustc_trans/type_of.rs b/src/librustc_trans/type_of.rs
index 8b1aaafab58..500eda2624c 100644
--- a/src/librustc_trans/type_of.rs
+++ b/src/librustc_trans/type_of.rs
@@ -10,7 +10,7 @@
 
 #![allow(non_camel_case_types)]
 
-use middle::def_id::DefId;
+use rustc::hir::def_id::DefId;
 use rustc::infer;
 use rustc::ty::subst;
 use abi::FnType;
diff --git a/src/librustc_typeck/Cargo.toml b/src/librustc_typeck/Cargo.toml
index 6f46686feb5..e9dabf16eae 100644
--- a/src/librustc_typeck/Cargo.toml
+++ b/src/librustc_typeck/Cargo.toml
@@ -17,5 +17,4 @@ rustc = { path = "../librustc" }
 rustc_back = { path = "../librustc_back" }
 rustc_const_eval = { path = "../librustc_const_eval" }
 rustc_const_math = { path = "../librustc_const_math" }
-rustc_front = { path = "../librustc_front" }
 rustc_platform_intrinsics = { path = "../librustc_platform_intrinsics" }
diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs
index d925ff9fa3c..21122e7095d 100644
--- a/src/librustc_typeck/astconv.rs
+++ b/src/librustc_typeck/astconv.rs
@@ -52,8 +52,8 @@ use middle::astconv_util::{prim_ty_to_ty, prohibit_type_params, prohibit_project
 use middle::const_val::ConstVal;
 use rustc_const_eval::eval_const_expr_partial;
 use rustc_const_eval::EvalHint::UncheckedExprHint;
-use middle::def::{self, Def};
-use middle::def_id::DefId;
+use hir::def::{self, Def};
+use hir::def_id::DefId;
 use middle::resolve_lifetime as rl;
 use rustc::ty::subst::{FnSpace, TypeSpace, SelfSpace, Subst, Substs, ParamSpace};
 use rustc::traits;
@@ -74,8 +74,8 @@ use syntax::errors::DiagnosticBuilder;
 use syntax::feature_gate::{GateIssue, emit_feature_err};
 use syntax::parse::token;
 
-use rustc_front::print::pprust;
-use rustc_front::hir;
+use rustc::hir::print as pprust;
+use rustc::hir;
 use rustc_back::slice;
 
 pub trait AstConv<'tcx> {
diff --git a/src/librustc_typeck/check/_match.rs b/src/librustc_typeck/check/_match.rs
index 55c3a5add37..8dbd6496b6f 100644
--- a/src/librustc_typeck/check/_match.rs
+++ b/src/librustc_typeck/check/_match.rs
@@ -8,10 +8,10 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use middle::def::{self, Def};
+use hir::def::{self, Def};
 use rustc::infer::{self, InferOk, TypeOrigin};
-use middle::pat_util::{PatIdMap, pat_id_map, pat_is_binding};
-use middle::pat_util::pat_is_resolved_const;
+use hir::pat_util::{PatIdMap, pat_id_map, pat_is_binding};
+use hir::pat_util::pat_is_resolved_const;
 use rustc::ty::subst::Substs;
 use rustc::ty::{self, Ty, TypeFoldable, LvaluePreference};
 use check::{check_expr, check_expr_has_type, check_expr_with_expectation};
@@ -30,9 +30,8 @@ use syntax::ast;
 use syntax::codemap::{Span, Spanned};
 use syntax::ptr::P;
 
-use rustc_front::hir::{self, PatKind};
-use rustc_front::print::pprust;
-use rustc_front::util as hir_util;
+use rustc::hir::{self, PatKind};
+use rustc::hir::print as pprust;
 
 pub fn check_pat<'a, 'tcx>(pcx: &pat_ctxt<'a, 'tcx>,
                            pat: &'tcx hir::Pat,
@@ -197,7 +196,7 @@ pub fn check_pat<'a, 'tcx>(pcx: &pat_ctxt<'a, 'tcx>,
             }
         }
         PatKind::Ident(_, ref path, _) => {
-            let path = hir_util::ident_to_path(path.span, path.node);
+            let path = hir::Path::from_ident(path.span, path.node);
             check_pat_enum(pcx, pat, &path, Some(&[]), expected, false);
         }
         PatKind::TupleStruct(ref path, ref subpats) => {
diff --git a/src/librustc_typeck/check/callee.rs b/src/librustc_typeck/check/callee.rs
index bedf4753313..21800d91d94 100644
--- a/src/librustc_typeck/check/callee.rs
+++ b/src/librustc_typeck/check/callee.rs
@@ -26,15 +26,15 @@ use super::write_call;
 
 use CrateCtxt;
 use middle::cstore::LOCAL_CRATE;
-use middle::def::Def;
-use middle::def_id::DefId;
+use hir::def::Def;
+use hir::def_id::DefId;
 use rustc::infer;
 use rustc::ty::{self, LvaluePreference, Ty};
 use syntax::codemap::Span;
 use syntax::parse::token;
 use syntax::ptr::P;
 
-use rustc_front::hir;
+use rustc::hir;
 
 /// Check that it is legal to call methods of the trait corresponding
 /// to `trait_id` (this only cares about the trait, not the specific
diff --git a/src/librustc_typeck/check/cast.rs b/src/librustc_typeck/check/cast.rs
index d743a036040..91cdb8d966d 100644
--- a/src/librustc_typeck/check/cast.rs
+++ b/src/librustc_typeck/check/cast.rs
@@ -44,11 +44,11 @@ use super::FnCtxt;
 use super::structurally_resolved_type;
 
 use lint;
-use middle::def_id::DefId;
+use hir::def_id::DefId;
 use rustc::ty::{self, Ty, TypeFoldable};
 use rustc::ty::cast::{CastKind, CastTy};
 use syntax::codemap::Span;
-use rustc_front::hir;
+use rustc::hir;
 use syntax::ast;
 
 
diff --git a/src/librustc_typeck/check/closure.rs b/src/librustc_typeck/check/closure.rs
index 9333b10d27e..7bca570411c 100644
--- a/src/librustc_typeck/check/closure.rs
+++ b/src/librustc_typeck/check/closure.rs
@@ -17,7 +17,7 @@ use rustc::ty::subst;
 use rustc::ty::{self, ToPolyTraitRef, Ty};
 use std::cmp;
 use syntax::abi::Abi;
-use rustc_front::hir;
+use rustc::hir;
 
 pub fn check_expr_closure<'a,'tcx>(fcx: &FnCtxt<'a,'tcx>,
                                    expr: &hir::Expr,
diff --git a/src/librustc_typeck/check/coercion.rs b/src/librustc_typeck/check/coercion.rs
index cafd0519c28..f1c6868efd2 100644
--- a/src/librustc_typeck/check/coercion.rs
+++ b/src/librustc_typeck/check/coercion.rs
@@ -76,7 +76,7 @@ use util::common::indent;
 
 use std::cell::RefCell;
 use std::collections::VecDeque;
-use rustc_front::hir;
+use rustc::hir;
 
 struct Coerce<'a, 'tcx: 'a> {
     fcx: &'a FnCtxt<'a, 'tcx>,
diff --git a/src/librustc_typeck/check/demand.rs b/src/librustc_typeck/check/demand.rs
index bc2ef9aafee..5b163eb7de4 100644
--- a/src/librustc_typeck/check/demand.rs
+++ b/src/librustc_typeck/check/demand.rs
@@ -14,7 +14,7 @@ use rustc::ty::Ty;
 use rustc::infer::{InferOk, TypeOrigin};
 
 use syntax::codemap::Span;
-use rustc_front::hir;
+use rustc::hir;
 
 // Requires that the two types unify, and prints an error message if
 // they don't.
diff --git a/src/librustc_typeck/check/dropck.rs b/src/librustc_typeck/check/dropck.rs
index 1f1bba509e0..368b826b1bb 100644
--- a/src/librustc_typeck/check/dropck.rs
+++ b/src/librustc_typeck/check/dropck.rs
@@ -10,7 +10,7 @@
 
 use check::regionck::{self, Rcx};
 
-use middle::def_id::DefId;
+use hir::def_id::DefId;
 use middle::free_region::FreeRegionMap;
 use rustc::infer;
 use middle::region;
diff --git a/src/librustc_typeck/check/intrinsic.rs b/src/librustc_typeck/check/intrinsic.rs
index 3c43e0d5217..eae0cfb0f22 100644
--- a/src/librustc_typeck/check/intrinsic.rs
+++ b/src/librustc_typeck/check/intrinsic.rs
@@ -26,7 +26,7 @@ use syntax::attr::AttrMetaMethods;
 use syntax::codemap::Span;
 use syntax::parse::token;
 
-use rustc_front::hir;
+use rustc::hir;
 
 fn equate_intrinsic_type<'a, 'tcx>(tcx: &TyCtxt<'tcx>, it: &hir::ForeignItem,
                                    n_tps: usize,
diff --git a/src/librustc_typeck/check/method/confirm.rs b/src/librustc_typeck/check/method/confirm.rs
index f90a5696539..b98f1884f01 100644
--- a/src/librustc_typeck/check/method/confirm.rs
+++ b/src/librustc_typeck/check/method/confirm.rs
@@ -12,7 +12,7 @@ use super::probe;
 
 use check::{self, FnCtxt, callee, demand};
 use check::UnresolvedTypeAction;
-use middle::def_id::DefId;
+use hir::def_id::DefId;
 use rustc::ty::subst::{self};
 use rustc::traits;
 use rustc::ty::{self, NoPreference, PreferMutLvalue, Ty, TyCtxt};
@@ -21,7 +21,7 @@ use rustc::ty::fold::TypeFoldable;
 use rustc::infer;
 use rustc::infer::{InferCtxt, TypeOrigin};
 use syntax::codemap::Span;
-use rustc_front::hir;
+use rustc::hir;
 
 struct ConfirmContext<'a, 'tcx:'a> {
     fcx: &'a FnCtxt<'a, 'tcx>,
diff --git a/src/librustc_typeck/check/method/mod.rs b/src/librustc_typeck/check/method/mod.rs
index 43a18d2c102..3f069a68316 100644
--- a/src/librustc_typeck/check/method/mod.rs
+++ b/src/librustc_typeck/check/method/mod.rs
@@ -12,8 +12,8 @@
 
 use astconv::AstConv;
 use check::FnCtxt;
-use middle::def::Def;
-use middle::def_id::DefId;
+use hir::def::Def;
+use hir::def_id::DefId;
 use rustc::ty::subst;
 use rustc::traits;
 use rustc::ty::{self, TyCtxt, ToPredicate, ToPolyTraitRef, TraitRef, TypeFoldable};
@@ -23,7 +23,7 @@ use rustc::infer;
 use syntax::ast;
 use syntax::codemap::Span;
 
-use rustc_front::hir;
+use rustc::hir;
 
 pub use self::MethodError::*;
 pub use self::CandidateSource::*;
diff --git a/src/librustc_typeck/check/method/probe.rs b/src/librustc_typeck/check/method/probe.rs
index 2e15ac0e130..7d98eac30c5 100644
--- a/src/librustc_typeck/check/method/probe.rs
+++ b/src/librustc_typeck/check/method/probe.rs
@@ -15,8 +15,8 @@ use super::suggest;
 
 use check;
 use check::{FnCtxt, UnresolvedTypeAction};
-use middle::def_id::DefId;
-use middle::def::Def;
+use hir::def_id::DefId;
+use hir::def::Def;
 use rustc::ty::subst;
 use rustc::ty::subst::Subst;
 use rustc::traits;
@@ -24,7 +24,7 @@ use rustc::ty::{self, NoPreference, Ty, TyCtxt, ToPolyTraitRef, TraitRef, TypeFo
 use rustc::infer::{self, InferCtxt, InferOk, TypeOrigin};
 use syntax::ast;
 use syntax::codemap::{Span, DUMMY_SP};
-use rustc_front::hir;
+use rustc::hir;
 use std::collections::HashSet;
 use std::mem;
 use std::rc::Rc;
diff --git a/src/librustc_typeck/check/method/suggest.rs b/src/librustc_typeck/check/method/suggest.rs
index 32b5a63817e..c5195cf8787 100644
--- a/src/librustc_typeck/check/method/suggest.rs
+++ b/src/librustc_typeck/check/method/suggest.rs
@@ -15,11 +15,11 @@ use CrateCtxt;
 
 use astconv::AstConv;
 use check::{self, FnCtxt, UnresolvedTypeAction, autoderef};
-use front::map as hir_map;
+use rustc::hir::map as hir_map;
 use rustc::ty::{self, Ty, ToPolyTraitRef, ToPredicate, TypeFoldable};
 use middle::cstore::{self, CrateStore};
-use middle::def::Def;
-use middle::def_id::DefId;
+use hir::def::Def;
+use hir::def_id::DefId;
 use middle::lang_items::FnOnceTraitLangItem;
 use rustc::ty::subst::Substs;
 use rustc::ty::LvaluePreference;
@@ -30,9 +30,9 @@ use util::nodemap::{FnvHashSet};
 use syntax::ast;
 use syntax::codemap::Span;
 use syntax::errors::DiagnosticBuilder;
-use rustc_front::print::pprust;
-use rustc_front::hir;
-use rustc_front::hir::Expr_;
+use rustc::hir::print as pprust;
+use rustc::hir;
+use rustc::hir::Expr_;
 
 use std::cell;
 use std::cmp::Ordering;
@@ -436,7 +436,7 @@ impl Ord for TraitInfo {
 /// Retrieve all traits in this crate and any dependent crates.
 pub fn all_traits<'a>(ccx: &'a CrateCtxt) -> AllTraits<'a> {
     if ccx.all_traits.borrow().is_none() {
-        use rustc_front::intravisit;
+        use rustc::hir::intravisit;
 
         let mut traits = vec![];
 
diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs
index e485fbe1621..e7159e65eeb 100644
--- a/src/librustc_typeck/check/mod.rs
+++ b/src/librustc_typeck/check/mod.rs
@@ -86,10 +86,10 @@ use dep_graph::DepNode;
 use fmt_macros::{Parser, Piece, Position};
 use middle::astconv_util::prohibit_type_params;
 use middle::cstore::LOCAL_CRATE;
-use middle::def::{self, Def};
-use middle::def_id::DefId;
+use hir::def::{self, Def};
+use hir::def_id::DefId;
 use rustc::infer::{self, InferOk, TypeOrigin, TypeTrace, type_variable};
-use middle::pat_util::{self, pat_id_map};
+use hir::pat_util::{self, pat_id_map};
 use rustc::ty::subst::{self, Subst, Substs, VecPerParamSpace, ParamSpace};
 use rustc::traits::{self, report_fulfillment_errors, ProjectionMode};
 use rustc::ty::{GenericPredicates, TypeScheme};
@@ -124,10 +124,10 @@ use syntax::parse::token::{self, InternedString, special_idents};
 use syntax::ptr::P;
 use syntax::util::lev_distance::find_best_match_for_name;
 
-use rustc_front::intravisit::{self, Visitor};
-use rustc_front::hir;
-use rustc_front::hir::{Visibility, PatKind};
-use rustc_front::print::pprust;
+use rustc::hir::intravisit::{self, Visitor};
+use rustc::hir;
+use rustc::hir::{Visibility, PatKind};
+use rustc::hir::print as pprust;
 use rustc_back::slice;
 use rustc_const_eval::eval_repeat_count;
 
@@ -3987,7 +3987,7 @@ fn check_block_with_expected<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
     let mut any_err = false;
     for s in &blk.stmts {
         check_stmt(fcx, s);
-        let s_id = ::rustc_front::util::stmt_id(s);
+        let s_id = s.node.id();
         let s_ty = fcx.node_ty(s_id);
         if any_diverges && !warned && match s.node {
             hir::StmtDecl(ref decl, _) => {
diff --git a/src/librustc_typeck/check/op.rs b/src/librustc_typeck/check/op.rs
index 494135ee3ff..debf9258757 100644
--- a/src/librustc_typeck/check/op.rs
+++ b/src/librustc_typeck/check/op.rs
@@ -18,12 +18,11 @@ use super::{
     method,
     FnCtxt,
 };
-use middle::def_id::DefId;
+use hir::def_id::DefId;
 use rustc::ty::{Ty, TypeFoldable, PreferMutLvalue};
 use syntax::ast;
 use syntax::parse::token;
-use rustc_front::hir;
-use rustc_front::util as hir_util;
+use rustc::hir;
 
 /// Check a `a <op>= b`
 pub fn check_binop_assign<'a,'tcx>(fcx: &FnCtxt<'a,'tcx>,
@@ -184,12 +183,12 @@ fn check_overloaded_binop<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
                 if let IsAssign::Yes = is_assign {
                     span_err!(fcx.tcx().sess, lhs_expr.span, E0368,
                               "binary assignment operation `{}=` cannot be applied to type `{}`",
-                              hir_util::binop_to_string(op.node),
+                              op.node.as_str(),
                               lhs_ty);
                 } else {
                     let mut err = struct_span_err!(fcx.tcx().sess, lhs_expr.span, E0369,
                         "binary operation `{}` cannot be applied to type `{}`",
-                        hir_util::binop_to_string(op.node),
+                        op.node.as_str(),
                         lhs_ty);
                     let missing_trait = match op.node {
                         hir::BiAdd    => Some("std::ops::Add"),
@@ -235,7 +234,7 @@ pub fn check_user_unop<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
                                  op: hir::UnOp)
                                  -> Ty<'tcx>
 {
-    assert!(hir_util::is_by_value_unop(op));
+    assert!(op.is_by_value());
     match lookup_op_method(fcx, ex, operand_ty, vec![],
                            token::intern(mname), trait_did,
                            operand_expr) {
@@ -272,7 +271,7 @@ fn name_and_trait_def_id(fcx: &FnCtxt,
             hir::BiOr => {
                 span_bug!(op.span,
                           "impossible assignment operation: {}=",
-                          hir_util::binop_to_string(op.node))
+                          op.node.as_str())
             }
         }
     } else {
diff --git a/src/librustc_typeck/check/regionck.rs b/src/librustc_typeck/check/regionck.rs
index 15bf6671de5..2a4de6e091b 100644
--- a/src/librustc_typeck/check/regionck.rs
+++ b/src/librustc_typeck/check/regionck.rs
@@ -93,16 +93,15 @@ use rustc::ty::subst::Substs;
 use rustc::traits;
 use rustc::ty::{self, Ty, TyCtxt, MethodCall, TypeFoldable};
 use rustc::infer::{self, GenericKind, InferCtxt, InferOk, SubregionOrigin, TypeOrigin, VerifyBound};
-use middle::pat_util;
+use hir::pat_util;
 use rustc::ty::adjustment;
 use rustc::ty::wf::ImpliedBound;
 
 use std::mem;
 use syntax::ast;
 use syntax::codemap::Span;
-use rustc_front::intravisit::{self, Visitor};
-use rustc_front::hir::{self, PatKind};
-use rustc_front::util as hir_util;
+use rustc::hir::intravisit::{self, Visitor};
+use rustc::hir::{self, PatKind};
 
 use self::SubjectNode::Subject;
 
@@ -689,7 +688,7 @@ fn visit_expr(rcx: &mut Rcx, expr: &hir::Expr) {
         },
 
         hir::ExprBinary(op, ref lhs, ref rhs) if has_method_map => {
-            let implicitly_ref_args = !hir_util::is_by_value_binop(op.node);
+            let implicitly_ref_args = !op.node.is_by_value();
 
             // As `expr_method_call`, but the call is via an
             // overloaded op.  Note that we (sadly) currently use an
@@ -716,7 +715,7 @@ fn visit_expr(rcx: &mut Rcx, expr: &hir::Expr) {
         }
 
         hir::ExprUnary(op, ref lhs) if has_method_map => {
-            let implicitly_ref_args = !hir_util::is_by_value_unop(op);
+            let implicitly_ref_args = !op.is_by_value();
 
             // As above.
             constrain_call(rcx, expr, Some(&lhs),
diff --git a/src/librustc_typeck/check/upvar.rs b/src/librustc_typeck/check/upvar.rs
index 7d51d5ec7f7..40481cda762 100644
--- a/src/librustc_typeck/check/upvar.rs
+++ b/src/librustc_typeck/check/upvar.rs
@@ -51,8 +51,8 @@ use rustc::infer::{InferCtxt, UpvarRegion};
 use std::collections::HashSet;
 use syntax::ast;
 use syntax::codemap::Span;
-use rustc_front::hir;
-use rustc_front::intravisit::{self, Visitor};
+use rustc::hir;
+use rustc::hir::intravisit::{self, Visitor};
 
 ///////////////////////////////////////////////////////////////////////////
 // PUBLIC ENTRY POINTS
diff --git a/src/librustc_typeck/check/wfcheck.rs b/src/librustc_typeck/check/wfcheck.rs
index 68c9816b48c..1b21e6ce9eb 100644
--- a/src/librustc_typeck/check/wfcheck.rs
+++ b/src/librustc_typeck/check/wfcheck.rs
@@ -12,7 +12,7 @@ use astconv::AstConv;
 use check::{FnCtxt, Inherited, blank_fn_ctxt, regionck};
 use constrained_type_params::{identify_constrained_type_params, Parameter};
 use CrateCtxt;
-use middle::def_id::DefId;
+use hir::def_id::DefId;
 use middle::region::{CodeExtent};
 use rustc::ty::subst::{self, TypeSpace, FnSpace, ParamSpace, SelfSpace};
 use rustc::traits;
@@ -25,8 +25,8 @@ use syntax::ast;
 use syntax::codemap::{Span};
 use syntax::errors::DiagnosticBuilder;
 use syntax::parse::token::{special_idents};
-use rustc_front::intravisit::{self, Visitor};
-use rustc_front::hir;
+use rustc::hir::intravisit::{self, Visitor};
+use rustc::hir;
 
 pub struct CheckTypeWellFormedVisitor<'ccx, 'tcx:'ccx> {
     ccx: &'ccx CrateCtxt<'ccx, 'tcx>,
diff --git a/src/librustc_typeck/check/writeback.rs b/src/librustc_typeck/check/writeback.rs
index 7ede85454e9..68327ccd39a 100644
--- a/src/librustc_typeck/check/writeback.rs
+++ b/src/librustc_typeck/check/writeback.rs
@@ -15,8 +15,8 @@ use self::ResolveReason::*;
 
 use astconv::AstConv;
 use check::FnCtxt;
-use middle::def_id::DefId;
-use middle::pat_util;
+use hir::def_id::DefId;
+use hir::pat_util;
 use rustc::ty::{self, Ty, TyCtxt, MethodCall, MethodCallee};
 use rustc::ty::adjustment;
 use rustc::ty::fold::{TypeFolder,TypeFoldable};
@@ -28,10 +28,9 @@ use std::cell::Cell;
 
 use syntax::ast;
 use syntax::codemap::{DUMMY_SP, Span};
-use rustc_front::print::pprust::pat_to_string;
-use rustc_front::intravisit::{self, Visitor};
-use rustc_front::util as hir_util;
-use rustc_front::hir;
+use rustc::hir::print::pat_to_string;
+use rustc::hir::intravisit::{self, Visitor};
+use rustc::hir;
 
 ///////////////////////////////////////////////////////////////////////////
 // Entry point functions
@@ -112,7 +111,7 @@ impl<'cx, 'tcx> WritebackCx<'cx, 'tcx> {
                     // system.
                     match e.node {
                         hir::ExprBinary(..) => {
-                            if !hir_util::is_by_value_binop(op.node) {
+                            if !op.node.is_by_value() {
                                 self.fcx.inh.tables.borrow_mut().adjustments.remove(&lhs.id);
                             }
                         },
@@ -142,7 +141,7 @@ impl<'cx, 'tcx, 'v> Visitor<'v> for WritebackCx<'cx, 'tcx> {
             return;
         }
 
-        self.visit_node_id(ResolvingExpr(s.span), hir_util::stmt_id(s));
+        self.visit_node_id(ResolvingExpr(s.span), s.node.id());
         intravisit::walk_stmt(self, s);
     }
 
diff --git a/src/librustc_typeck/coherence/mod.rs b/src/librustc_typeck/coherence/mod.rs
index f9a4cfadc0b..9c8c9ba5056 100644
--- a/src/librustc_typeck/coherence/mod.rs
+++ b/src/librustc_typeck/coherence/mod.rs
@@ -15,7 +15,7 @@
 // done by the orphan and overlap modules. Then we build up various
 // mappings. That mapping code resides here.
 
-use middle::def_id::DefId;
+use hir::def_id::DefId;
 use middle::lang_items::UnsizeTraitLangItem;
 use rustc::ty::subst::{self, Subst};
 use rustc::ty::{self, TyCtxt, TypeFoldable};
@@ -39,10 +39,10 @@ use syntax::codemap::Span;
 use syntax::errors::DiagnosticBuilder;
 use util::nodemap::{DefIdMap, FnvHashMap};
 use rustc::dep_graph::DepNode;
-use rustc::front::map as hir_map;
-use rustc_front::intravisit;
-use rustc_front::hir::{Item, ItemImpl};
-use rustc_front::hir;
+use rustc::hir::map as hir_map;
+use rustc::hir::intravisit;
+use rustc::hir::{Item, ItemImpl};
+use rustc::hir;
 
 mod orphan;
 mod overlap;
diff --git a/src/librustc_typeck/coherence/orphan.rs b/src/librustc_typeck/coherence/orphan.rs
index eba3e56c722..f3d63957018 100644
--- a/src/librustc_typeck/coherence/orphan.rs
+++ b/src/librustc_typeck/coherence/orphan.rs
@@ -12,14 +12,14 @@
 //! crate or pertains to a type defined in this crate.
 
 use middle::cstore::LOCAL_CRATE;
-use middle::def_id::DefId;
+use hir::def_id::DefId;
 use rustc::traits;
 use rustc::ty::{self, TyCtxt};
 use syntax::ast;
 use syntax::codemap::Span;
 use rustc::dep_graph::DepNode;
-use rustc_front::intravisit;
-use rustc_front::hir;
+use rustc::hir::intravisit;
+use rustc::hir;
 
 pub fn check(tcx: &TyCtxt) {
     let mut orphan = OrphanChecker { tcx: tcx };
diff --git a/src/librustc_typeck/coherence/overlap.rs b/src/librustc_typeck/coherence/overlap.rs
index d7d4560a4ea..a05167dbe43 100644
--- a/src/librustc_typeck/coherence/overlap.rs
+++ b/src/librustc_typeck/coherence/overlap.rs
@@ -13,14 +13,14 @@
 //! constructor provide a method with the same name.
 
 use middle::cstore::CrateStore;
-use middle::def_id::DefId;
+use hir::def_id::DefId;
 use rustc::traits::{self, ProjectionMode};
 use rustc::infer;
 use rustc::ty::{self, TyCtxt};
 use syntax::ast;
 use rustc::dep_graph::DepNode;
-use rustc_front::hir;
-use rustc_front::intravisit;
+use rustc::hir;
+use rustc::hir::intravisit;
 use util::nodemap::DefIdMap;
 use lint;
 
diff --git a/src/librustc_typeck/coherence/unsafety.rs b/src/librustc_typeck/coherence/unsafety.rs
index 6d77200daa3..b042e23e0ac 100644
--- a/src/librustc_typeck/coherence/unsafety.rs
+++ b/src/librustc_typeck/coherence/unsafety.rs
@@ -12,8 +12,8 @@
 //! crate or pertains to a type defined in this crate.
 
 use rustc::ty::TyCtxt;
-use rustc_front::intravisit;
-use rustc_front::hir;
+use rustc::hir::intravisit;
+use rustc::hir;
 
 pub fn check(tcx: &TyCtxt) {
     let mut orphan = UnsafetyChecker { tcx: tcx };
diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs
index 59546f619c0..9d76b4c5284 100644
--- a/src/librustc_typeck/collect.rs
+++ b/src/librustc_typeck/collect.rs
@@ -60,8 +60,8 @@ There are some shortcomings in this design:
 
 use astconv::{self, AstConv, ty_of_arg, ast_ty_to_ty, ast_region_to_region};
 use lint;
-use middle::def::Def;
-use middle::def_id::DefId;
+use hir::def::Def;
+use hir::def_id::DefId;
 use constrained_type_params as ctp;
 use coherence;
 use middle::lang_items::SizedTraitLangItem;
@@ -77,7 +77,7 @@ use rustc::ty::fold::{TypeFolder};
 use rustc::ty::util::IntTypeExt;
 use rscope::*;
 use rustc::dep_graph::DepNode;
-use rustc::front::map as hir_map;
+use rustc::hir::map as hir_map;
 use util::common::{ErrorReported, MemoizationMap};
 use util::nodemap::{FnvHashMap, FnvHashSet};
 use write_ty_to_tcx;
@@ -94,9 +94,9 @@ use syntax::attr;
 use syntax::codemap::Span;
 use syntax::parse::token::special_idents;
 use syntax::ptr::P;
-use rustc_front::hir::{self, PatKind};
-use rustc_front::intravisit;
-use rustc_front::print::pprust;
+use rustc::hir::{self, PatKind};
+use rustc::hir::intravisit;
+use rustc::hir::print as pprust;
 
 ///////////////////////////////////////////////////////////////////////////
 // Main entry point
diff --git a/src/librustc_typeck/lib.rs b/src/librustc_typeck/lib.rs
index fa23445fe63..7f27d10ce1e 100644
--- a/src/librustc_typeck/lib.rs
+++ b/src/librustc_typeck/lib.rs
@@ -90,28 +90,26 @@ extern crate arena;
 extern crate fmt_macros;
 #[macro_use] extern crate rustc;
 extern crate rustc_platform_intrinsics as intrinsics;
-extern crate rustc_front;
 extern crate rustc_back;
 extern crate rustc_const_math;
 extern crate rustc_const_eval;
 
 pub use rustc::dep_graph;
-pub use rustc::front;
+pub use rustc::hir;
 pub use rustc::lint;
 pub use rustc::middle;
 pub use rustc::session;
 pub use rustc::util;
 
 use dep_graph::DepNode;
-use front::map as hir_map;
-use middle::def::Def;
+use hir::map as hir_map;
+use hir::def::Def;
 use rustc::infer::{self, TypeOrigin};
 use rustc::ty::subst::Substs;
 use rustc::ty::{self, Ty, TyCtxt, TypeFoldable};
 use rustc::traits::ProjectionMode;
 use session::{config, CompileResult};
 use util::common::time;
-use rustc_front::hir;
 
 use syntax::codemap::Span;
 use syntax::ast;
@@ -138,7 +136,7 @@ pub struct TypeAndSubsts<'tcx> {
 
 pub struct CrateCtxt<'a, 'tcx: 'a> {
     // A mapping from method call sites to traits that have that method.
-    pub trait_map: ty::TraitMap,
+    pub trait_map: hir::TraitMap,
     /// A vector of every trait accessible in the whole crate
     /// (i.e. including those from subcrates). This is used only for
     /// error reporting, and so is lazily initialised and generally
@@ -331,7 +329,7 @@ fn check_for_entry_fn(ccx: &CrateCtxt) {
     }
 }
 
-pub fn check_crate(tcx: &TyCtxt, trait_map: ty::TraitMap) -> CompileResult {
+pub fn check_crate(tcx: &TyCtxt, trait_map: hir::TraitMap) -> CompileResult {
     let time_passes = tcx.sess.time_passes();
     let ccx = CrateCtxt {
         trait_map: trait_map,
diff --git a/src/librustc_typeck/variance/constraints.rs b/src/librustc_typeck/variance/constraints.rs
index 50c99e33b44..3b03a713a5b 100644
--- a/src/librustc_typeck/variance/constraints.rs
+++ b/src/librustc_typeck/variance/constraints.rs
@@ -14,16 +14,16 @@
 //! We walk the set of items and, for each member, generate new constraints.
 
 use dep_graph::DepTrackingMapConfig;
-use middle::def_id::DefId;
+use hir::def_id::DefId;
 use middle::resolve_lifetime as rl;
 use rustc::ty::subst;
 use rustc::ty::subst::ParamSpace;
 use rustc::ty::{self, Ty, TyCtxt};
 use rustc::ty::maps::ItemVariances;
-use rustc::front::map as hir_map;
+use rustc::hir::map as hir_map;
 use syntax::ast;
-use rustc_front::hir;
-use rustc_front::intravisit::Visitor;
+use rustc::hir;
+use rustc::hir::intravisit::Visitor;
 
 use super::terms::*;
 use super::terms::VarianceTerm::*;
diff --git a/src/librustc_typeck/variance/terms.rs b/src/librustc_typeck/variance/terms.rs
index c6f82ba42e6..413dc83e638 100644
--- a/src/librustc_typeck/variance/terms.rs
+++ b/src/librustc_typeck/variance/terms.rs
@@ -27,8 +27,8 @@ use rustc::ty::maps::ItemVariances;
 use std::fmt;
 use std::rc::Rc;
 use syntax::ast;
-use rustc_front::hir;
-use rustc_front::intravisit::Visitor;
+use rustc::hir;
+use rustc::hir::intravisit::Visitor;
 use util::nodemap::NodeMap;
 
 use self::VarianceTerm::*;
diff --git a/src/librustdoc/Cargo.toml b/src/librustdoc/Cargo.toml
index 228eb099a04..9d76dd81e5f 100644
--- a/src/librustdoc/Cargo.toml
+++ b/src/librustdoc/Cargo.toml
@@ -15,7 +15,6 @@ rustc = { path = "../librustc" }
 rustc_back = { path = "../librustc_back" }
 rustc_const_eval = { path = "../librustc_const_eval" }
 rustc_driver = { path = "../librustc_driver" }
-rustc_front = { path = "../librustc_front" }
 rustc_lint = { path = "../librustc_lint" }
 rustc_metadata = { path = "../librustc_metadata" }
 rustc_resolve = { path = "../librustc_resolve" }
diff --git a/src/librustdoc/clean/inline.rs b/src/librustdoc/clean/inline.rs
index 3e4ba47ce4c..8c65eb8dbd3 100644
--- a/src/librustdoc/clean/inline.rs
+++ b/src/librustdoc/clean/inline.rs
@@ -11,14 +11,15 @@
 //! Support for inlining external documentation into the current AST.
 
 use std::collections::HashSet;
+use std::iter::once;
 
 use syntax::ast;
 use syntax::attr::AttrMetaMethods;
-use rustc_front::hir;
+use rustc::hir;
 
 use rustc::middle::cstore::{self, CrateStore};
-use rustc::middle::def::Def;
-use rustc::middle::def_id::DefId;
+use rustc::hir::def::Def;
+use rustc::hir::def_id::DefId;
 use rustc::ty::{self, TyCtxt};
 use rustc::ty::subst;
 use rustc::middle::stability;
@@ -140,8 +141,11 @@ pub fn load_attrs(cx: &DocContext, tcx: &TyCtxt,
 /// source links back to the original item.
 pub fn record_extern_fqn(cx: &DocContext, did: DefId, kind: clean::TypeKind) {
     if let Some(tcx) = cx.tcx_opt() {
-        let fqn = tcx.sess.cstore.extern_item_path(did);
-        let fqn = fqn.into_iter().map(|i| i.to_string()).collect();
+        let crate_name = tcx.sess.cstore.crate_name(did.krate).to_string();
+        let relative = tcx.def_path(did).data.into_iter().map(|elem| {
+            elem.data.to_string()
+        });
+        let fqn = once(crate_name).chain(relative).collect();
         cx.external_paths.borrow_mut().as_mut().unwrap().insert(did, (fqn, kind));
     }
 }
@@ -484,7 +488,7 @@ fn build_module(cx: &DocContext, tcx: &TyCtxt,
 
 fn build_const(cx: &DocContext, tcx: &TyCtxt,
                did: DefId) -> clean::Constant {
-    use rustc_front::print::pprust;
+    use rustc::hir::print as pprust;
 
     let (expr, ty) = lookup_const_by_id(tcx, did, None).unwrap_or_else(|| {
         panic!("expected lookup_const_by_id to succeed for {:?}", did);
diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs
index 7437d608771..4895022cfac 100644
--- a/src/librustdoc/clean/mod.rs
+++ b/src/librustdoc/clean/mod.rs
@@ -35,13 +35,13 @@ use syntax::ptr::P;
 
 use rustc_trans::back::link;
 use rustc::middle::cstore::{self, CrateStore};
-use rustc::middle::def::Def;
-use rustc::middle::def_id::{DefId, DefIndex};
+use rustc::hir::def::Def;
+use rustc::hir::def_id::{DefId, DefIndex};
 use rustc::ty::subst::{self, ParamSpace, VecPerParamSpace};
 use rustc::ty;
 use rustc::middle::stability;
 
-use rustc_front::hir;
+use rustc::hir;
 
 use std::collections::{HashMap, HashSet};
 use std::path::PathBuf;
@@ -563,7 +563,7 @@ pub enum TyParamBound {
 
 impl TyParamBound {
     fn maybe_sized(cx: &DocContext) -> TyParamBound {
-        use rustc_front::hir::TraitBoundModifier as TBM;
+        use rustc::hir::TraitBoundModifier as TBM;
         let mut sized_bound = ty::BoundSized.clean(cx);
         if let TyParamBound::TraitBound(_, ref mut tbm) = sized_bound {
             *tbm = TBM::Maybe
@@ -572,7 +572,7 @@ impl TyParamBound {
     }
 
     fn is_sized_bound(&self, cx: &DocContext) -> bool {
-        use rustc_front::hir::TraitBoundModifier as TBM;
+        use rustc::hir::TraitBoundModifier as TBM;
         if let Some(tcx) = cx.tcx_opt() {
             if let TyParamBound::TraitBound(PolyTrait { ref trait_, .. }, TBM::None) = *self {
                 if trait_.def_id() == tcx.lang_items.sized_trait() {
@@ -1609,7 +1609,7 @@ impl PrimitiveType {
 
 impl Clean<Type> for hir::Ty {
     fn clean(&self, cx: &DocContext) -> Type {
-        use rustc_front::hir::*;
+        use rustc::hir::*;
         match self.node {
             TyPtr(ref m) => RawPointer(m.mutbl.clean(cx), box m.ty.clean(cx)),
             TyRptr(ref l, ref m) =>
@@ -1826,7 +1826,7 @@ pub struct VariantStruct {
     pub fields_stripped: bool,
 }
 
-impl Clean<VariantStruct> for ::rustc_front::hir::VariantData {
+impl Clean<VariantStruct> for ::rustc::hir::VariantData {
     fn clean(&self, cx: &DocContext) -> VariantStruct {
         VariantStruct {
             struct_type: doctree::struct_type_from_def(self),
@@ -2554,7 +2554,7 @@ fn lit_to_string(lit: &ast::Lit) -> String {
 }
 
 fn name_from_pat(p: &hir::Pat) -> String {
-    use rustc_front::hir::*;
+    use rustc::hir::*;
     debug!("Trying to get a name from pattern: {:?}", p);
 
     match p.node {
diff --git a/src/librustdoc/clean/simplify.rs b/src/librustdoc/clean/simplify.rs
index e6a4d882c04..4ba412cdc85 100644
--- a/src/librustdoc/clean/simplify.rs
+++ b/src/librustdoc/clean/simplify.rs
@@ -29,7 +29,7 @@
 use std::mem;
 use std::collections::HashMap;
 
-use rustc::middle::def_id::DefId;
+use rustc::hir::def_id::DefId;
 use rustc::ty::subst;
 
 use clean::PathParameters as PP;
diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs
index 15a10a84e43..6b7aa103e1d 100644
--- a/src/librustdoc/core.rs
+++ b/src/librustdoc/core.rs
@@ -13,14 +13,14 @@ use rustc_lint;
 use rustc_driver::{driver, target_features, abort_on_err};
 use rustc::dep_graph::DepGraph;
 use rustc::session::{self, config};
-use rustc::middle::def_id::DefId;
+use rustc::hir::def_id::DefId;
 use rustc::middle::privacy::AccessLevels;
 use rustc::ty::{self, TyCtxt};
-use rustc::front::map as hir_map;
+use rustc::hir::map as hir_map;
 use rustc::lint;
 use rustc_trans::back::link;
 use rustc_resolve as resolve;
-use rustc_front::lowering::{lower_crate, LoweringContext};
+use rustc::hir::lowering::{lower_crate, LoweringContext};
 use rustc_metadata::cstore::CStore;
 
 use syntax::{ast, codemap, errors};
diff --git a/src/librustdoc/doctree.rs b/src/librustdoc/doctree.rs
index fc0422b3a3f..2db4b779eed 100644
--- a/src/librustdoc/doctree.rs
+++ b/src/librustdoc/doctree.rs
@@ -20,7 +20,7 @@ use syntax::ast;
 use syntax::ast::{Name, NodeId};
 use syntax::attr;
 use syntax::ptr::P;
-use rustc_front::hir;
+use rustc::hir;
 
 pub struct Module {
     pub name: Option<Name>,
diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs
index e9a883d6d7a..a43711a3273 100644
--- a/src/librustdoc/html/format.rs
+++ b/src/librustdoc/html/format.rs
@@ -19,9 +19,9 @@ use std::fmt;
 use std::iter::repeat;
 
 use rustc::middle::cstore::LOCAL_CRATE;
-use rustc::middle::def_id::{CRATE_DEF_INDEX, DefId};
+use rustc::hir::def_id::{CRATE_DEF_INDEX, DefId};
 use syntax::abi::Abi;
-use rustc_front::hir;
+use rustc::hir;
 
 use clean;
 use html::item_type::ItemType;
diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs
index 1427dfcbaf1..d63e704e06b 100644
--- a/src/librustdoc/html/render.rs
+++ b/src/librustdoc/html/render.rs
@@ -56,11 +56,11 @@ use serialize::json::{ToJson, Json, as_json};
 use syntax::{abi, ast};
 use syntax::feature_gate::UnstableFeatures;
 use rustc::middle::cstore::LOCAL_CRATE;
-use rustc::middle::def_id::{CRATE_DEF_INDEX, DefId};
+use rustc::hir::def_id::{CRATE_DEF_INDEX, DefId};
 use rustc::middle::privacy::AccessLevels;
 use rustc::middle::stability;
 use rustc::session::config::get_unstable_features_setting;
-use rustc_front::hir;
+use rustc::hir;
 
 use clean::{self, SelfTy, Attributes, GetDefId};
 use doctree;
diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs
index a35fe20b6b6..9439c258318 100644
--- a/src/librustdoc/lib.rs
+++ b/src/librustdoc/lib.rs
@@ -41,7 +41,6 @@ extern crate rustc_driver;
 extern crate rustc_resolve;
 extern crate rustc_lint;
 extern crate rustc_back;
-extern crate rustc_front;
 extern crate rustc_metadata;
 extern crate serialize;
 #[macro_use] extern crate syntax;
diff --git a/src/librustdoc/passes.rs b/src/librustdoc/passes.rs
index f93ecb46228..ff2a9f13e8a 100644
--- a/src/librustdoc/passes.rs
+++ b/src/librustdoc/passes.rs
@@ -8,13 +8,13 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use rustc::middle::def_id::DefId;
+use rustc::hir::def_id::DefId;
 use rustc::middle::privacy::AccessLevels;
 use rustc::util::nodemap::DefIdSet;
 use std::cmp;
 use std::string::String;
 use std::usize;
-use rustc_front::hir;
+use rustc::hir;
 
 use clean::{self, Attributes, GetDefId};
 use clean::Item;
diff --git a/src/librustdoc/test.rs b/src/librustdoc/test.rs
index 5bd3b9c4f59..3810fb87acf 100644
--- a/src/librustdoc/test.rs
+++ b/src/librustdoc/test.rs
@@ -24,11 +24,11 @@ use std::sync::{Arc, Mutex};
 use testing;
 use rustc_lint;
 use rustc::dep_graph::DepGraph;
-use rustc::front::map as hir_map;
+use rustc::hir::map as hir_map;
 use rustc::session::{self, config};
 use rustc::session::config::{get_unstable_features_setting, OutputType};
 use rustc::session::search_paths::{SearchPaths, PathKind};
-use rustc_front::lowering::{lower_crate, LoweringContext};
+use rustc::hir::lowering::{lower_crate, LoweringContext};
 use rustc_back::dynamic_lib::DynamicLibrary;
 use rustc_back::tempdir::TempDir;
 use rustc_driver::{driver, Compilation};
@@ -141,7 +141,7 @@ pub fn run(input: &str,
 }
 
 // Look for #![doc(test(no_crate_inject))], used by crates in the std facade
-fn scrape_test_config(krate: &::rustc_front::hir::Crate) -> TestOptions {
+fn scrape_test_config(krate: &::rustc::hir::Crate) -> TestOptions {
     use syntax::attr::AttrMetaMethods;
     use syntax::print::pprust;
 
diff --git a/src/librustdoc/visit_ast.rs b/src/librustdoc/visit_ast.rs
index e4ef0c1a4d6..45c7969ef7c 100644
--- a/src/librustdoc/visit_ast.rs
+++ b/src/librustdoc/visit_ast.rs
@@ -20,10 +20,10 @@ use syntax::attr;
 use syntax::attr::AttrMetaMethods;
 use syntax::codemap::Span;
 
-use rustc::front::map as hir_map;
+use rustc::hir::map as hir_map;
 use rustc::middle::stability;
 
-use rustc_front::hir;
+use rustc::hir;
 
 use core;
 use clean::{Clean, Attributes};
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs
index a441f2990cd..16d4ed53b5b 100644
--- a/src/libsyntax/ast.rs
+++ b/src/libsyntax/ast.rs
@@ -10,7 +10,6 @@
 
 // The Rust abstract syntax tree.
 
-pub use self::StructFieldKind::*;
 pub use self::TyParamBound::*;
 pub use self::UnsafeSource::*;
 pub use self::ViewPath_::*;
@@ -205,6 +204,23 @@ impl fmt::Display for Path {
     }
 }
 
+impl Path {
+    // convert a span and an identifier to the corresponding
+    // 1-segment path
+    pub fn from_ident(s: Span, identifier: Ident) -> Path {
+        Path {
+            span: s,
+            global: false,
+            segments: vec!(
+                PathSegment {
+                    identifier: identifier,
+                    parameters: PathParameters::none()
+                }
+            ),
+        }
+    }
+}
+
 /// A segment of a path: an identifier, an optional lifetime, and a set of
 /// types.
 #[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
@@ -1877,46 +1893,15 @@ pub enum Visibility {
 }
 
 #[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
-pub struct StructField_ {
-    pub kind: StructFieldKind,
+pub struct StructField {
+    pub span: Span,
+    pub ident: Option<Ident>,
+    pub vis: Visibility,
     pub id: NodeId,
     pub ty: P<Ty>,
     pub attrs: Vec<Attribute>,
 }
 
-impl StructField_ {
-    pub fn ident(&self) -> Option<Ident> {
-        match self.kind {
-            NamedField(ref ident, _) => Some(ident.clone()),
-            UnnamedField(_) => None
-        }
-    }
-}
-
-pub type StructField = Spanned<StructField_>;
-
-#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
-pub enum StructFieldKind {
-    NamedField(Ident, Visibility),
-    /// Element of a tuple-like struct
-    UnnamedField(Visibility),
-}
-
-impl StructFieldKind {
-    pub fn is_unnamed(&self) -> bool {
-        match *self {
-            UnnamedField(..) => true,
-            NamedField(..) => false,
-        }
-    }
-
-    pub fn visibility(&self) -> &Visibility {
-        match *self {
-            NamedField(_, ref vis) | UnnamedField(ref vis) => vis
-        }
-    }
-}
-
 /// Fields and Ids of enum variants and structs
 ///
 /// For enum variants: `NodeId` represents both an Id of the variant itself (relevant for all
diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs
deleted file mode 100644
index 852b153044f..00000000000
--- a/src/libsyntax/ast_util.rs
+++ /dev/null
@@ -1,398 +0,0 @@
-// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-use ast::*;
-use ast;
-use codemap;
-use codemap::Span;
-use parse::token;
-use print::pprust;
-use ptr::P;
-use visit::{FnKind, Visitor};
-use visit;
-
-use std::cmp;
-use std::u32;
-
-pub fn path_name_i(idents: &[Ident]) -> String {
-    // FIXME: Bad copies (#2543 -- same for everything else that says "bad")
-    idents.iter().map(|i| i.to_string()).collect::<Vec<String>>().join("::")
-}
-
-pub fn is_path(e: P<Expr>) -> bool {
-    match e.node { ExprKind::Path(..) => true, _ => false }
-}
-
-
-// convert a span and an identifier to the corresponding
-// 1-segment path
-pub fn ident_to_path(s: Span, identifier: Ident) -> Path {
-    ast::Path {
-        span: s,
-        global: false,
-        segments: vec!(
-            ast::PathSegment {
-                identifier: identifier,
-                parameters: ast::PathParameters::AngleBracketed(ast::AngleBracketedParameterData {
-                    lifetimes: Vec::new(),
-                    types: P::empty(),
-                    bindings: P::empty(),
-                })
-            }
-        ),
-    }
-}
-
-// If path is a single segment ident path, return that ident. Otherwise, return
-// None.
-pub fn path_to_ident(path: &Path) -> Option<Ident> {
-    if path.segments.len() != 1 {
-        return None;
-    }
-
-    let segment = &path.segments[0];
-    if !segment.parameters.is_empty() {
-        return None;
-    }
-
-    Some(segment.identifier)
-}
-
-pub fn ident_to_pat(id: NodeId, s: Span, i: Ident) -> P<Pat> {
-    let spanned = codemap::Spanned{ span: s, node: i };
-    P(Pat {
-        id: id,
-        node: PatKind::Ident(BindingMode::ByValue(Mutability::Immutable), spanned, None),
-        span: s
-    })
-}
-
-/// Generate a "pretty" name for an `impl` from its type and trait.
-/// This is designed so that symbols of `impl`'d methods give some
-/// hint of where they came from, (previously they would all just be
-/// listed as `__extensions__::method_name::hash`, with no indication
-/// of the type).
-pub fn impl_pretty_name(trait_ref: &Option<TraitRef>, ty: Option<&Ty>) -> Ident {
-    let mut pretty = match ty {
-        Some(t) => pprust::ty_to_string(t),
-        None => String::from("..")
-    };
-
-    match *trait_ref {
-        Some(ref trait_ref) => {
-            pretty.push('.');
-            pretty.push_str(&pprust::path_to_string(&trait_ref.path));
-        }
-        None => {}
-    }
-    token::gensym_ident(&pretty[..])
-}
-
-pub fn struct_field_visibility(field: ast::StructField) -> Visibility {
-    match field.node.kind {
-        ast::NamedField(_, v) | ast::UnnamedField(v) => v
-    }
-}
-
-// ______________________________________________________________________
-// Enumerating the IDs which appear in an AST
-
-#[derive(Copy, Clone, RustcEncodable, RustcDecodable, Debug)]
-pub struct IdRange {
-    pub min: NodeId,
-    pub max: NodeId,
-}
-
-impl IdRange {
-    pub fn max() -> IdRange {
-        IdRange {
-            min: u32::MAX,
-            max: u32::MIN,
-        }
-    }
-
-    pub fn empty(&self) -> bool {
-        self.min >= self.max
-    }
-
-    pub fn add(&mut self, id: NodeId) {
-        self.min = cmp::min(self.min, id);
-        self.max = cmp::max(self.max, id + 1);
-    }
-}
-
-pub trait IdVisitingOperation {
-    fn visit_id(&mut self, node_id: NodeId);
-}
-
-/// A visitor that applies its operation to all of the node IDs
-/// in a visitable thing.
-
-pub struct IdVisitor<'a, O:'a> {
-    pub operation: &'a mut O,
-    pub visited_outermost: bool,
-}
-
-impl<'a, O: IdVisitingOperation> IdVisitor<'a, O> {
-    fn visit_generics_helper(&mut self, generics: &Generics) {
-        for type_parameter in generics.ty_params.iter() {
-            self.operation.visit_id(type_parameter.id)
-        }
-        for lifetime in &generics.lifetimes {
-            self.operation.visit_id(lifetime.lifetime.id)
-        }
-    }
-}
-
-impl<'a, 'v, O: IdVisitingOperation> Visitor<'v> for IdVisitor<'a, O> {
-    fn visit_mod(&mut self,
-                 module: &Mod,
-                 _: Span,
-                 node_id: NodeId) {
-        self.operation.visit_id(node_id);
-        visit::walk_mod(self, module)
-    }
-
-    fn visit_foreign_item(&mut self, foreign_item: &ForeignItem) {
-        self.operation.visit_id(foreign_item.id);
-        visit::walk_foreign_item(self, foreign_item)
-    }
-
-    fn visit_item(&mut self, item: &Item) {
-        if self.visited_outermost {
-            return
-        } else {
-            self.visited_outermost = true
-        }
-
-        self.operation.visit_id(item.id);
-        match item.node {
-            ItemKind::Use(ref view_path) => {
-                match view_path.node {
-                    ViewPathSimple(_, _) |
-                    ViewPathGlob(_) => {}
-                    ViewPathList(_, ref paths) => {
-                        for path in paths {
-                            self.operation.visit_id(path.node.id())
-                        }
-                    }
-                }
-            }
-            _ => {}
-        }
-
-        visit::walk_item(self, item);
-
-        self.visited_outermost = false
-    }
-
-    fn visit_local(&mut self, local: &Local) {
-        self.operation.visit_id(local.id);
-        visit::walk_local(self, local)
-    }
-
-    fn visit_block(&mut self, block: &Block) {
-        self.operation.visit_id(block.id);
-        visit::walk_block(self, block)
-    }
-
-    fn visit_stmt(&mut self, statement: &Stmt) {
-        self.operation
-            .visit_id(statement.node.id().expect("attempted to visit unexpanded stmt"));
-        visit::walk_stmt(self, statement)
-    }
-
-    fn visit_pat(&mut self, pattern: &Pat) {
-        self.operation.visit_id(pattern.id);
-        visit::walk_pat(self, pattern)
-    }
-
-    fn visit_expr(&mut self, expression: &Expr) {
-        self.operation.visit_id(expression.id);
-        visit::walk_expr(self, expression)
-    }
-
-    fn visit_ty(&mut self, typ: &Ty) {
-        self.operation.visit_id(typ.id);
-        visit::walk_ty(self, typ)
-    }
-
-    fn visit_generics(&mut self, generics: &Generics) {
-        self.visit_generics_helper(generics);
-        visit::walk_generics(self, generics)
-    }
-
-    fn visit_fn(&mut self,
-                function_kind: visit::FnKind<'v>,
-                function_declaration: &'v FnDecl,
-                block: &'v Block,
-                span: Span,
-                node_id: NodeId) {
-        match function_kind {
-            FnKind::Method(..) if self.visited_outermost => return,
-            FnKind::Method(..) => self.visited_outermost = true,
-            _ => {}
-        }
-
-        self.operation.visit_id(node_id);
-
-        match function_kind {
-            FnKind::ItemFn(_, generics, _, _, _, _) => {
-                self.visit_generics_helper(generics)
-            }
-            FnKind::Method(_, ref sig, _) => {
-                self.visit_generics_helper(&sig.generics)
-            }
-            FnKind::Closure => {}
-        }
-
-        for argument in &function_declaration.inputs {
-            self.operation.visit_id(argument.id)
-        }
-
-        visit::walk_fn(self,
-                       function_kind,
-                       function_declaration,
-                       block,
-                       span);
-
-        if let FnKind::Method(..) = function_kind {
-            self.visited_outermost = false;
-        }
-    }
-
-    fn visit_struct_field(&mut self, struct_field: &StructField) {
-        self.operation.visit_id(struct_field.node.id);
-        visit::walk_struct_field(self, struct_field)
-    }
-
-    fn visit_variant_data(&mut self,
-                        struct_def: &VariantData,
-                        _: ast::Ident,
-                        _: &ast::Generics,
-                        _: NodeId,
-                        _: Span) {
-        self.operation.visit_id(struct_def.id());
-        visit::walk_struct_def(self, struct_def);
-    }
-
-    fn visit_trait_item(&mut self, ti: &ast::TraitItem) {
-        self.operation.visit_id(ti.id);
-        visit::walk_trait_item(self, ti);
-    }
-
-    fn visit_impl_item(&mut self, ii: &ast::ImplItem) {
-        self.operation.visit_id(ii.id);
-        visit::walk_impl_item(self, ii);
-    }
-
-    fn visit_lifetime(&mut self, lifetime: &Lifetime) {
-        self.operation.visit_id(lifetime.id);
-    }
-
-    fn visit_lifetime_def(&mut self, def: &LifetimeDef) {
-        self.visit_lifetime(&def.lifetime);
-    }
-
-    fn visit_trait_ref(&mut self, trait_ref: &TraitRef) {
-        self.operation.visit_id(trait_ref.ref_id);
-        visit::walk_trait_ref(self, trait_ref);
-    }
-}
-
-pub struct IdRangeComputingVisitor {
-    pub result: IdRange,
-}
-
-impl IdRangeComputingVisitor {
-    pub fn new() -> IdRangeComputingVisitor {
-        IdRangeComputingVisitor { result: IdRange::max() }
-    }
-
-    pub fn result(&self) -> IdRange {
-        self.result
-    }
-}
-
-impl IdVisitingOperation for IdRangeComputingVisitor {
-    fn visit_id(&mut self, id: NodeId) {
-        self.result.add(id);
-    }
-}
-
-/// Computes the id range for a single fn body, ignoring nested items.
-pub fn compute_id_range_for_fn_body(fk: FnKind,
-                                    decl: &FnDecl,
-                                    body: &Block,
-                                    sp: Span,
-                                    id: NodeId)
-                                    -> IdRange
-{
-    let mut visitor = IdRangeComputingVisitor::new();
-    let mut id_visitor = IdVisitor {
-        operation: &mut visitor,
-        visited_outermost: false,
-    };
-    id_visitor.visit_fn(fk, decl, body, sp, id);
-    id_visitor.operation.result
-}
-
-/// Returns true if the given pattern consists solely of an identifier
-/// and false otherwise.
-pub fn pat_is_ident(pat: P<ast::Pat>) -> bool {
-    match pat.node {
-        PatKind::Ident(..) => true,
-        _ => false,
-    }
-}
-
-// are two paths equal when compared unhygienically?
-// since I'm using this to replace ==, it seems appropriate
-// to compare the span, global, etc. fields as well.
-pub fn path_name_eq(a : &ast::Path, b : &ast::Path) -> bool {
-    (a.span.source_equal(&b.span))
-    && (a.global == b.global)
-    && (segments_name_eq(&a.segments[..], &b.segments[..]))
-}
-
-// are two arrays of segments equal when compared unhygienically?
-pub fn segments_name_eq(a : &[ast::PathSegment], b : &[ast::PathSegment]) -> bool {
-    a.len() == b.len() &&
-    a.iter().zip(b).all(|(s, t)| {
-        s.identifier.name == t.identifier.name &&
-        // FIXME #7743: ident -> name problems in lifetime comparison?
-        // can types contain idents?
-        s.parameters == t.parameters
-    })
-}
-
-#[cfg(test)]
-mod tests {
-    use ast::*;
-    use super::*;
-
-    fn ident_to_segment(id: Ident) -> PathSegment {
-        PathSegment {identifier: id,
-                     parameters: PathParameters::none()}
-    }
-
-    #[test] fn idents_name_eq_test() {
-        assert!(segments_name_eq(
-            &[Ident::new(Name(3),SyntaxContext(4)), Ident::new(Name(78),SyntaxContext(82))]
-                .iter().cloned().map(ident_to_segment).collect::<Vec<PathSegment>>(),
-            &[Ident::new(Name(3),SyntaxContext(104)), Ident::new(Name(78),SyntaxContext(182))]
-                .iter().cloned().map(ident_to_segment).collect::<Vec<PathSegment>>()));
-        assert!(!segments_name_eq(
-            &[Ident::new(Name(3),SyntaxContext(4)), Ident::new(Name(78),SyntaxContext(82))]
-                .iter().cloned().map(ident_to_segment).collect::<Vec<PathSegment>>(),
-            &[Ident::new(Name(3),SyntaxContext(104)), Ident::new(Name(77),SyntaxContext(182))]
-                .iter().cloned().map(ident_to_segment).collect::<Vec<PathSegment>>()));
-    }
-}
diff --git a/src/libsyntax/config.rs b/src/libsyntax/config.rs
index 9acb1805cdd..4554a280e5f 100644
--- a/src/libsyntax/config.rs
+++ b/src/libsyntax/config.rs
@@ -180,12 +180,12 @@ fn fold_struct<F>(cx: &mut Context<F>, vdata: ast::VariantData) -> ast::VariantD
     match vdata {
         ast::VariantData::Struct(fields, id) => {
             ast::VariantData::Struct(fields.into_iter().filter(|m| {
-                (cx.in_cfg)(&m.node.attrs)
+                (cx.in_cfg)(&m.attrs)
             }).collect(), id)
         }
         ast::VariantData::Tuple(fields, id) => {
             ast::VariantData::Tuple(fields.into_iter().filter(|m| {
-                (cx.in_cfg)(&m.node.attrs)
+                (cx.in_cfg)(&m.attrs)
             }).collect(), id)
         }
         ast::VariantData::Unit(id) => ast::VariantData::Unit(id)
@@ -434,7 +434,7 @@ impl<'v, 'a, 'b> visit::Visitor<'v> for StmtExprAttrFeatureVisitor<'a, 'b> {
     }
 
     fn visit_struct_field(&mut self, s: &'v ast::StructField) {
-        if node_survives_cfg(&s.node.attrs, self.config) {
+        if node_survives_cfg(&s.attrs, self.config) {
             visit::walk_struct_field(self, s);
         }
     }
diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs
index 0eb42f17f68..a4e5b68277d 100644
--- a/src/libsyntax/ext/build.rs
+++ b/src/libsyntax/ext/build.rs
@@ -1007,12 +1007,14 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
 
     fn variant(&self, span: Span, name: Ident, tys: Vec<P<ast::Ty>> ) -> ast::Variant {
         let fields: Vec<_> = tys.into_iter().map(|ty| {
-            Spanned { span: ty.span, node: ast::StructField_ {
+            ast::StructField {
+                span: ty.span,
                 ty: ty,
-                kind: ast::UnnamedField(ast::Visibility::Inherited),
+                ident: None,
+                vis: ast::Visibility::Inherited,
                 attrs: Vec::new(),
                 id: ast::DUMMY_NODE_ID,
-            }}
+            }
         }).collect();
 
         let vdata = if fields.is_empty() {
diff --git a/src/libsyntax/fold.rs b/src/libsyntax/fold.rs
index 46bcb8067a3..5d378763bef 100644
--- a/src/libsyntax/fold.rs
+++ b/src/libsyntax/fold.rs
@@ -21,7 +21,6 @@
 use ast::*;
 use ast;
 use attr::{ThinAttributes, ThinAttributesExt};
-use ast_util;
 use codemap::{respan, Span, Spanned};
 use parse::token;
 use ptr::P;
@@ -847,15 +846,13 @@ pub fn noop_fold_poly_trait_ref<T: Folder>(p: PolyTraitRef, fld: &mut T) -> Poly
 }
 
 pub fn noop_fold_struct_field<T: Folder>(f: StructField, fld: &mut T) -> StructField {
-    let StructField {node: StructField_ {id, kind, ty, attrs}, span} = f;
-    Spanned {
-        node: StructField_ {
-            id: fld.new_id(id),
-            kind: kind,
-            ty: fld.fold_ty(ty),
-            attrs: fold_attrs(attrs, fld),
-        },
-        span: fld.new_span(span)
+    StructField {
+        span: fld.new_span(f.span),
+        id: fld.new_id(f.id),
+        ident: f.ident.map(|ident| fld.fold_ident(ident)),
+        vis: f.vis,
+        ty: fld.fold_ty(f.ty),
+        attrs: fold_attrs(f.attrs, fld),
     }
 }
 
@@ -1073,13 +1070,6 @@ pub fn noop_fold_item_simple<T: Folder>(Item {id, ident, attrs, node, vis, span}
                                         folder: &mut T) -> Item {
     let id = folder.new_id(id);
     let node = folder.fold_item_kind(node);
-    let ident = match node {
-        // The node may have changed, recompute the "pretty" impl name.
-        ItemKind::Impl(_, _, _, ref maybe_trait, ref ty, _) => {
-            ast_util::impl_pretty_name(maybe_trait, Some(&ty))
-        }
-        _ => ident
-    };
 
     Item {
         id: id,
diff --git a/src/libsyntax/lib.rs b/src/libsyntax/lib.rs
index 7f8472f8b28..ab14e21e251 100644
--- a/src/libsyntax/lib.rs
+++ b/src/libsyntax/lib.rs
@@ -91,7 +91,6 @@ pub mod syntax {
 
 pub mod abi;
 pub mod ast;
-pub mod ast_util;
 pub mod attr;
 pub mod codemap;
 pub mod config;
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 89a504e1ebd..9dc661ed2ea 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -29,7 +29,6 @@ use ast::Local;
 use ast::MacStmtStyle;
 use ast::Mac_;
 use ast::{MutTy, Mutability};
-use ast::NamedField;
 use ast::{Pat, PatKind};
 use ast::{PolyTraitRef, QSelf};
 use ast::{Stmt, StmtKind};
@@ -38,13 +37,11 @@ use ast::StrStyle;
 use ast::SelfKind;
 use ast::{Delimited, SequenceRepetition, TokenTree, TraitItem, TraitRef};
 use ast::{Ty, TyKind, TypeBinding, TyParam, TyParamBounds};
-use ast::UnnamedField;
 use ast::{ViewPath, ViewPathGlob, ViewPathList, ViewPathSimple};
 use ast::{Visibility, WhereClause};
 use attr::{ThinAttributes, ThinAttributesExt, AttributesExt};
 use ast::{BinOpKind, UnOp};
 use ast;
-use ast_util::{self, ident_to_path};
 use codemap::{self, Span, BytePos, Spanned, spanned, mk_sp, CodeMap};
 use errors::{self, DiagnosticBuilder};
 use ext::tt::macro_parser;
@@ -1577,9 +1574,14 @@ impl<'a> Parser<'a> {
             pat
         } else {
             debug!("parse_arg_general ident_to_pat");
-            ast_util::ident_to_pat(ast::DUMMY_NODE_ID,
-                                   self.last_span,
-                                   special_idents::invalid)
+            let sp = self.last_span;
+            let spanned = Spanned { span: sp, node: special_idents::invalid };
+            P(Pat {
+                id: ast::DUMMY_NODE_ID,
+                node: PatKind::Ident(BindingMode::ByValue(Mutability::Immutable),
+                                     spanned, None),
+                span: sp
+            })
         };
 
         let t = self.parse_ty_sum()?;
@@ -2223,7 +2225,7 @@ impl<'a> Parser<'a> {
                             ctxt: _
                          }, token::Plain) => {
                 self.bump();
-                let path = ast_util::ident_to_path(mk_sp(lo, hi), id);
+                let path = ast::Path::from_ident(mk_sp(lo, hi), id);
                 ex = ExprKind::Path(None, path);
                 hi = self.last_span.hi;
             }
@@ -3679,7 +3681,7 @@ impl<'a> Parser<'a> {
                         // Parse macro invocation
                         let ident = self.parse_ident()?;
                         let ident_span = self.last_span;
-                        let path = ident_to_path(ident_span, ident);
+                        let path = ast::Path::from_ident(ident_span, ident);
                         self.bump();
                         let delim = self.expect_open_delim()?;
                         let tts = self.parse_seq_to_end(
@@ -3847,12 +3849,14 @@ impl<'a> Parser<'a> {
         let name = self.parse_ident()?;
         self.expect(&token::Colon)?;
         let ty = self.parse_ty_sum()?;
-        Ok(spanned(lo, self.last_span.hi, ast::StructField_ {
-            kind: NamedField(name, pr),
+        Ok(StructField {
+            span: mk_sp(lo, self.last_span.hi),
+            ident: Some(name),
+            vis: pr,
             id: ast::DUMMY_NODE_ID,
             ty: ty,
             attrs: attrs,
-        }))
+        })
     }
 
     /// Emit an expected item after attributes error.
@@ -5116,7 +5120,7 @@ impl<'a> Parser<'a> {
 
             self.expect(&token::OpenDelim(token::Brace))?;
             self.expect(&token::CloseDelim(token::Brace))?;
-            Ok((ast_util::impl_pretty_name(&opt_trait, None),
+            Ok((special_idents::invalid,
              ItemKind::DefaultImpl(unsafety, opt_trait.unwrap()), None))
         } else {
             if opt_trait.is_some() {
@@ -5132,7 +5136,7 @@ impl<'a> Parser<'a> {
                 impl_items.push(self.parse_impl_item()?);
             }
 
-            Ok((ast_util::impl_pretty_name(&opt_trait, Some(&ty)),
+            Ok((special_idents::invalid,
              ItemKind::Impl(unsafety, polarity, generics, opt_trait, ty, impl_items),
              Some(attrs)))
         }
@@ -5246,13 +5250,16 @@ impl<'a> Parser<'a> {
             |p| {
                 let attrs = p.parse_outer_attributes()?;
                 let lo = p.span.lo;
-                let struct_field_ = ast::StructField_ {
-                    kind: UnnamedField(p.parse_visibility()?),
+                let vis = p.parse_visibility()?;
+                let ty = p.parse_ty_sum()?;
+                Ok(StructField {
+                    span: mk_sp(lo, p.span.hi),
+                    vis: vis,
+                    ident: None,
                     id: ast::DUMMY_NODE_ID,
-                    ty: p.parse_ty_sum()?,
+                    ty: ty,
                     attrs: attrs,
-                };
-                Ok(spanned(lo, p.span.hi, struct_field_))
+                })
             })?;
 
         Ok(fields)
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs
index a8f28ed3d9e..e2b1d2f5e7a 100644
--- a/src/libsyntax/print/pprust.rs
+++ b/src/libsyntax/print/pprust.rs
@@ -1407,14 +1407,9 @@ impl<'a> State<'a> {
                 self.commasep(
                     Inconsistent, struct_def.fields(),
                     |s, field| {
-                        match field.node.kind {
-                            ast::NamedField(..) => panic!("unexpected named field"),
-                            ast::UnnamedField(ref vis) => {
-                                s.print_visibility(vis)?;
-                                s.maybe_print_comment(field.span.lo)?;
-                                s.print_type(&field.node.ty)
-                            }
-                        }
+                        s.print_visibility(&field.vis)?;
+                        s.maybe_print_comment(field.span.lo)?;
+                        s.print_type(&field.ty)
                     }
                 )?;
                 self.pclose()?;
@@ -1432,19 +1427,14 @@ impl<'a> State<'a> {
             self.hardbreak_if_not_bol()?;
 
             for field in struct_def.fields() {
-                match field.node.kind {
-                    ast::UnnamedField(..) => panic!("unexpected unnamed field"),
-                    ast::NamedField(ident, ref visibility) => {
-                        self.hardbreak_if_not_bol()?;
-                        self.maybe_print_comment(field.span.lo)?;
-                        self.print_outer_attributes(&field.node.attrs)?;
-                        self.print_visibility(visibility)?;
-                        self.print_ident(ident)?;
-                        self.word_nbsp(":")?;
-                        self.print_type(&field.node.ty)?;
-                        word(&mut self.s, ",")?;
-                    }
-                }
+                self.hardbreak_if_not_bol()?;
+                self.maybe_print_comment(field.span.lo)?;
+                self.print_outer_attributes(&field.attrs)?;
+                self.print_visibility(&field.vis)?;
+                self.print_ident(field.ident.unwrap())?;
+                self.word_nbsp(":")?;
+                self.print_type(&field.ty)?;
+                word(&mut self.s, ",")?;
             }
 
             self.bclose(span)
diff --git a/src/libsyntax/test.rs b/src/libsyntax/test.rs
index 81b702e794d..703b1611540 100644
--- a/src/libsyntax/test.rs
+++ b/src/libsyntax/test.rs
@@ -18,7 +18,6 @@ use std::iter;
 use std::slice;
 use std::mem;
 use std::vec;
-use ast_util::*;
 use attr::AttrMetaMethods;
 use attr;
 use codemap::{DUMMY_SP, Span, ExpnInfo, NameAndSpan, MacroAttribute};
@@ -35,7 +34,7 @@ use fold;
 use parse::token::{intern, InternedString};
 use parse::{token, ParseSess};
 use print::pprust;
-use {ast, ast_util};
+use ast;
 use ptr::P;
 use util::small_vector::SmallVector;
 
@@ -120,8 +119,7 @@ impl<'a> fold::Folder for TestHarnessGenerator<'a> {
         if ident.name != token::special_idents::invalid.name {
             self.cx.path.push(ident);
         }
-        debug!("current path: {}",
-               ast_util::path_name_i(&self.cx.path));
+        debug!("current path: {}", path_name_i(&self.cx.path));
 
         let i = if is_test_fn(&self.cx, &i) || is_bench_fn(&self.cx, &i) {
             match i.node {
@@ -349,7 +347,6 @@ enum HasTestSignature {
     NotEvenAFunction,
 }
 
-
 fn is_test_fn(cx: &TestCtxt, i: &ast::Item) -> bool {
     let has_test_attr = attr::contains_name(&i.attrs, "test");
 
@@ -576,6 +573,11 @@ fn path_node(ids: Vec<ast::Ident> ) -> ast::Path {
     }
 }
 
+fn path_name_i(idents: &[ast::Ident]) -> String {
+    // FIXME: Bad copies (#2543 -- same for everything else that says "bad")
+    idents.iter().map(|i| i.to_string()).collect::<Vec<String>>().join("::")
+}
+
 fn mk_tests(cx: &TestCtxt) -> P<ast::Item> {
     // The vector of test_descs for this crate
     let test_descs = mk_test_descs(cx);
@@ -645,10 +647,10 @@ fn mk_test_desc_and_fn_rec(cx: &TestCtxt, test: &Test) -> P<ast::Expr> {
     // creates $name: $expr
     let field = |name, expr| ecx.field_imm(span, ecx.ident_of(name), expr);
 
-    debug!("encoding {}", ast_util::path_name_i(&path[..]));
+    debug!("encoding {}", path_name_i(&path[..]));
 
     // path to the #[test] function: "foo::bar::baz"
-    let path_string = ast_util::path_name_i(&path[..]);
+    let path_string = path_name_i(&path[..]);
     let name_expr = ecx.expr_str(span, token::intern_and_get_ident(&path_string[..]));
 
     // self::test::StaticTestName($name_expr)
diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs
index 1251f9bfe13..839bbf4805d 100644
--- a/src/libsyntax/visit.rs
+++ b/src/libsyntax/visit.rs
@@ -619,9 +619,9 @@ pub fn walk_struct_def<'v, V: Visitor<'v>>(visitor: &mut V,
 
 pub fn walk_struct_field<'v, V: Visitor<'v>>(visitor: &mut V,
                                              struct_field: &'v StructField) {
-    walk_opt_ident(visitor, struct_field.span, struct_field.node.ident());
-    visitor.visit_ty(&struct_field.node.ty);
-    walk_list!(visitor, visit_attribute, &struct_field.node.attrs);
+    walk_opt_ident(visitor, struct_field.span, struct_field.ident);
+    visitor.visit_ty(&struct_field.ty);
+    walk_list!(visitor, visit_attribute, &struct_field.attrs);
 }
 
 pub fn walk_block<'v, V: Visitor<'v>>(visitor: &mut V, block: &'v Block) {
diff --git a/src/libsyntax_ext/deriving/generic/mod.rs b/src/libsyntax_ext/deriving/generic/mod.rs
index 7d452b14dae..b8ba1a58f21 100644
--- a/src/libsyntax_ext/deriving/generic/mod.rs
+++ b/src/libsyntax_ext/deriving/generic/mod.rs
@@ -186,7 +186,6 @@
 
 pub use self::StaticFields::*;
 pub use self::SubstructureFields::*;
-use self::StructType::*;
 
 use std::cell::RefCell;
 use std::collections::HashSet;
@@ -194,7 +193,6 @@ use std::vec;
 
 use syntax::abi::Abi;
 use syntax::ast::{self, EnumDef, Expr, Ident, Generics, VariantData, BinOpKind, PatKind};
-use syntax::ast_util;
 use syntax::attr;
 use syntax::attr::AttrMetaMethods;
 use syntax::ext::base::{ExtCtxt, Annotatable};
@@ -620,7 +618,6 @@ impl<'a> TraitDef<'a> {
         // Just mark it now since we know that it'll end up used downstream
         attr::mark_used(&attr);
         let opt_trait_ref = Some(trait_ref);
-        let ident = ast_util::impl_pretty_name(&opt_trait_ref, Some(&self_type));
         let unused_qual = cx.attribute(
             self.span,
             cx.meta_list(self.span,
@@ -638,7 +635,7 @@ impl<'a> TraitDef<'a> {
 
         cx.item(
             self.span,
-            ident,
+            special_idents::invalid,
             a,
             ast::ItemKind::Impl(unsafety,
                                 ast::ImplPolarity::Positive,
@@ -654,7 +651,7 @@ impl<'a> TraitDef<'a> {
                          type_ident: Ident,
                          generics: &Generics) -> P<ast::Item> {
         let field_tys: Vec<P<ast::Ty>> = struct_def.fields().iter()
-            .map(|field| field.node.ty.clone())
+            .map(|field| field.ty.clone())
             .collect();
 
         let methods = self.methods.iter().map(|method_def| {
@@ -702,7 +699,7 @@ impl<'a> TraitDef<'a> {
 
         for variant in &enum_def.variants {
             field_tys.extend(variant.node.data.fields().iter()
-                .map(|field| field.node.ty.clone()));
+                .map(|field| field.ty.clone()));
         }
 
         let methods = self.methods.iter().map(|method_def| {
@@ -1409,11 +1406,6 @@ impl<'a> MethodDef<'a> {
     }
 }
 
-#[derive(PartialEq)] // dogfooding!
-enum StructType {
-    Unknown, Record, Tuple
-}
-
 // general helper methods.
 impl<'a> TraitDef<'a> {
     fn set_expn_info(&self,
@@ -1441,9 +1433,9 @@ impl<'a> TraitDef<'a> {
         let mut just_spans = Vec::new();
         for field in struct_def.fields(){
             let sp = self.set_expn_info(cx, field.span);
-            match field.node.kind {
-                ast::NamedField(ident, _) => named_idents.push((ident, sp)),
-                ast::UnnamedField(..) => just_spans.push(sp),
+            match field.ident {
+                Some(ident) => named_idents.push((ident, sp)),
+                _ => just_spans.push(sp),
             }
         }
 
@@ -1479,53 +1471,26 @@ impl<'a> TraitDef<'a> {
                              -> (P<ast::Pat>, Vec<(Span, Option<Ident>,
                                                    P<Expr>,
                                                    &'a [ast::Attribute])>) {
-        if struct_def.fields().is_empty() {
-            if struct_def.is_struct() {
-                return (cx.pat_struct(self.span, struct_path, vec![]), vec![]);
-            } else {
-                return (cx.pat_enum(self.span, struct_path, vec![]), vec![]);
-            }
-        }
-
         let mut paths = Vec::new();
-        let mut ident_expr = Vec::new();
-        let mut struct_type = Unknown;
-
+        let mut ident_exprs = Vec::new();
         for (i, struct_field) in struct_def.fields().iter().enumerate() {
             let sp = self.set_expn_info(cx, struct_field.span);
-            let opt_id = match struct_field.node.kind {
-                ast::NamedField(ident, _) if (struct_type == Unknown ||
-                                              struct_type == Record) => {
-                    struct_type = Record;
-                    Some(ident)
-                }
-                ast::UnnamedField(..) if (struct_type == Unknown ||
-                                          struct_type == Tuple) => {
-                    struct_type = Tuple;
-                    None
-                }
-                _ => {
-                    cx.span_bug(sp, "a struct with named and unnamed fields in `derive`");
-                }
-            };
             let ident = cx.ident_of(&format!("{}_{}", prefix, i));
             paths.push(codemap::Spanned{span: sp, node: ident});
             let val = cx.expr_deref(sp, cx.expr_path(cx.path_ident(sp,ident)));
             let val = cx.expr(sp, ast::ExprKind::Paren(val));
-            ident_expr.push((sp, opt_id, val, &struct_field.node.attrs[..]));
+            ident_exprs.push((sp, struct_field.ident, val, &struct_field.attrs[..]));
         }
 
         let subpats = self.create_subpatterns(cx, paths, mutbl);
-
-        // struct_type is definitely not Unknown, since struct_def.fields
-        // must be nonempty to reach here
         let pattern = if struct_def.is_struct() {
-            let field_pats = subpats.into_iter().zip(&ident_expr)
-                                    .map(|(pat, &(_, id, _, _))| {
-                // id is guaranteed to be Some
+            let field_pats = subpats.into_iter().zip(&ident_exprs).map(|(pat, &(sp, ident, _, _))| {
+                if ident.is_none() {
+                    cx.span_bug(sp, "a braced struct with unnamed fields in `derive`");
+                }
                 codemap::Spanned {
                     span: pat.span,
-                    node: ast::FieldPat { ident: id.unwrap(), pat: pat, is_shorthand: false },
+                    node: ast::FieldPat { ident: ident.unwrap(), pat: pat, is_shorthand: false },
                 }
             }).collect();
             cx.pat_struct(self.span, struct_path, field_pats)
@@ -1533,7 +1498,7 @@ impl<'a> TraitDef<'a> {
             cx.pat_enum(self.span, struct_path, subpats)
         };
 
-        (pattern, ident_expr)
+        (pattern, ident_exprs)
     }
 
     fn create_enum_variant_pattern(&self,
diff --git a/src/rustc/Cargo.lock b/src/rustc/Cargo.lock
index 3f0d5086a17..4b5c2850dab 100644
--- a/src/rustc/Cargo.lock
+++ b/src/rustc/Cargo.lock
@@ -75,7 +75,6 @@ dependencies = [
  "rustc_bitflags 0.0.0",
  "rustc_const_eval 0.0.0",
  "rustc_data_structures 0.0.0",
- "rustc_front 0.0.0",
  "serialize 0.0.0",
  "syntax 0.0.0",
 ]
@@ -85,7 +84,6 @@ name = "rustc_back"
 version = "0.0.0"
 dependencies = [
  "log 0.0.0",
- "rustc_front 0.0.0",
  "serialize 0.0.0",
  "syntax 0.0.0",
 ]
@@ -101,7 +99,6 @@ dependencies = [
  "graphviz 0.0.0",
  "log 0.0.0",
  "rustc 0.0.0",
- "rustc_front 0.0.0",
  "rustc_mir 0.0.0",
  "syntax 0.0.0",
 ]
@@ -134,7 +131,6 @@ dependencies = [
  "rustc 0.0.0",
  "rustc_back 0.0.0",
  "rustc_borrowck 0.0.0",
- "rustc_front 0.0.0",
  "rustc_lint 0.0.0",
  "rustc_llvm 0.0.0",
  "rustc_metadata 0.0.0",
@@ -152,23 +148,12 @@ dependencies = [
 ]
 
 [[package]]
-name = "rustc_front"
-version = "0.0.0"
-dependencies = [
- "log 0.0.0",
- "rustc_bitflags 0.0.0",
- "serialize 0.0.0",
- "syntax 0.0.0",
-]
-
-[[package]]
 name = "rustc_lint"
 version = "0.0.0"
 dependencies = [
  "log 0.0.0",
  "rustc 0.0.0",
  "rustc_back 0.0.0",
- "rustc_front 0.0.0",
  "syntax 0.0.0",
 ]
 
@@ -192,7 +177,6 @@ dependencies = [
  "rustc_back 0.0.0",
  "rustc_bitflags 0.0.0",
  "rustc_const_eval 0.0.0",
- "rustc_front 0.0.0",
  "rustc_llvm 0.0.0",
  "serialize 0.0.0",
  "syntax 0.0.0",
@@ -208,7 +192,6 @@ dependencies = [
  "rustc_back 0.0.0",
  "rustc_const_eval 0.0.0",
  "rustc_data_structures 0.0.0",
- "rustc_front 0.0.0",
  "syntax 0.0.0",
 ]
 
@@ -218,7 +201,6 @@ version = "0.0.0"
 dependencies = [
  "log 0.0.0",
  "rustc 0.0.0",
- "rustc_front 0.0.0",
  "syntax 0.0.0",
 ]
 
@@ -234,7 +216,6 @@ dependencies = [
  "rustc 0.0.0",
  "rustc_back 0.0.0",
  "rustc_bitflags 0.0.0",
- "rustc_front 0.0.0",
  "rustc_metadata 0.0.0",
  "rustc_mir 0.0.0",
  "syntax 0.0.0",
@@ -246,7 +227,6 @@ version = "0.0.0"
 dependencies = [
  "log 0.0.0",
  "rustc 0.0.0",
- "rustc_front 0.0.0",
  "syntax 0.0.0",
 ]
 
@@ -258,7 +238,6 @@ dependencies = [
  "log 0.0.0",
  "rustc 0.0.0",
  "rustc_bitflags 0.0.0",
- "rustc_front 0.0.0",
  "syntax 0.0.0",
 ]
 
@@ -284,7 +263,6 @@ dependencies = [
  "rustc_back 0.0.0",
  "rustc_const_eval 0.0.0",
  "rustc_data_structures 0.0.0",
- "rustc_front 0.0.0",
  "rustc_llvm 0.0.0",
  "rustc_mir 0.0.0",
  "rustc_platform_intrinsics 0.0.0",
@@ -302,7 +280,6 @@ dependencies = [
  "rustc 0.0.0",
  "rustc_back 0.0.0",
  "rustc_const_eval 0.0.0",
- "rustc_front 0.0.0",
  "rustc_platform_intrinsics 0.0.0",
  "syntax 0.0.0",
 ]
@@ -318,7 +295,6 @@ dependencies = [
  "rustc 0.0.0",
  "rustc_back 0.0.0",
  "rustc_driver 0.0.0",
- "rustc_front 0.0.0",
  "rustc_lint 0.0.0",
  "rustc_metadata 0.0.0",
  "rustc_resolve 0.0.0",
diff --git a/src/test/auxiliary/dummy_mir_pass.rs b/src/test/auxiliary/dummy_mir_pass.rs
index fc1ef4d41a8..b5234af937b 100644
--- a/src/test/auxiliary/dummy_mir_pass.rs
+++ b/src/test/auxiliary/dummy_mir_pass.rs
@@ -14,7 +14,6 @@
 #![feature(box_syntax)]
 
 #[macro_use] extern crate rustc;
-extern crate rustc_front;
 extern crate rustc_plugin;
 extern crate rustc_const_math;
 extern crate syntax;
diff --git a/src/test/auxiliary/lint_for_crate.rs b/src/test/auxiliary/lint_for_crate.rs
index 1933188ccbf..a424517da12 100644
--- a/src/test/auxiliary/lint_for_crate.rs
+++ b/src/test/auxiliary/lint_for_crate.rs
@@ -14,13 +14,12 @@
 #![feature(box_syntax)]
 
 #[macro_use] extern crate rustc;
-extern crate rustc_front;
 extern crate rustc_plugin;
 extern crate syntax;
 
 use rustc::lint::{LateContext, LintContext, LintPass, LateLintPass, LateLintPassObject, LintArray};
 use rustc_plugin::Registry;
-use rustc_front::hir;
+use rustc::hir;
 use syntax::attr;
 
 declare_lint!(CRATE_NOT_OKAY, Warn, "crate not marked with #![crate_okay]");
diff --git a/src/test/auxiliary/lint_group_plugin_test.rs b/src/test/auxiliary/lint_group_plugin_test.rs
index 98ed86bb390..1e9a77724a8 100644
--- a/src/test/auxiliary/lint_group_plugin_test.rs
+++ b/src/test/auxiliary/lint_group_plugin_test.rs
@@ -13,14 +13,12 @@
 #![feature(plugin_registrar)]
 #![feature(box_syntax, rustc_private)]
 
-extern crate rustc_front;
-
 // Load rustc as a plugin to get macros
 #[macro_use]
 extern crate rustc;
 extern crate rustc_plugin;
 
-use rustc_front::hir;
+use rustc::hir;
 use rustc::lint::{LateContext, LintContext, LintPass, LateLintPass, LateLintPassObject, LintArray};
 use rustc_plugin::Registry;
 
diff --git a/src/test/run-make/execution-engine/test.rs b/src/test/run-make/execution-engine/test.rs
index 81ad276ca68..91b4f5f30ad 100644
--- a/src/test/run-make/execution-engine/test.rs
+++ b/src/test/run-make/execution-engine/test.rs
@@ -14,7 +14,6 @@
 extern crate libc;
 extern crate rustc;
 extern crate rustc_driver;
-extern crate rustc_front;
 extern crate rustc_lint;
 extern crate rustc_llvm as llvm;
 extern crate rustc_metadata;
@@ -28,13 +27,13 @@ use std::rc::Rc;
 use std::thread::Builder;
 
 use rustc::dep_graph::DepGraph;
-use rustc::front::map as ast_map;
+use rustc::hir::map as ast_map;
 use rustc::middle::cstore::{CrateStore, LinkagePreference};
 use rustc::ty;
 use rustc::session::config::{self, basic_options, build_configuration, Input, Options};
 use rustc::session::build_session;
 use rustc_driver::{driver, abort_on_err};
-use rustc_front::lowering::{lower_crate, LoweringContext};
+use rustc::hir::lowering::{lower_crate, LoweringContext};
 use rustc_resolve::MakeGlobMap;
 use rustc_metadata::cstore::CStore;
 use libc::c_void;
diff --git a/src/test/run-make/pretty-print-path-suffix/foo_method.pp b/src/test/run-make/pretty-print-path-suffix/foo_method.pp
index 4879fbfe6d3..696e0544fdc 100644
--- a/src/test/run-make/pretty-print-path-suffix/foo_method.pp
+++ b/src/test/run-make/pretty-print-path-suffix/foo_method.pp
@@ -13,4 +13,4 @@
 
 
 fn foo_method(&self) -> &'static str { return "i am very similar to foo."; }
-/* nest::S::foo_method */
+/* nest::{{impl}}::foo_method */