about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/doc/not_found.md14
-rw-r--r--src/libcore/macros.rs2
-rw-r--r--src/libcore/option.rs17
-rw-r--r--src/libcore/result.rs10
-rw-r--r--src/librustc/ich/hcx.rs65
-rw-r--r--src/librustc/ich/impls_hir.rs106
-rw-r--r--src/librustc/ich/impls_mir.rs45
-rw-r--r--src/librustc/mir/mod.rs4
-rw-r--r--src/librustc/session/config.rs2
-rw-r--r--src/librustc/ty/maps/config.rs78
-rw-r--r--src/librustc/ty/maps/on_disk_cache.rs10
-rw-r--r--src/librustc/ty/maps/plumbing.rs3
-rw-r--r--src/librustc_metadata/astencode.rs4
-rw-r--r--src/librustc_metadata/decoder.rs34
-rw-r--r--src/librustc_trans/consts.rs2
-rw-r--r--src/librustdoc/clean/mod.rs2
-rw-r--r--src/librustdoc/html/layout.rs1
-rw-r--r--src/librustdoc/html/render.rs31
-rw-r--r--src/librustdoc/html/static/main.js44
-rw-r--r--src/librustdoc/html/static/rustdoc.css83
-rw-r--r--src/librustdoc/html/static/styles/main.css89
-rw-r--r--src/librustdoc/markdown.rs47
-rw-r--r--src/libstd/fs.rs134
-rw-r--r--src/libstd/lib.rs1
-rw-r--r--src/libstd/macros.rs2
-rw-r--r--src/rustllvm/PassWrapper.cpp2
-rw-r--r--src/test/incremental/hashes/call_expressions.rs2
-rw-r--r--src/test/incremental/hashes/closure_expressions.rs2
-rw-r--r--src/test/incremental/hashes/consts.rs2
-rw-r--r--src/test/incremental/hashes/enum_constructors.rs2
-rw-r--r--src/test/incremental/hashes/enum_defs.rs2
-rw-r--r--src/test/incremental/hashes/exported_vs_not.rs2
-rw-r--r--src/test/incremental/hashes/extern_mods.rs2
-rw-r--r--src/test/incremental/hashes/for_loops.rs2
-rw-r--r--src/test/incremental/hashes/function_interfaces.rs2
-rw-r--r--src/test/incremental/hashes/if_expressions.rs2
-rw-r--r--src/test/incremental/hashes/indexing_expressions.rs2
-rw-r--r--src/test/incremental/hashes/inherent_impls.rs2
-rw-r--r--src/test/incremental/hashes/inline_asm.rs2
-rw-r--r--src/test/incremental/hashes/let_expressions.rs2
-rw-r--r--src/test/incremental/hashes/loop_expressions.rs2
-rw-r--r--src/test/incremental/hashes/match_expressions.rs2
-rw-r--r--src/test/incremental/hashes/panic_exprs.rs165
-rw-r--r--src/test/incremental/hashes/panic_exprs_no_overflow_checks.rs225
-rw-r--r--src/test/incremental/hashes/statics.rs2
-rw-r--r--src/test/incremental/hashes/struct_constructors.rs2
-rw-r--r--src/test/incremental/hashes/struct_defs.rs2
-rw-r--r--src/test/incremental/hashes/trait_defs.rs2
-rw-r--r--src/test/incremental/hashes/trait_impls.rs2
-rw-r--r--src/test/incremental/hashes/type_defs.rs2
-rw-r--r--src/test/incremental/hashes/unary_and_binary_exprs.rs2
-rw-r--r--src/test/incremental/hashes/while_let_loops.rs2
-rw-r--r--src/test/incremental/hashes/while_loops.rs2
-rw-r--r--src/test/incremental/ich_method_call_trait_scope.rs15
-rw-r--r--src/test/incremental/ich_nested_items.rs13
-rw-r--r--src/test/incremental/ich_resolve_results.rs40
-rw-r--r--src/test/incremental/source_loc_macros.rs30
-rw-r--r--src/test/incremental/spans_insignificant_w_o_debuginfo.rs26
-rw-r--r--src/test/incremental/spans_significant_w_panic.rs3
-rw-r--r--src/test/run-pass/auxiliary/svh-a-comment.rs36
-rw-r--r--src/test/run-pass/auxiliary/svh-a-doc.rs38
-rw-r--r--src/test/run-pass/auxiliary/svh-a-macro.rs37
-rw-r--r--src/test/run-pass/auxiliary/svh-a-no-change.rs35
-rw-r--r--src/test/run-pass/auxiliary/svh-a-redundant-cfg.rs37
-rw-r--r--src/test/run-pass/auxiliary/svh-a-whitespace.rs37
-rw-r--r--src/test/run-pass/hygiene/issue-44128.rs (renamed from src/test/run-pass/svh-add-doc.rs)22
-rw-r--r--src/test/run-pass/svh-add-comment.rs23
-rw-r--r--src/test/run-pass/svh-add-nothing.rs2
-rw-r--r--src/test/run-pass/svh-add-redundant-cfg.rs23
-rw-r--r--src/test/run-pass/svh-add-whitespace.rs23
-rw-r--r--src/test/run-pass/thinlto/weak-works.rs (renamed from src/test/run-pass/svh-add-macro.rs)32
71 files changed, 709 insertions, 1035 deletions
diff --git a/src/doc/not_found.md b/src/doc/not_found.md
index ebe7c59313f..f404aa046c1 100644
--- a/src/doc/not_found.md
+++ b/src/doc/not_found.md
@@ -13,20 +13,20 @@ Some things that might be helpful to you though:
 
 # Search
 
-* <form action="https://duckduckgo.com/">
+<form action="https://duckduckgo.com/">
     <input type="text" id="site-search" name="q" size="80"></input>
-    <input type="submit" value="Search DuckDuckGo">
-</form>
-* Rust doc search: <span id="core-search"></span>
+    <input type="submit" value="Search DuckDuckGo"></form>
+
+Rust doc search: <span id="core-search"></span>
 
 # Reference
 
-* [The Rust official site](https://www.rust-lang.org)
-* [The Rust reference](https://doc.rust-lang.org/reference/index.html)
+ * [The Rust official site](https://www.rust-lang.org)
+ * [The Rust reference](https://doc.rust-lang.org/reference/index.html)
 
 # Docs
 
-* [The standard library](https://doc.rust-lang.org/std/)
+[The standard library](https://doc.rust-lang.org/std/)
 
 <script>
 function get_url_fragments() {
diff --git a/src/libcore/macros.rs b/src/libcore/macros.rs
index fe2df226115..948ad104cdf 100644
--- a/src/libcore/macros.rs
+++ b/src/libcore/macros.rs
@@ -736,7 +736,7 @@ mod builtin {
     #[cfg(dox)]
     macro_rules! module_path { () => ({ /* compiler built-in */ }) }
 
-    /// Boolean evaluation of configuration flags.
+    /// Boolean evaluation of configuration flags, at compile-time.
     ///
     /// For more information, see the documentation for [`std::cfg!`].
     ///
diff --git a/src/libcore/option.rs b/src/libcore/option.rs
index 12e6e843056..d8f3ec38cf3 100644
--- a/src/libcore/option.rs
+++ b/src/libcore/option.rs
@@ -338,6 +338,12 @@ impl<T> Option<T> {
 
     /// Returns the contained value or a default.
     ///
+    /// Arguments passed to `unwrap_or` are eagerly evaluated; if you are passing
+    /// the result of a function call, it is recommended to use [`unwrap_or_else`],
+    /// which is lazily evaluated.
+    ///
+    /// [`unwrap_or_else`]: #method.unwrap_or_else
+    ///
     /// # Examples
     ///
     /// ```
@@ -451,11 +457,16 @@ impl<T> Option<T> {
     /// Transforms the `Option<T>` into a [`Result<T, E>`], mapping [`Some(v)`] to
     /// [`Ok(v)`] and [`None`] to [`Err(err)`].
     ///
+    /// Arguments passed to `ok_or` are eagerly evaluated; if you are passing the
+    /// result of a function call, it is recommended to use [`ok_or_else`], which is
+    /// lazily evaluated.
+    ///
     /// [`Result<T, E>`]: ../../std/result/enum.Result.html
     /// [`Ok(v)`]: ../../std/result/enum.Result.html#variant.Ok
     /// [`Err(err)`]: ../../std/result/enum.Result.html#variant.Err
     /// [`None`]: #variant.None
     /// [`Some(v)`]: #variant.Some
+    /// [`ok_or_else`]: #method.ok_or_else
     ///
     /// # Examples
     ///
@@ -644,6 +655,12 @@ impl<T> Option<T> {
 
     /// Returns the option if it contains a value, otherwise returns `optb`.
     ///
+    /// Arguments passed to `or` are eagerly evaluated; if you are passing the
+    /// result of a function call, it is recommended to use [`or_else`], which is
+    /// lazily evaluated.
+    ///
+    /// [`or_else`]: #method.or_else
+    ///
     /// # Examples
     ///
     /// ```
diff --git a/src/libcore/result.rs b/src/libcore/result.rs
index 959935242dc..2ace3d2aee8 100644
--- a/src/libcore/result.rs
+++ b/src/libcore/result.rs
@@ -625,8 +625,13 @@ impl<T, E> Result<T, E> {
 
     /// Returns `res` if the result is [`Err`], otherwise returns the [`Ok`] value of `self`.
     ///
+    /// Arguments passed to `or` are eagerly evaluated; if you are passing the
+    /// result of a function call, it is recommended to use [`or_else`], which is
+    /// lazily evaluated.
+    ///
     /// [`Ok`]: enum.Result.html#variant.Ok
     /// [`Err`]: enum.Result.html#variant.Err
+    /// [`or_else`]: #method.or_else
     ///
     /// # Examples
     ///
@@ -690,8 +695,13 @@ impl<T, E> Result<T, E> {
     /// Unwraps a result, yielding the content of an [`Ok`].
     /// Else, it returns `optb`.
     ///
+    /// Arguments passed to `unwrap_or` are eagerly evaluated; if you are passing
+    /// the result of a function call, it is recommended to use [`unwrap_or_else`],
+    /// which is lazily evaluated.
+    ///
     /// [`Ok`]: enum.Result.html#variant.Ok
     /// [`Err`]: enum.Result.html#variant.Err
+    /// [`unwrap_or_else`]: #method.unwrap_or_else
     ///
     /// # Examples
     ///
diff --git a/src/librustc/ich/hcx.rs b/src/librustc/ich/hcx.rs
index d95b825b9e5..0ef42177c14 100644
--- a/src/librustc/ich/hcx.rs
+++ b/src/librustc/ich/hcx.rs
@@ -14,7 +14,6 @@ use hir::map::DefPathHash;
 use hir::map::definitions::Definitions;
 use ich::{self, CachingCodemapView};
 use middle::cstore::CrateStore;
-use session::config::DebugInfoLevel::NoDebugInfo;
 use ty::{TyCtxt, fast_reject};
 use session::Session;
 
@@ -24,7 +23,7 @@ use std::cell::RefCell;
 use std::collections::HashMap;
 
 use syntax::ast;
-use syntax::attr;
+
 use syntax::codemap::CodeMap;
 use syntax::ext::hygiene::SyntaxContext;
 use syntax::symbol::Symbol;
@@ -51,7 +50,6 @@ pub struct StableHashingContext<'gcx> {
     body_resolver: BodyResolver<'gcx>,
     hash_spans: bool,
     hash_bodies: bool,
-    overflow_checks_enabled: bool,
     node_id_hashing_mode: NodeIdHashingMode,
 
     // Very often, we are hashing something that does not need the
@@ -89,8 +87,7 @@ impl<'gcx> StableHashingContext<'gcx> {
                definitions: &'gcx Definitions,
                cstore: &'gcx CrateStore)
                -> Self {
-        let hash_spans_initial = sess.opts.debuginfo != NoDebugInfo;
-        let check_overflow_initial = sess.overflow_checks();
+        let hash_spans_initial = !sess.opts.debugging_opts.incremental_ignore_spans;
 
         debug_assert!(ich::IGNORED_ATTRIBUTES.len() > 0);
         IGNORED_ATTR_NAMES.with(|names| {
@@ -110,7 +107,6 @@ impl<'gcx> StableHashingContext<'gcx> {
             raw_codemap: sess.codemap(),
             hash_spans: hash_spans_initial,
             hash_bodies: true,
-            overflow_checks_enabled: check_overflow_initial,
             node_id_hashing_mode: NodeIdHashingMode::HashDefPath,
         }
     }
@@ -120,11 +116,6 @@ impl<'gcx> StableHashingContext<'gcx> {
         self.sess
     }
 
-    pub fn force_span_hashing(mut self) -> Self {
-        self.hash_spans = true;
-        self
-    }
-
     #[inline]
     pub fn while_hashing_hir_bodies<F: FnOnce(&mut Self)>(&mut self,
                                                           hash_bodies: bool,
@@ -175,11 +166,6 @@ impl<'gcx> StableHashingContext<'gcx> {
     }
 
     #[inline]
-    pub fn hash_spans(&self) -> bool {
-        self.hash_spans
-    }
-
-    #[inline]
     pub fn hash_bodies(&self) -> bool {
         self.hash_bodies
     }
@@ -204,58 +190,13 @@ impl<'gcx> StableHashingContext<'gcx> {
         })
     }
 
-    pub fn hash_hir_item_like<F: FnOnce(&mut Self)>(&mut self,
-                                                    item_attrs: &[ast::Attribute],
-                                                    is_const: bool,
-                                                    f: F) {
-        let prev_overflow_checks = self.overflow_checks_enabled;
-        if is_const || attr::contains_name(item_attrs, "rustc_inherit_overflow_checks") {
-            self.overflow_checks_enabled = true;
-        }
+    pub fn hash_hir_item_like<F: FnOnce(&mut Self)>(&mut self, f: F) {
         let prev_hash_node_ids = self.node_id_hashing_mode;
         self.node_id_hashing_mode = NodeIdHashingMode::Ignore;
 
         f(self);
 
         self.node_id_hashing_mode = prev_hash_node_ids;
-        self.overflow_checks_enabled = prev_overflow_checks;
-    }
-
-    #[inline]
-    pub fn binop_can_panic_at_runtime(&self, binop: hir::BinOp_) -> bool
-    {
-        match binop {
-            hir::BiAdd |
-            hir::BiSub |
-            hir::BiShl |
-            hir::BiShr |
-            hir::BiMul => self.overflow_checks_enabled,
-
-            hir::BiDiv |
-            hir::BiRem => true,
-
-            hir::BiAnd |
-            hir::BiOr |
-            hir::BiBitXor |
-            hir::BiBitAnd |
-            hir::BiBitOr |
-            hir::BiEq |
-            hir::BiLt |
-            hir::BiLe |
-            hir::BiNe |
-            hir::BiGe |
-            hir::BiGt => false
-        }
-    }
-
-    #[inline]
-    pub fn unop_can_panic_at_runtime(&self, unop: hir::UnOp) -> bool
-    {
-        match unop {
-            hir::UnDeref |
-            hir::UnNot => false,
-            hir::UnNeg => self.overflow_checks_enabled,
-        }
     }
 }
 
diff --git a/src/librustc/ich/impls_hir.rs b/src/librustc/ich/impls_hir.rs
index 77bf3da679d..1533e37d7f7 100644
--- a/src/librustc/ich/impls_hir.rs
+++ b/src/librustc/ich/impls_hir.rs
@@ -529,63 +529,9 @@ impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::Expr {
                 ref attrs
             } = *self;
 
-            let spans_always_on = match *node {
-                hir::ExprBox(..)        |
-                hir::ExprArray(..)      |
-                hir::ExprCall(..)       |
-                hir::ExprLit(..)        |
-                hir::ExprCast(..)       |
-                hir::ExprType(..)       |
-                hir::ExprIf(..)         |
-                hir::ExprWhile(..)      |
-                hir::ExprLoop(..)       |
-                hir::ExprMatch(..)      |
-                hir::ExprClosure(..)    |
-                hir::ExprBlock(..)      |
-                hir::ExprAssign(..)     |
-                hir::ExprTupField(..)   |
-                hir::ExprAddrOf(..)     |
-                hir::ExprBreak(..)      |
-                hir::ExprAgain(..)      |
-                hir::ExprRet(..)        |
-                hir::ExprYield(..)      |
-                hir::ExprInlineAsm(..)  |
-                hir::ExprRepeat(..)     |
-                hir::ExprTup(..)        |
-                hir::ExprMethodCall(..) |
-                hir::ExprPath(..)       |
-                hir::ExprStruct(..)     |
-                hir::ExprField(..)      => {
-                    // For these we only hash the span when debuginfo is on.
-                    false
-                }
-                // For the following, spans might be significant because of
-                // panic messages indicating the source location.
-                hir::ExprBinary(op, ..) => {
-                    hcx.binop_can_panic_at_runtime(op.node)
-                }
-                hir::ExprUnary(op, _) => {
-                    hcx.unop_can_panic_at_runtime(op)
-                }
-                hir::ExprAssignOp(op, ..) => {
-                    hcx.binop_can_panic_at_runtime(op.node)
-                }
-                hir::ExprIndex(..) => {
-                    true
-                }
-            };
-
-            if spans_always_on {
-                hcx.while_hashing_spans(true, |hcx| {
-                    span.hash_stable(hcx, hasher);
-                    node.hash_stable(hcx, hasher);
-                    attrs.hash_stable(hcx, hasher);
-                });
-            } else {
-                span.hash_stable(hcx, hasher);
-                node.hash_stable(hcx, hasher);
-                attrs.hash_stable(hcx, hasher);
-            }
+            span.hash_stable(hcx, hasher);
+            node.hash_stable(hcx, hasher);
+            attrs.hash_stable(hcx, hasher);
         })
     }
 }
@@ -712,15 +658,7 @@ impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::TraitItem {
             span
         } = *self;
 
-        let is_const = match *node {
-            hir::TraitItemKind::Const(..) |
-            hir::TraitItemKind::Type(..) => true,
-            hir::TraitItemKind::Method(hir::MethodSig { constness, .. }, _) => {
-                constness == hir::Constness::Const
-            }
-        };
-
-        hcx.hash_hir_item_like(attrs, is_const, |hcx| {
+        hcx.hash_hir_item_like(|hcx| {
             name.hash_stable(hcx, hasher);
             attrs.hash_stable(hcx, hasher);
             generics.hash_stable(hcx, hasher);
@@ -757,15 +695,7 @@ impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::ImplItem {
             span
         } = *self;
 
-        let is_const = match *node {
-            hir::ImplItemKind::Const(..) |
-            hir::ImplItemKind::Type(..) => true,
-            hir::ImplItemKind::Method(hir::MethodSig { constness, .. }, _) => {
-                constness == hir::Constness::Const
-            }
-        };
-
-        hcx.hash_hir_item_like(attrs, is_const, |hcx| {
+        hcx.hash_hir_item_like(|hcx| {
             name.hash_stable(hcx, hasher);
             vis.hash_stable(hcx, hasher);
             defaultness.hash_stable(hcx, hasher);
@@ -884,30 +814,6 @@ impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::Item {
     fn hash_stable<W: StableHasherResult>(&self,
                                           hcx: &mut StableHashingContext<'gcx>,
                                           hasher: &mut StableHasher<W>) {
-        let is_const = match self.node {
-            hir::ItemStatic(..)      |
-            hir::ItemConst(..)       => {
-                true
-            }
-            hir::ItemFn(_, _, constness, ..) => {
-                constness == hir::Constness::Const
-            }
-            hir::ItemUse(..)         |
-            hir::ItemExternCrate(..) |
-            hir::ItemForeignMod(..)  |
-            hir::ItemGlobalAsm(..)   |
-            hir::ItemMod(..)         |
-            hir::ItemAutoImpl(..) |
-            hir::ItemTrait(..)       |
-            hir::ItemImpl(..)        |
-            hir::ItemTy(..)          |
-            hir::ItemEnum(..)        |
-            hir::ItemStruct(..)      |
-            hir::ItemUnion(..)       => {
-                false
-            }
-        };
-
         let hir::Item {
             name,
             ref attrs,
@@ -918,7 +824,7 @@ impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::Item {
             span
         } = *self;
 
-        hcx.hash_hir_item_like(attrs, is_const, |hcx| {
+        hcx.hash_hir_item_like(|hcx| {
             name.hash_stable(hcx, hasher);
             attrs.hash_stable(hcx, hasher);
             node.hash_stable(hcx, hasher);
diff --git a/src/librustc/ich/impls_mir.rs b/src/librustc/ich/impls_mir.rs
index beee34e11b7..32577ac46f3 100644
--- a/src/librustc/ich/impls_mir.rs
+++ b/src/librustc/ich/impls_mir.rs
@@ -55,48 +55,11 @@ for mir::UnsafetyViolationKind {
         }
     }
 }
-impl<'gcx> HashStable<StableHashingContext<'gcx>>
-for mir::Terminator<'gcx> {
-    #[inline]
-    fn hash_stable<W: StableHasherResult>(&self,
-                                          hcx: &mut StableHashingContext<'gcx>,
-                                          hasher: &mut StableHasher<W>) {
-        let mir::Terminator {
-            ref kind,
-            ref source_info,
-        } = *self;
 
-        let hash_spans_unconditionally = match *kind {
-            mir::TerminatorKind::Assert { .. } => {
-                // Assert terminators generate a panic message that contains the
-                // source location, so we always have to feed its span into the
-                // ICH.
-                true
-            }
-            mir::TerminatorKind::Goto { .. } |
-            mir::TerminatorKind::SwitchInt { .. } |
-            mir::TerminatorKind::Resume |
-            mir::TerminatorKind::Return |
-            mir::TerminatorKind::GeneratorDrop |
-            mir::TerminatorKind::Unreachable |
-            mir::TerminatorKind::Drop { .. } |
-            mir::TerminatorKind::DropAndReplace { .. } |
-            mir::TerminatorKind::Yield { .. } |
-            mir::TerminatorKind::Call { .. } |
-            mir::TerminatorKind::FalseEdges { .. } => false,
-        };
-
-        if hash_spans_unconditionally {
-            hcx.while_hashing_spans(true, |hcx| {
-                source_info.hash_stable(hcx, hasher);
-            })
-        } else {
-            source_info.hash_stable(hcx, hasher);
-        }
-
-        kind.hash_stable(hcx, hasher);
-    }
-}
+impl_stable_hash_for!(struct mir::Terminator<'tcx> {
+    kind,
+    source_info
+});
 
 impl<'gcx, T> HashStable<StableHashingContext<'gcx>> for mir::ClearCrossCrate<T>
     where T: HashStable<StableHashingContext<'gcx>>
diff --git a/src/librustc/mir/mod.rs b/src/librustc/mir/mod.rs
index 720d831a245..64e601ab1e7 100644
--- a/src/librustc/mir/mod.rs
+++ b/src/librustc/mir/mod.rs
@@ -1830,7 +1830,7 @@ pub struct GeneratorLayout<'tcx> {
 /// instance of the closure is created, the corresponding free regions
 /// can be extracted from its type and constrained to have the given
 /// outlives relationship.
-#[derive(Clone, Debug)]
+#[derive(Clone, Debug, RustcEncodable, RustcDecodable)]
 pub struct ClosureRegionRequirements {
     /// The number of external regions defined on the closure.  In our
     /// example above, it would be 3 -- one for `'static`, then `'1`
@@ -1846,7 +1846,7 @@ pub struct ClosureRegionRequirements {
 
 /// Indicates an outlives constraint between two free-regions declared
 /// on the closure.
-#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
+#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, RustcEncodable, RustcDecodable)]
 pub struct ClosureOutlivesRequirement {
     // This region ...
     pub free_region: ty::RegionVid,
diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs
index 81e18fe536d..0dcd3e80810 100644
--- a/src/librustc/session/config.rs
+++ b/src/librustc/session/config.rs
@@ -1084,6 +1084,8 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
         "dump hash information in textual format to stdout"),
     incremental_verify_ich: bool = (false, parse_bool, [UNTRACKED],
         "verify incr. comp. hashes of green query instances"),
+    incremental_ignore_spans: bool = (false, parse_bool, [UNTRACKED],
+        "ignore spans during ICH computation -- used for testing"),
     dump_dep_graph: bool = (false, parse_bool, [UNTRACKED],
           "dump the dependency graph to $RUST_DEP_GRAPH (default: /tmp/dep_graph.gv)"),
     query_dep_graph: bool = (false, parse_bool, [UNTRACKED],
diff --git a/src/librustc/ty/maps/config.rs b/src/librustc/ty/maps/config.rs
index 496284ad9c9..2d0a3799178 100644
--- a/src/librustc/ty/maps/config.rs
+++ b/src/librustc/ty/maps/config.rs
@@ -27,6 +27,7 @@ pub trait QueryConfig {
 pub(super) trait QueryDescription<'tcx>: QueryConfig {
     fn describe(tcx: TyCtxt, key: Self::Key) -> String;
 
+    #[inline]
     fn cache_on_disk(_: Self::Key) -> bool {
         false
     }
@@ -34,7 +35,7 @@ pub(super) trait QueryDescription<'tcx>: QueryConfig {
     fn try_load_from_disk(_: TyCtxt<'_, 'tcx, 'tcx>,
                           _: SerializedDepNodeIndex)
                           -> Option<Self::Value> {
-        bug!("QueryDescription::load_from_disk() called for unsupport query.")
+        bug!("QueryDescription::load_from_disk() called for an unsupported query.")
     }
 }
 
@@ -166,6 +167,18 @@ impl<'tcx> QueryDescription<'tcx> for queries::symbol_name<'tcx> {
     fn describe(_tcx: TyCtxt, instance: ty::Instance<'tcx>) -> String {
         format!("computing the symbol for `{}`", instance)
     }
+
+    #[inline]
+    fn cache_on_disk(_: Self::Key) -> bool {
+        true
+    }
+
+    #[inline]
+    fn try_load_from_disk<'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
+                              id: SerializedDepNodeIndex)
+                              -> Option<Self::Value> {
+        tcx.on_disk_query_result_cache.try_load_query_result(tcx, id)
+    }
 }
 
 impl<'tcx> QueryDescription<'tcx> for queries::describe_def<'tcx> {
@@ -234,6 +247,18 @@ impl<'tcx> QueryDescription<'tcx> for queries::const_is_rvalue_promotable_to_sta
         format!("const checking if rvalue is promotable to static `{}`",
             tcx.item_path_str(def_id))
     }
+
+    #[inline]
+    fn cache_on_disk(_: Self::Key) -> bool {
+        true
+    }
+
+    #[inline]
+    fn try_load_from_disk<'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
+                          id: SerializedDepNodeIndex)
+                          -> Option<Self::Value> {
+        tcx.on_disk_query_result_cache.try_load_query_result(tcx, id)
+    }
 }
 
 impl<'tcx> QueryDescription<'tcx> for queries::rvalue_promotable_map<'tcx> {
@@ -254,6 +279,18 @@ impl<'tcx> QueryDescription<'tcx> for queries::trans_fulfill_obligation<'tcx> {
     fn describe(tcx: TyCtxt, key: (ty::ParamEnv<'tcx>, ty::PolyTraitRef<'tcx>)) -> String {
         format!("checking if `{}` fulfills its obligations", tcx.item_path_str(key.1.def_id()))
     }
+
+    #[inline]
+    fn cache_on_disk(_: Self::Key) -> bool {
+        true
+    }
+
+    #[inline]
+    fn try_load_from_disk<'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
+                              id: SerializedDepNodeIndex)
+                              -> Option<Self::Value> {
+        tcx.on_disk_query_result_cache.try_load_query_result(tcx, id)
+    }
 }
 
 impl<'tcx> QueryDescription<'tcx> for queries::trait_impls_of<'tcx> {
@@ -567,3 +604,42 @@ impl<'tcx> QueryDescription<'tcx> for queries::typeck_tables_of<'tcx> {
     }
 }
 
+impl<'tcx> QueryDescription<'tcx> for queries::optimized_mir<'tcx> {
+    #[inline]
+    fn cache_on_disk(def_id: Self::Key) -> bool {
+        def_id.is_local()
+    }
+
+    fn try_load_from_disk<'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
+                          id: SerializedDepNodeIndex)
+                          -> Option<Self::Value> {
+        let mir: Option<::mir::Mir<'tcx>> = tcx.on_disk_query_result_cache
+                                               .try_load_query_result(tcx, id);
+        mir.map(|x| tcx.alloc_mir(x))
+    }
+}
+
+macro_rules! impl_disk_cacheable_query(
+    ($query_name:ident, |$key:tt| $cond:expr) => {
+        impl<'tcx> QueryDescription<'tcx> for queries::$query_name<'tcx> {
+            #[inline]
+            fn cache_on_disk($key: Self::Key) -> bool {
+                $cond
+            }
+
+            #[inline]
+            fn try_load_from_disk<'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
+                                      id: SerializedDepNodeIndex)
+                                      -> Option<Self::Value> {
+                tcx.on_disk_query_result_cache.try_load_query_result(tcx, id)
+            }
+        }
+    }
+);
+
+impl_disk_cacheable_query!(unsafety_check_result, |def_id| def_id.is_local());
+impl_disk_cacheable_query!(borrowck, |def_id| def_id.is_local());
+impl_disk_cacheable_query!(mir_borrowck, |def_id| def_id.is_local());
+impl_disk_cacheable_query!(mir_const_qualif, |def_id| def_id.is_local());
+impl_disk_cacheable_query!(contains_extern_indicator, |_| true);
+impl_disk_cacheable_query!(def_symbol_name, |_| true);
diff --git a/src/librustc/ty/maps/on_disk_cache.rs b/src/librustc/ty/maps/on_disk_cache.rs
index 8dc9b0877a0..079b518efd8 100644
--- a/src/librustc/ty/maps/on_disk_cache.rs
+++ b/src/librustc/ty/maps/on_disk_cache.rs
@@ -207,6 +207,16 @@ impl<'sess> OnDiskCache<'sess> {
 
             // Encode TypeckTables
             encode_query_results::<typeck_tables_of, _>(tcx, enc, qri)?;
+            encode_query_results::<optimized_mir, _>(tcx, enc, qri)?;
+            encode_query_results::<unsafety_check_result, _>(tcx, enc, qri)?;
+            encode_query_results::<borrowck, _>(tcx, enc, qri)?;
+            encode_query_results::<mir_borrowck, _>(tcx, enc, qri)?;
+            encode_query_results::<mir_const_qualif, _>(tcx, enc, qri)?;
+            encode_query_results::<def_symbol_name, _>(tcx, enc, qri)?;
+            encode_query_results::<const_is_rvalue_promotable_to_static, _>(tcx, enc, qri)?;
+            encode_query_results::<contains_extern_indicator, _>(tcx, enc, qri)?;
+            encode_query_results::<symbol_name, _>(tcx, enc, qri)?;
+            encode_query_results::<trans_fulfill_obligation, _>(tcx, enc, qri)?;
         }
 
         // Encode diagnostics
diff --git a/src/librustc/ty/maps/plumbing.rs b/src/librustc/ty/maps/plumbing.rs
index fdaa13e7fd1..ec6d190b8bd 100644
--- a/src/librustc/ty/maps/plumbing.rs
+++ b/src/librustc/ty/maps/plumbing.rs
@@ -974,4 +974,7 @@ impl_load_from_cache!(
     BorrowCheck => borrowck,
     MirBorrowCheck => mir_borrowck,
     MirConstQualif => mir_const_qualif,
+    SymbolName => def_symbol_name,
+    ConstIsRvaluePromotableToStatic => const_is_rvalue_promotable_to_static,
+    ContainsExternIndicator => contains_extern_indicator,
 );
diff --git a/src/librustc_metadata/astencode.rs b/src/librustc_metadata/astencode.rs
index 722d0cad238..71b15643cbc 100644
--- a/src/librustc_metadata/astencode.rs
+++ b/src/librustc_metadata/astencode.rs
@@ -47,9 +47,7 @@ impl<'a, 'b, 'tcx> IsolatedEncoder<'a, 'b, 'tcx> {
             let mut hasher = StableHasher::new();
 
             hcx.while_hashing_hir_bodies(true, |hcx| {
-                hcx.while_hashing_spans(false, |hcx| {
-                    body.hash_stable(hcx, &mut hasher);
-                });
+                body.hash_stable(hcx, &mut hasher);
             });
 
             hasher.finish()
diff --git a/src/librustc_metadata/decoder.rs b/src/librustc_metadata/decoder.rs
index eb2bcfc93c5..3be99e97223 100644
--- a/src/librustc_metadata/decoder.rs
+++ b/src/librustc_metadata/decoder.rs
@@ -273,25 +273,23 @@ impl<'a, 'tcx> SpecializedDecoder<Span> for DecodeContext<'a, 'tcx> {
         let lo = BytePos::decode(self)?;
         let hi = BytePos::decode(self)?;
 
+        if lo == BytePos(0) && hi == BytePos(0) {
+            // Don't try to rebase DUMMY_SP. Otherwise it will look like a valid
+            // Span again.
+            return Ok(DUMMY_SP)
+        }
+
+        if hi < lo {
+            // Consistently map invalid spans to DUMMY_SP.
+            return Ok(DUMMY_SP)
+        }
+
         let sess = if let Some(sess) = self.sess {
             sess
         } else {
             bug!("Cannot decode Span without Session.")
         };
 
-        let (lo, hi) = if lo > hi {
-            // Currently macro expansion sometimes produces invalid Span values
-            // where lo > hi. In order not to crash the compiler when trying to
-            // translate these values, let's transform them into something we
-            // can handle (and which will produce useful debug locations at
-            // least some of the time).
-            // This workaround is only necessary as long as macro expansion is
-            // not fixed. FIXME(#23480)
-            (lo, lo)
-        } else {
-            (lo, hi)
-        };
-
         let imported_filemaps = self.cdata().imported_filemaps(&sess.codemap());
         let filemap = {
             // Optimize for the case that most spans within a translated item
@@ -321,6 +319,16 @@ impl<'a, 'tcx> SpecializedDecoder<Span> for DecodeContext<'a, 'tcx> {
             }
         };
 
+        // Make sure our binary search above is correct.
+        debug_assert!(lo >= filemap.original_start_pos &&
+                      lo <= filemap.original_end_pos);
+
+        if hi < filemap.original_start_pos || hi > filemap.original_end_pos {
+            // `hi` points to a different FileMap than `lo` which is invalid.
+            // Again, map invalid Spans to DUMMY_SP.
+            return Ok(DUMMY_SP)
+        }
+
         let lo = (lo + filemap.translated_filemap.start_pos) - filemap.original_start_pos;
         let hi = (hi + filemap.translated_filemap.start_pos) - filemap.original_start_pos;
 
diff --git a/src/librustc_trans/consts.rs b/src/librustc_trans/consts.rs
index cfca3b57cb9..800c7733c3d 100644
--- a/src/librustc_trans/consts.rs
+++ b/src/librustc_trans/consts.rs
@@ -74,7 +74,7 @@ pub fn addr_of_mut(ccx: &CrateContext,
         });
         llvm::LLVMSetInitializer(gv, cv);
         set_global_alignment(ccx, gv, align);
-        llvm::LLVMRustSetLinkage(gv, llvm::Linkage::InternalLinkage);
+        llvm::LLVMRustSetLinkage(gv, llvm::Linkage::PrivateLinkage);
         SetUnnamedAddr(gv, true);
         gv
     }
diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs
index be7bd3d5510..fbff6e83fb9 100644
--- a/src/librustdoc/clean/mod.rs
+++ b/src/librustdoc/clean/mod.rs
@@ -2521,7 +2521,7 @@ pub struct Span {
 }
 
 impl Span {
-    fn empty() -> Span {
+    pub fn empty() -> Span {
         Span {
             filename: "".to_string(),
             loline: 0, locol: 0,
diff --git a/src/librustdoc/html/layout.rs b/src/librustdoc/html/layout.rs
index 8c14d1bbe8f..61de5f4bc4c 100644
--- a/src/librustdoc/html/layout.rs
+++ b/src/librustdoc/html/layout.rs
@@ -65,6 +65,7 @@ r##"<!DOCTYPE html>
     {before_content}
 
     <nav class="sidebar">
+        <div class="sidebar-menu">&#9776;</div>
         {logo}
         {sidebar}
     </nav>
diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs
index 9dc01bb0916..d423e53ca18 100644
--- a/src/librustdoc/html/render.rs
+++ b/src/librustdoc/html/render.rs
@@ -421,9 +421,19 @@ impl ToJson for IndexItemFunctionType {
 thread_local!(static CACHE_KEY: RefCell<Arc<Cache>> = Default::default());
 thread_local!(pub static CURRENT_LOCATION_KEY: RefCell<Vec<String>> =
                     RefCell::new(Vec::new()));
-thread_local!(static USED_ID_MAP: RefCell<FxHashMap<String, usize>> =
+thread_local!(pub static USED_ID_MAP: RefCell<FxHashMap<String, usize>> =
                     RefCell::new(init_ids()));
 
+pub fn render_text<F: FnMut(RenderType) -> String>(mut render: F) -> (String, String) {
+    // Save the state of USED_ID_MAP so it only gets updated once even
+    // though we're rendering twice.
+    let orig_used_id_map = USED_ID_MAP.with(|map| map.borrow().clone());
+    let hoedown_output = render(RenderType::Hoedown);
+    USED_ID_MAP.with(|map| *map.borrow_mut() = orig_used_id_map);
+    let pulldown_output = render(RenderType::Pulldown);
+    (hoedown_output, pulldown_output)
+}
+
 fn init_ids() -> FxHashMap<String, usize> {
     [
      "main",
@@ -699,7 +709,10 @@ fn print_message(msg: &str, intro_msg: &mut bool, span: &Span, text: &str) {
     println!("{}", msg);
 }
 
-fn render_difference(diff: &html_diff::Difference, intro_msg: &mut bool, span: &Span, text: &str) {
+pub fn render_difference(diff: &html_diff::Difference,
+                         intro_msg: &mut bool,
+                         span: &Span,
+                         text: &str) {
     match *diff {
         html_diff::Difference::NodeType { ref elem, ref opposite_elem } => {
             print_message(&format!("    {} Types differ: expected: `{}`, found: `{}`",
@@ -1853,12 +1866,7 @@ fn render_markdown(w: &mut fmt::Formatter,
                    prefix: &str,
                    scx: &SharedContext)
                    -> fmt::Result {
-    // Save the state of USED_ID_MAP so it only gets updated once even
-    // though we're rendering twice.
-    let orig_used_id_map = USED_ID_MAP.with(|map| map.borrow().clone());
-    let hoedown_output = format!("{}", Markdown(md_text, RenderType::Hoedown));
-    USED_ID_MAP.with(|map| *map.borrow_mut() = orig_used_id_map);
-    let pulldown_output = format!("{}", Markdown(md_text, RenderType::Pulldown));
+    let (hoedown_output, pulldown_output) = render_text(|ty| format!("{}", Markdown(md_text, ty)));
     let mut differences = html_diff::get_differences(&pulldown_output, &hoedown_output);
     differences.retain(|s| {
         match *s {
@@ -3542,6 +3550,7 @@ impl<'a> fmt::Display for Sidebar<'a> {
         let cx = self.cx;
         let it = self.item;
         let parentlen = cx.current.len() - if it.is_mod() {1} else {0};
+        let mut should_close = false;
 
         if it.is_struct() || it.is_trait() || it.is_primitive() || it.is_union()
             || it.is_enum() || it.is_mod() || it.is_typedef()
@@ -3575,6 +3584,8 @@ impl<'a> fmt::Display for Sidebar<'a> {
                 }
             }
 
+            write!(fmt, "<div class=\"sidebar-elems\">")?;
+            should_close = true;
             match it.inner {
                 clean::StructItem(ref s) => sidebar_struct(fmt, it, s)?,
                 clean::TraitItem(ref t) => sidebar_trait(fmt, it, t)?,
@@ -3625,6 +3636,10 @@ impl<'a> fmt::Display for Sidebar<'a> {
             write!(fmt, "<script defer src=\"{path}sidebar-items.js\"></script>",
                    path = relpath)?;
         }
+        if should_close {
+            // Closes sidebar-elems div.
+            write!(fmt, "</div>")?;
+        }
 
         Ok(())
     }
diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js
index bdd7b7dd0b7..06e9cbbdf9a 100644
--- a/src/librustdoc/html/static/main.js
+++ b/src/librustdoc/html/static/main.js
@@ -106,6 +106,30 @@
         return (elem.offsetParent === null)
     }
 
+    function showSidebar() {
+        var elems = document.getElementsByClassName("sidebar-elems")[0];
+        if (elems) {
+            elems.style.display = "block";
+        }
+        var sidebar = document.getElementsByClassName('sidebar')[0];
+        sidebar.style.position = 'fixed';
+        sidebar.style.width = '100%';
+        sidebar.style.marginLeft = '0';
+        document.getElementsByTagName("body")[0].style.marginTop = '45px';
+    }
+
+    function hideSidebar() {
+        var elems = document.getElementsByClassName("sidebar-elems")[0];
+        if (elems) {
+            elems.style.display = "";
+        }
+        var sidebar = document.getElementsByClassName('sidebar')[0];
+        sidebar.style.position = '';
+        sidebar.style.width = '';
+        sidebar.style.marginLeft = '';
+        document.getElementsByTagName("body")[0].style.marginTop = '';
+    }
+
     // used for special search precedence
     var TY_PRIMITIVE = itemTypes.indexOf("primitive");
 
@@ -130,6 +154,8 @@
     }
 
     function highlightSourceLines(ev) {
+        // If we're in mobile mode, we should add the sidebar in any case.
+        hideSidebar();
         var search = document.getElementById("search");
         var i, from, to, match = window.location.hash.match(/^#?(\d+)(?:-(\d+))?$/);
         if (match) {
@@ -1459,7 +1485,7 @@
 
     // delayed sidebar rendering.
     function initSidebarItems(items) {
-        var sidebar = document.getElementsByClassName('sidebar')[0];
+        var sidebar = document.getElementsByClassName('sidebar-elems')[0];
         var current = window.sidebarCurrent;
 
         function block(shortty, longty) {
@@ -1829,6 +1855,22 @@
         removeClass(search, "hidden");
         search.innerHTML = '<h3 style="text-align: center;">Loading search results...</h3>';
     }
+
+    var sidebar_menu = document.getElementsByClassName("sidebar-menu")[0];
+    if (sidebar_menu) {
+        sidebar_menu.onclick = function() {
+            var sidebar = document.getElementsByClassName('sidebar')[0];
+            if (sidebar.style.position === "fixed") {
+                hideSidebar();
+            } else {
+                showSidebar();
+            }
+        };
+    }
+
+    window.onresize = function() {
+        hideSidebar();
+    };
 }());
 
 // Sets the focus on the search bar at the top of the page
diff --git a/src/librustdoc/html/static/rustdoc.css b/src/librustdoc/html/static/rustdoc.css
index f32252b726c..99a0f8c3fb1 100644
--- a/src/librustdoc/html/static/rustdoc.css
+++ b/src/librustdoc/html/static/rustdoc.css
@@ -208,7 +208,7 @@ nav.sub {
 .sidebar .version {
 	font-size: 15px;
 	text-align: center;
-	border-bottom: #DDDDDD 1px solid;
+	border-bottom: 1px solid;
 	overflow-wrap: break-word;
 	word-wrap: break-word; /* deprecated */
 	word-break: break-word; /* Chrome, non-standard */
@@ -247,8 +247,8 @@ nav.sub {
 }
 
 .sidebar-title {
-	border-top: 1px solid #777;
-	border-bottom: 1px solid #777;
+	border-top: 1px solid;
+	border-bottom: 1px solid;
 	text-align: center;
 	font-size: 17px;
 	margin-bottom: 5px;
@@ -263,6 +263,10 @@ nav.sub {
 	width: 100%;
 }
 
+.sidebar-menu {
+	display: none;
+}
+
 .content {
 	padding: 15px 0;
 }
@@ -364,7 +368,6 @@ h4 > code, h3 > code, .invisible > code {
 }
 
 .invisible {
-	background: rgba(0, 0, 0, 0);
 	width: 100%;
 	display: inline-block;
 }
@@ -444,7 +447,6 @@ h4 > code, h3 > code, .invisible > code {
 .content .fn .where,
 .content .where.fmt-newline {
 	display: block;
-	color: #4E4C4C;
 	font-size: 0.8em;
 }
 
@@ -538,7 +540,6 @@ a {
 }
 
 .search-input:focus {
-	border-color: #66afe9;
 	border-radius: 2px;
 	border: 0;
 	outline: 0;
@@ -560,7 +561,8 @@ a {
 .content .search-results td:first-child a { padding-right: 10px; }
 
 tr.result span.primitive::after {
-	content: ' (primitive type)'; font-style: italic; color: black;
+	content: ' (primitive type)';
+	font-style: italic;
 }
 
 body.blur > :not(#help) {
@@ -697,7 +699,6 @@ a.test-arrow:hover{
 	font-weight: 300;
 	position: absolute;
 	left: -23px;
-	color: #999;
 	top: 0;
 }
 
@@ -823,7 +824,7 @@ span.since {
 		position: static;
 	}
 
-	.sidebar .location {
+	.sidebar > .location {
 		float: right;
 		margin: 0px;
 		margin-top: 2px;
@@ -843,16 +844,33 @@ span.since {
 		margin-top: 5px;
 		margin-bottom: 5px;
 		float: left;
+		margin-left: 50px;
 	}
 
-	nav.sub {
-		margin: 0 auto;
+	.sidebar-menu {
+		position: absolute;
+		font-size: 2rem;
+		cursor: pointer;
+		margin-top: 2px;
+		display: block;
 	}
 
-	.sidebar .block {
+	.sidebar-elems {
+		background-color: #F1F1F1;
+		position: fixed;
+		z-index: 1;
+		left: 0;
+		top: 45px;
+		bottom: 0;
+		overflow-y: auto;
+		border-right: 1px solid #000;
 		display: none;
 	}
 
+	nav.sub {
+		margin: 0 auto;
+	}
+
 	.content {
 		margin-left: 0px;
 	}
@@ -904,8 +922,6 @@ span.since {
 .tooltip .tooltiptext {
 	width: 120px;
 	display: none;
-	background-color: black;
-	color: #fff;
 	text-align: center;
 	padding: 5px 3px;
 	border-radius: 6px;
@@ -927,13 +943,10 @@ span.since {
 	margin-top: -5px;
 	border-width: 5px;
 	border-style: solid;
-	border-color: transparent black transparent transparent;
 }
 
 .important-traits .tooltip .tooltiptext {
-	background-color: white;
-	color: black;
-	border: 1px solid #000;
+	border: 1px solid;
 }
 
 pre.rust {
@@ -953,22 +966,21 @@ pre.rust {
 	float: left;
 	width: 33.3%;
 	text-align: center;
-	border-bottom: 1px solid #ccc;
+	border-bottom: 1px solid;
 	font-size: 18px;
 	cursor: pointer;
 }
 
 #titles > div.selected {
-	border-bottom: 3px solid #0078ee;
+	border-bottom: 3px solid;
 }
 
 #titles > div:hover {
-	border-bottom: 3px solid #0089ff;
+	border-bottom: 3px solid;
 }
 
 #titles > div > div.count {
 	display: inline-block;
-	color: #888;
 	font-size: 16px;
 }
 
@@ -983,11 +995,18 @@ h4 > .important-traits {
 	top: 2px;
 }
 
+@media (max-width: 700px) {
+	h4 > .important-traits {
+		position: absolute;
+		left: -22px;
+		top: 24px;
+	}
+}
+
 .modal {
 	position: fixed;
 	width: 100vw;
 	height: 100vh;
-	background-color: rgba(0,0,0,0.3);
 	z-index: 10000;
 	top: 0;
 	left: 0;
@@ -997,13 +1016,12 @@ h4 > .important-traits {
 	display: block;
 	max-width: 60%;
 	min-width: 200px;
-	background-color: #eee;
 	padding: 8px;
 	top: 40%;
 	position: absolute;
 	left: 50%;
 	transform: translate(-50%, -40%);
-	border: 1px solid #999;
+	border: 1px solid;
 	border-radius: 4px;
 	border-top-right-radius: 0;
 }
@@ -1030,35 +1048,24 @@ h3.important {
 	right: -25px;
 	top: -1px;
 	font-size: 18px;
-	background-color: #eee;
 	width: 25px;
 	padding-right: 2px;
 	border-top-right-radius: 5px;
 	border-bottom-right-radius: 5px;
 	text-align: center;
-	border: 1px solid #999;
+	border: 1px solid;
 	border-right: 0;
 	cursor: pointer;
 }
 
-.modal-content > .close:hover {
-	background-color: #ff1f1f;
-	color: white;
-}
-
 .modal-content > .whiter {
 	height: 25px;
 	position: absolute;
 	width: 3px;
-	background-color: #eee;
 	right: -2px;
 	top: 0px;
 }
 
-.modal-content > .close:hover + .whiter {
-	background-color: #ff1f1f;
-}
-
 #main > div.important-traits {
 	position: absolute;
 	left: -24px;
@@ -1069,4 +1076,4 @@ h3.important {
 	position: absolute;
 	left: -42px;
 	margin-top: 2px;
-}
\ No newline at end of file
+}
diff --git a/src/librustdoc/html/static/styles/main.css b/src/librustdoc/html/static/styles/main.css
index cb19034bf06..5cace837a55 100644
--- a/src/librustdoc/html/static/styles/main.css
+++ b/src/librustdoc/html/static/styles/main.css
@@ -31,6 +31,10 @@ h2, h3:not(.impl):not(.method):not(.type):not(.tymethod), h4:not(.method):not(.t
 	background-color: white;
 }
 
+.invisible {
+	background: rgba(0, 0, 0, 0);
+}
+
 .docblock code, .docblock-short code {
 	background-color: #F5F5F5;
 }
@@ -56,6 +60,15 @@ pre {
 	color: #333;
 }
 
+.sidebar .version {
+	border-bottom-color: #DDD;
+}
+
+.sidebar-title {
+	border-top-color: #777;
+	border-bottom-color: #777;
+}
+
 .block a:hover {
 	background: #F5F5F5;
 }
@@ -89,6 +102,12 @@ pre {
 	background: #FDFFD3;
 }
 
+.content .method .where,
+.content .fn .where,
+.content .where.fmt-newline {
+	color: #4E4C4C;
+}
+
 .content .highlighted {
 	color: #000 !important;
 	background-color: #ccc;
@@ -152,12 +171,20 @@ a.test-arrow {
 	color: #f5f5f5;
 }
 
+.collapse-toggle {
+	color: #999;
+}
+
 .search-input {
 	color: #555;
 	box-shadow: 0 0 0 1px #e0e0e0, 0 0 0 2px transparent;
 	background-color: white;
 }
 
+.search-input:focus {
+	border-color: #66afe9;
+}
+
 .stab.unstable { background: #FFF5D6; border-color: #FFC600; }
 .stab.deprecated { background: #F3DFFF; border-color: #7F0087; }
 .stab.portability { background: #C4ECFF; border-color: #7BA5DB; }
@@ -176,6 +203,10 @@ a.test-arrow {
 	color: grey;
 }
 
+tr.result span.primitive::after {
+	color: black;
+}
+
 .line-numbers :target { background-color: transparent; }
 
 /* Code highlighting */
@@ -241,3 +272,61 @@ pre.ignore:hover, .information:hover + pre.ignore {
 .search-failed > a {
 	color: #0089ff;
 }
+
+.tooltip .tooltiptext {
+	background-color: black;
+	color: #fff;
+}
+
+.tooltip .tooltiptext::after {
+	border-color: transparent black transparent transparent;
+}
+
+.important-traits .tooltip .tooltiptext {
+	background-color: white;
+	color: black;
+	border-color: black;
+}
+
+#titles > div {
+	border-bottom-color:  #ccc;
+}
+
+#titles > div.selected {
+	border-bottom-color: #0078ee;
+}
+
+#titles > div:hover {
+	border-bottom-color: #0089ff;
+}
+
+#titles > div > div.count {
+	color: #888;
+}
+
+.modal {
+	background-color: rgba(0,0,0,0.3);
+}
+
+.modal-content {
+	background-color: #eee;
+	border-color: #999;
+}
+
+.modal-content > .close {
+	background-color: #eee;
+	border-color: #999;
+}
+
+.modal-content > .close:hover {
+	background-color: #ff1f1f;
+	color: white;
+}
+
+.modal-content > .whiter {
+	background-color: #eee;
+}
+
+.modal-content > .close:hover + .whiter {
+	background-color: #ff1f1f;
+}
diff --git a/src/librustdoc/markdown.rs b/src/librustdoc/markdown.rs
index fe6bd985bb6..9b94e9918f8 100644
--- a/src/librustdoc/markdown.rs
+++ b/src/librustdoc/markdown.rs
@@ -19,10 +19,15 @@ use rustc::session::search_paths::SearchPaths;
 use rustc::session::config::Externs;
 use syntax::codemap::DUMMY_SP;
 
+use clean::Span;
+
 use externalfiles::{ExternalHtml, LoadStringError, load_string};
 
-use html::render::reset_ids;
+use html_diff;
+
+use html::render::{render_text, reset_ids};
 use html::escape::Escape;
+use html::render::render_difference;
 use html::markdown;
 use html::markdown::{Markdown, MarkdownWithToc, find_testable_code, old_find_testable_code};
 use html::markdown::RenderType;
@@ -52,6 +57,10 @@ fn extract_leading_metadata<'a>(s: &'a str) -> (Vec<&'a str>, &'a str) {
 pub fn render(input: &str, mut output: PathBuf, matches: &getopts::Matches,
               external_html: &ExternalHtml, include_toc: bool,
               render_type: RenderType) -> isize {
+    // Span used for markdown hoedown/pulldown differences.
+    let mut span = Span::empty();
+    span.filename = input.to_owned();
+
     let input_p = Path::new(input);
     output.push(input_p.file_stem().unwrap());
     output.set_extension("html");
@@ -89,12 +98,36 @@ pub fn render(input: &str, mut output: PathBuf, matches: &getopts::Matches,
 
     reset_ids(false);
 
-    let rendered = if include_toc {
-        format!("{}", MarkdownWithToc(text, render_type))
+    let (hoedown_output, pulldown_output) = if include_toc {
+        // Save the state of USED_ID_MAP so it only gets updated once even
+        // though we're rendering twice.
+        render_text(|ty| format!("{}", MarkdownWithToc(text, ty)))
     } else {
-        format!("{}", Markdown(text, render_type))
+        // Save the state of USED_ID_MAP so it only gets updated once even
+        // though we're rendering twice.
+        render_text(|ty| format!("{}", Markdown(text, ty)))
     };
 
+    let mut differences = html_diff::get_differences(&pulldown_output, &hoedown_output);
+    differences.retain(|s| {
+        match *s {
+            html_diff::Difference::NodeText { ref elem_text,
+                                              ref opposite_elem_text,
+                                              .. }
+                if elem_text.split_whitespace().eq(opposite_elem_text.split_whitespace()) => {
+                    false
+            }
+            _ => true,
+        }
+    });
+
+    if !differences.is_empty() {
+        let mut intro_msg = false;
+        for diff in differences {
+            render_difference(&diff, &mut intro_msg, &span, text);
+        }
+    }
+
     let err = write!(
         &mut out,
         r#"<!DOCTYPE html>
@@ -126,16 +159,16 @@ pub fn render(input: &str, mut output: PathBuf, matches: &getopts::Matches,
         css = css,
         in_header = external_html.in_header,
         before_content = external_html.before_content,
-        text = rendered,
+        text = if render_type == RenderType::Pulldown { pulldown_output } else { hoedown_output },
         after_content = external_html.after_content,
-        );
+    );
 
     match err {
         Err(e) => {
             eprintln!("rustdoc: cannot write to `{}`: {}", output.display(), e);
             6
         }
-        Ok(_) => 0
+        Ok(_) => 0,
     }
 }
 
diff --git a/src/libstd/fs.rs b/src/libstd/fs.rs
index b07733d3c80..f40aed2478a 100644
--- a/src/libstd/fs.rs
+++ b/src/libstd/fs.rs
@@ -211,6 +211,115 @@ pub struct DirBuilder {
     recursive: bool,
 }
 
+/// Read the entire contents of a file into a bytes vector.
+///
+/// This is a convenience function for using [`File::open`] and [`read_to_end`]
+/// with fewer imports and without an intermediate variable.
+///
+/// [`File::open`]: struct.File.html#method.open
+/// [`read_to_end`]: ../io/trait.Read.html#method.read_to_end
+///
+/// # Errors
+///
+/// This function will return an error if `path` does not already exist.
+/// Other errors may also be returned according to [`OpenOptions::open`].
+///
+/// [`OpenOptions::open`]: struct.OpenOptions.html#method.open
+///
+/// It will also return an error if it encounters while reading an error
+/// of a kind other than [`ErrorKind::Interrupted`].
+///
+/// [`ErrorKind::Interrupted`]: ../../std/io/enum.ErrorKind.html#variant.Interrupted
+///
+/// # Examples
+///
+/// ```no_run
+/// #![feature(fs_read_write)]
+///
+/// use std::fs;
+/// use std::net::SocketAddr;
+///
+/// # fn foo() -> Result<(), Box<std::error::Error + 'static>> {
+/// let foo: SocketAddr = String::from_utf8_lossy(&fs::read("address.txt")?).parse()?;
+/// # Ok(())
+/// # }
+/// ```
+#[unstable(feature = "fs_read_write", issue = "46588")]
+pub fn read<P: AsRef<Path>>(path: P) -> io::Result<Vec<u8>> {
+    let mut bytes = Vec::new();
+    File::open(path)?.read_to_end(&mut bytes)?;
+    Ok(bytes)
+}
+
+/// Read the entire contents of a file into a string.
+///
+/// This is a convenience function for using [`File::open`] and [`read_to_string`]
+/// with fewer imports and without an intermediate variable.
+///
+/// [`File::open`]: struct.File.html#method.open
+/// [`read_to_string`]: ../io/trait.Read.html#method.read_to_string
+///
+/// # Errors
+///
+/// This function will return an error if `path` does not already exist.
+/// Other errors may also be returned according to [`OpenOptions::open`].
+///
+/// [`OpenOptions::open`]: struct.OpenOptions.html#method.open
+///
+/// It will also return an error if it encounters while reading an error
+/// of a kind other than [`ErrorKind::Interrupted`],
+/// or if the contents of the file are not valid UTF-8.
+///
+/// [`ErrorKind::Interrupted`]: ../../std/io/enum.ErrorKind.html#variant.Interrupted
+///
+/// # Examples
+///
+/// ```no_run
+/// #![feature(fs_read_write)]
+///
+/// use std::fs;
+/// use std::net::SocketAddr;
+///
+/// # fn foo() -> Result<(), Box<std::error::Error + 'static>> {
+/// let foo: SocketAddr = fs::read_string("address.txt")?.parse()?;
+/// # Ok(())
+/// # }
+/// ```
+#[unstable(feature = "fs_read_write", issue = "46588")]
+pub fn read_string<P: AsRef<Path>>(path: P) -> io::Result<String> {
+    let mut string = String::new();
+    File::open(path)?.read_to_string(&mut string)?;
+    Ok(string)
+}
+
+/// Write a slice as the entire contents of a file.
+///
+/// This function will create a file if it does not exist,
+/// and will entirely replace its contents if it does.
+///
+/// This is a convenience function for using [`File::create`] and [`write_all`]
+/// with fewer imports.
+///
+/// [`File::create`]: struct.File.html#method.create
+/// [`write_all`]: ../io/trait.Write.html#method.write_all
+///
+/// # Examples
+///
+/// ```no_run
+/// #![feature(fs_read_write)]
+///
+/// use std::fs;
+///
+/// # fn foo() -> std::io::Result<()> {
+/// fs::write("foo.txt", b"Lorem ipsum")?;
+/// # Ok(())
+/// # }
+/// ```
+#[unstable(feature = "fs_read_write", issue = "46588")]
+pub fn write<P: AsRef<Path>, C: AsRef<[u8]>>(path: P, contents: C) -> io::Result<()> {
+    File::create(path)?.write_all(contents.as_ref())
+}
+
 impl File {
     /// Attempts to open a file in read-only mode.
     ///
@@ -1912,7 +2021,9 @@ mod tests {
     ) }
 
     #[cfg(unix)]
-    macro_rules! error { ($e:expr, $s:expr) => (
+    macro_rules! error { ($e:expr, $s:expr) => ( error_contains!($e, $s) ) }
+
+    macro_rules! error_contains { ($e:expr, $s:expr) => (
         match $e {
             Ok(_) => panic!("Unexpected success. Should've been: {:?}", $s),
             Err(ref err) => assert!(err.to_string().contains($s),
@@ -2922,6 +3033,27 @@ mod tests {
     }
 
     #[test]
+    fn write_then_read() {
+        let mut bytes = [0; 1024];
+        StdRng::new().unwrap().fill_bytes(&mut bytes);
+
+        let tmpdir = tmpdir();
+
+        check!(fs::write(&tmpdir.join("test"), &bytes[..]));
+        let v = check!(fs::read(&tmpdir.join("test")));
+        assert!(v == &bytes[..]);
+
+        check!(fs::write(&tmpdir.join("not-utf8"), &[0xFF]));
+        error_contains!(fs::read_string(&tmpdir.join("not-utf8")),
+                        "stream did not contain valid UTF-8");
+
+        let s = "𐁁𐀓𐀠𐀴𐀍";
+        check!(fs::write(&tmpdir.join("utf8"), s.as_bytes()));
+        let string = check!(fs::read_string(&tmpdir.join("utf8")));
+        assert_eq!(string, s);
+    }
+
+    #[test]
     fn file_try_clone() {
         let tmpdir = tmpdir();
 
diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs
index bf177ac7f2c..12e6231136e 100644
--- a/src/libstd/lib.rs
+++ b/src/libstd/lib.rs
@@ -260,6 +260,7 @@
 #![feature(core_intrinsics)]
 #![feature(dropck_eyepatch)]
 #![feature(exact_size_is_empty)]
+#![feature(fs_read_write)]
 #![feature(fixed_size_array)]
 #![feature(float_from_str_radix)]
 #![feature(fn_traits)]
diff --git a/src/libstd/macros.rs b/src/libstd/macros.rs
index b36473d9b75..de46fedaebb 100644
--- a/src/libstd/macros.rs
+++ b/src/libstd/macros.rs
@@ -631,7 +631,7 @@ pub mod builtin {
     #[macro_export]
     macro_rules! module_path { () => ({ /* compiler built-in */ }) }
 
-    /// Boolean evaluation of configuration flags.
+    /// Boolean evaluation of configuration flags, at compile-time.
     ///
     /// In addition to the `#[cfg]` attribute, this macro is provided to allow
     /// boolean expression evaluation of configuration flags. This frequently
diff --git a/src/rustllvm/PassWrapper.cpp b/src/rustllvm/PassWrapper.cpp
index 1797e19c549..072a9144f17 100644
--- a/src/rustllvm/PassWrapper.cpp
+++ b/src/rustllvm/PassWrapper.cpp
@@ -970,7 +970,7 @@ LLVMRustCreateThinLTOData(LLVMRustThinLTOModule *modules,
   std::set<GlobalValue::GUID> ExportedGUIDs;
   for (auto &List : Ret->Index) {
     for (auto &GVS: List.second) {
-      if (!GlobalValue::isExternalLinkage(GVS->linkage()))
+      if (GlobalValue::isLocalLinkage(GVS->linkage()))
         continue;
       auto GUID = GVS->getOriginalName();
       if (!DeadSymbols.count(GUID))
diff --git a/src/test/incremental/hashes/call_expressions.rs b/src/test/incremental/hashes/call_expressions.rs
index a62d84fedf3..da8a62a9765 100644
--- a/src/test/incremental/hashes/call_expressions.rs
+++ b/src/test/incremental/hashes/call_expressions.rs
@@ -18,7 +18,7 @@
 
 // must-compile-successfully
 // revisions: cfail1 cfail2 cfail3
-// compile-flags: -Z query-dep-graph
+// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans
 
 
 #![allow(warnings)]
diff --git a/src/test/incremental/hashes/closure_expressions.rs b/src/test/incremental/hashes/closure_expressions.rs
index 6cea9a0cb14..d8a87da5918 100644
--- a/src/test/incremental/hashes/closure_expressions.rs
+++ b/src/test/incremental/hashes/closure_expressions.rs
@@ -18,7 +18,7 @@
 
 // must-compile-successfully
 // revisions: cfail1 cfail2 cfail3
-// compile-flags: -Z query-dep-graph
+// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans
 
 #![allow(warnings)]
 #![feature(rustc_attrs)]
diff --git a/src/test/incremental/hashes/consts.rs b/src/test/incremental/hashes/consts.rs
index 496ae4276f8..47f5a2d2bbe 100644
--- a/src/test/incremental/hashes/consts.rs
+++ b/src/test/incremental/hashes/consts.rs
@@ -18,7 +18,7 @@
 
 // must-compile-successfully
 // revisions: cfail1 cfail2 cfail3
-// compile-flags: -Z query-dep-graph
+// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans
 
 #![allow(warnings)]
 #![feature(rustc_attrs)]
diff --git a/src/test/incremental/hashes/enum_constructors.rs b/src/test/incremental/hashes/enum_constructors.rs
index f38d1864630..541261f1d80 100644
--- a/src/test/incremental/hashes/enum_constructors.rs
+++ b/src/test/incremental/hashes/enum_constructors.rs
@@ -18,7 +18,7 @@
 
 // must-compile-successfully
 // revisions: cfail1 cfail2 cfail3
-// compile-flags: -Z query-dep-graph
+// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans
 
 #![allow(warnings)]
 #![feature(rustc_attrs)]
diff --git a/src/test/incremental/hashes/enum_defs.rs b/src/test/incremental/hashes/enum_defs.rs
index dbb7aca1924..02746785856 100644
--- a/src/test/incremental/hashes/enum_defs.rs
+++ b/src/test/incremental/hashes/enum_defs.rs
@@ -23,7 +23,7 @@
 
 // must-compile-successfully
 // revisions: cfail1 cfail2 cfail3
-// compile-flags: -Z query-dep-graph
+// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans
 
 #![allow(warnings)]
 #![feature(rustc_attrs)]
diff --git a/src/test/incremental/hashes/exported_vs_not.rs b/src/test/incremental/hashes/exported_vs_not.rs
index 985c064f6a0..a796c87f19b 100644
--- a/src/test/incremental/hashes/exported_vs_not.rs
+++ b/src/test/incremental/hashes/exported_vs_not.rs
@@ -10,7 +10,7 @@
 
 // must-compile-successfully
 // revisions: cfail1 cfail2 cfail3
-// compile-flags: -Z query-dep-graph
+// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans
 
 #![allow(warnings)]
 #![feature(rustc_attrs)]
diff --git a/src/test/incremental/hashes/extern_mods.rs b/src/test/incremental/hashes/extern_mods.rs
index 7ccb452b7ed..bcdd5661e71 100644
--- a/src/test/incremental/hashes/extern_mods.rs
+++ b/src/test/incremental/hashes/extern_mods.rs
@@ -18,7 +18,7 @@
 
 // must-compile-successfully
 // revisions: cfail1 cfail2 cfail3
-// compile-flags: -Z query-dep-graph
+// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans
 
 #![allow(warnings)]
 #![feature(rustc_attrs)]
diff --git a/src/test/incremental/hashes/for_loops.rs b/src/test/incremental/hashes/for_loops.rs
index a9b9602c3b1..105afd30d28 100644
--- a/src/test/incremental/hashes/for_loops.rs
+++ b/src/test/incremental/hashes/for_loops.rs
@@ -18,7 +18,7 @@
 
 // must-compile-successfully
 // revisions: cfail1 cfail2 cfail3
-// compile-flags: -Z query-dep-graph
+// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans
 
 #![allow(warnings)]
 #![feature(rustc_attrs)]
diff --git a/src/test/incremental/hashes/function_interfaces.rs b/src/test/incremental/hashes/function_interfaces.rs
index 952256a65bd..abe0586efcd 100644
--- a/src/test/incremental/hashes/function_interfaces.rs
+++ b/src/test/incremental/hashes/function_interfaces.rs
@@ -18,7 +18,7 @@
 
 // must-compile-successfully
 // revisions: cfail1 cfail2 cfail3
-// compile-flags: -Z query-dep-graph
+// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans
 
 
 #![allow(warnings)]
diff --git a/src/test/incremental/hashes/if_expressions.rs b/src/test/incremental/hashes/if_expressions.rs
index d6878028cfa..426c58c834d 100644
--- a/src/test/incremental/hashes/if_expressions.rs
+++ b/src/test/incremental/hashes/if_expressions.rs
@@ -18,7 +18,7 @@
 
 // must-compile-successfully
 // revisions: cfail1 cfail2 cfail3
-// compile-flags: -Z query-dep-graph
+// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans
 
 
 #![allow(warnings)]
diff --git a/src/test/incremental/hashes/indexing_expressions.rs b/src/test/incremental/hashes/indexing_expressions.rs
index 715146146f1..e66e239b33c 100644
--- a/src/test/incremental/hashes/indexing_expressions.rs
+++ b/src/test/incremental/hashes/indexing_expressions.rs
@@ -18,7 +18,7 @@
 
 // must-compile-successfully
 // revisions: cfail1 cfail2 cfail3
-// compile-flags: -Z query-dep-graph
+// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans
 
 #![allow(warnings)]
 #![feature(rustc_attrs)]
diff --git a/src/test/incremental/hashes/inherent_impls.rs b/src/test/incremental/hashes/inherent_impls.rs
index c8c2fa5e8c8..93aba4a3ee1 100644
--- a/src/test/incremental/hashes/inherent_impls.rs
+++ b/src/test/incremental/hashes/inherent_impls.rs
@@ -18,7 +18,7 @@
 
 // must-compile-successfully
 // revisions: cfail1 cfail2 cfail3
-// compile-flags: -Z query-dep-graph
+// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans
 
 
 #![allow(warnings)]
diff --git a/src/test/incremental/hashes/inline_asm.rs b/src/test/incremental/hashes/inline_asm.rs
index 1d66d4ab9d3..b93a9656603 100644
--- a/src/test/incremental/hashes/inline_asm.rs
+++ b/src/test/incremental/hashes/inline_asm.rs
@@ -18,7 +18,7 @@
 
 // must-compile-successfully
 // revisions: cfail1 cfail2 cfail3
-// compile-flags: -Z query-dep-graph
+// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans
 
 #![allow(warnings)]
 #![feature(rustc_attrs)]
diff --git a/src/test/incremental/hashes/let_expressions.rs b/src/test/incremental/hashes/let_expressions.rs
index f3bddc66984..851b13c7055 100644
--- a/src/test/incremental/hashes/let_expressions.rs
+++ b/src/test/incremental/hashes/let_expressions.rs
@@ -18,7 +18,7 @@
 
 // must-compile-successfully
 // revisions: cfail1 cfail2 cfail3
-// compile-flags: -Z query-dep-graph
+// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans
 
 
 #![allow(warnings)]
diff --git a/src/test/incremental/hashes/loop_expressions.rs b/src/test/incremental/hashes/loop_expressions.rs
index 243dc9ee519..dcb937fd867 100644
--- a/src/test/incremental/hashes/loop_expressions.rs
+++ b/src/test/incremental/hashes/loop_expressions.rs
@@ -18,7 +18,7 @@
 
 // must-compile-successfully
 // revisions: cfail1 cfail2 cfail3
-// compile-flags: -Z query-dep-graph
+// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans
 
 #![allow(warnings)]
 #![feature(rustc_attrs)]
diff --git a/src/test/incremental/hashes/match_expressions.rs b/src/test/incremental/hashes/match_expressions.rs
index 38edd675cc6..263901f4025 100644
--- a/src/test/incremental/hashes/match_expressions.rs
+++ b/src/test/incremental/hashes/match_expressions.rs
@@ -18,7 +18,7 @@
 
 // must-compile-successfully
 // revisions: cfail1 cfail2 cfail3
-// compile-flags: -Z query-dep-graph
+// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans
 
 
 #![allow(warnings)]
diff --git a/src/test/incremental/hashes/panic_exprs.rs b/src/test/incremental/hashes/panic_exprs.rs
index c76c10f2ab4..2b6a140be32 100644
--- a/src/test/incremental/hashes/panic_exprs.rs
+++ b/src/test/incremental/hashes/panic_exprs.rs
@@ -28,155 +28,134 @@
 
 
 // Indexing expression ---------------------------------------------------------
-#[cfg(cfail1)]
-pub fn indexing(slice: &[u8]) -> u8 {
-    slice[100]
-}
-
-#[cfg(not(cfail1))]
 #[rustc_clean(cfg="cfail2", except="HirBody,MirValidated,MirOptimized")]
 #[rustc_clean(cfg="cfail3")]
 pub fn indexing(slice: &[u8]) -> u8 {
-    slice[100]
+    #[cfg(cfail1)]
+    {
+        slice[100]
+    }
+    #[cfg(not(cfail1))]
+    {
+        slice[100]
+    }
 }
 
 
 // Arithmetic overflow plus ----------------------------------------------------
-#[cfg(cfail1)]
-pub fn arithmetic_overflow_plus(val: i32) -> i32 {
-    val + 1
-}
-
-#[cfg(not(cfail1))]
 #[rustc_clean(cfg="cfail2", except="HirBody,MirValidated,MirOptimized")]
 #[rustc_clean(cfg="cfail3")]
 pub fn arithmetic_overflow_plus(val: i32) -> i32 {
-    val + 1
+    #[cfg(cfail1)]
+    {
+        val + 1
+    }
+    #[cfg(not(cfail1))]
+    {
+        val + 1
+    }
 }
 
 
 // Arithmetic overflow minus ----------------------------------------------------
-#[cfg(cfail1)]
-pub fn arithmetic_overflow_minus(val: i32) -> i32 {
-    val - 1
-}
-
-#[cfg(not(cfail1))]
 #[rustc_clean(cfg="cfail2", except="HirBody,MirValidated,MirOptimized")]
 #[rustc_clean(cfg="cfail3")]
 pub fn arithmetic_overflow_minus(val: i32) -> i32 {
-    val - 1
+    #[cfg(cfail1)]
+    {
+        val - 1
+    }
+    #[cfg(not(cfail1))]
+    {
+        val - 1
+    }
 }
 
 
 // Arithmetic overflow mult ----------------------------------------------------
-#[cfg(cfail1)]
-pub fn arithmetic_overflow_mult(val: i32) -> i32 {
-    val * 2
-}
-
-#[cfg(not(cfail1))]
 #[rustc_clean(cfg="cfail2", except="HirBody,MirValidated,MirOptimized")]
 #[rustc_clean(cfg="cfail3")]
 pub fn arithmetic_overflow_mult(val: i32) -> i32 {
-    val * 2
+    #[cfg(cfail1)]
+    {
+        val * 2
+    }
+    #[cfg(not(cfail1))]
+    {
+        val * 2
+    }
 }
 
 
 // Arithmetic overflow negation ------------------------------------------------
-#[cfg(cfail1)]
-pub fn arithmetic_overflow_negation(val: i32) -> i32 {
-    -val
-}
-
-#[cfg(not(cfail1))]
 #[rustc_clean(cfg="cfail2", except="HirBody,MirValidated,MirOptimized")]
 #[rustc_clean(cfg="cfail3")]
 pub fn arithmetic_overflow_negation(val: i32) -> i32 {
-    -val
+    #[cfg(cfail1)]
+    {
+        -val
+    }
+    #[cfg(not(cfail1))]
+    {
+        -val
+    }
 }
 
 
 // Division by zero ------------------------------------------------------------
-#[cfg(cfail1)]
-pub fn division_by_zero(val: i32) -> i32 {
-    2 / val
-}
-
-#[cfg(not(cfail1))]
 #[rustc_clean(cfg="cfail2", except="HirBody,MirValidated,MirOptimized")]
 #[rustc_clean(cfg="cfail3")]
 pub fn division_by_zero(val: i32) -> i32 {
-    2 / val
+    #[cfg(cfail1)]
+    {
+        2 / val
+    }
+    #[cfg(not(cfail1))]
+    {
+        2 / val
+    }
 }
 
 // Division by zero ------------------------------------------------------------
-#[cfg(cfail1)]
-pub fn mod_by_zero(val: i32) -> i32 {
-    2 % val
-}
-
-#[cfg(not(cfail1))]
 #[rustc_clean(cfg="cfail2", except="HirBody,MirValidated,MirOptimized")]
 #[rustc_clean(cfg="cfail3")]
 pub fn mod_by_zero(val: i32) -> i32 {
-    2 % val
+    #[cfg(cfail1)]
+    {
+        2 % val
+    }
+    #[cfg(not(cfail1))]
+    {
+        2 % val
+    }
 }
 
 
 // shift left ------------------------------------------------------------------
-#[cfg(cfail1)]
-pub fn shift_left(val: i32, shift: usize) -> i32 {
-    val << shift
-}
-
-#[cfg(not(cfail1))]
 #[rustc_clean(cfg="cfail2", except="HirBody,MirValidated,MirOptimized")]
 #[rustc_clean(cfg="cfail3")]
 pub fn shift_left(val: i32, shift: usize) -> i32 {
-    val << shift
+    #[cfg(cfail1)]
+    {
+        val << shift
+    }
+    #[cfg(not(cfail1))]
+    {
+        val << shift
+    }
 }
 
 
 // shift right ------------------------------------------------------------------
-#[cfg(cfail1)]
-pub fn shift_right(val: i32, shift: usize) -> i32 {
-    val >> shift
-}
-
-#[cfg(not(cfail1))]
 #[rustc_clean(cfg="cfail2", except="HirBody,MirValidated,MirOptimized")]
 #[rustc_clean(cfg="cfail3")]
 pub fn shift_right(val: i32, shift: usize) -> i32 {
-    val >> shift
-}
-
-
-// THE FOLLOWING ITEMS SHOULD NOT BE INFLUENCED BY THEIR SOURCE LOCATION
-
-// bitwise ---------------------------------------------------------------------
-#[cfg(cfail1)]
-pub fn bitwise(val: i32) -> i32 {
-    !val & 0x101010101 | 0x45689 ^ 0x2372382
-}
-
-#[cfg(not(cfail1))]
-#[rustc_clean(cfg="cfail2")]
-#[rustc_clean(cfg="cfail3")]
-pub fn bitwise(val: i32) -> i32 {
-    !val & 0x101010101 | 0x45689 ^ 0x2372382
-}
-
-
-// logical ---------------------------------------------------------------------
-#[cfg(cfail1)]
-pub fn logical(val1: bool, val2: bool, val3: bool) -> bool {
-    val1 && val2 || val3
-}
-
-#[cfg(not(cfail1))]
-#[rustc_clean(cfg="cfail2")]
-#[rustc_clean(cfg="cfail3")]
-pub fn logical(val1: bool, val2: bool, val3: bool) -> bool {
-    val1 && val2 || val3
+    #[cfg(cfail1)]
+    {
+        val >> shift
+    }
+    #[cfg(not(cfail1))]
+    {
+        val >> shift
+    }
 }
diff --git a/src/test/incremental/hashes/panic_exprs_no_overflow_checks.rs b/src/test/incremental/hashes/panic_exprs_no_overflow_checks.rs
deleted file mode 100644
index 8402da04091..00000000000
--- a/src/test/incremental/hashes/panic_exprs_no_overflow_checks.rs
+++ /dev/null
@@ -1,225 +0,0 @@
-// Copyright 2016 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.
-
-// This test case tests the incremental compilation hash (ICH) implementation
-// for exprs that can panic at runtime (e.g. because of bounds checking). For
-// these expressions an error message containing their source location is
-// generated, so their hash must always depend on their location in the source
-// code, not just when debuginfo is enabled.
-
-// As opposed to the panic_exprs.rs test case, this test case checks that things
-// behave as expected when overflow checks are off:
-//
-// - Addition, subtraction, and multiplication do not change the ICH, unless
-//   the function containing them is marked with rustc_inherit_overflow_checks.
-// - Division by zero and bounds checks always influence the ICH
-
-// The general pattern followed here is: Change one thing between rev1 and rev2
-// and make sure that the hash has changed, then change nothing between rev2 and
-// rev3 and make sure that the hash has not changed.
-
-// must-compile-successfully
-// revisions: cfail1 cfail2 cfail3
-// compile-flags: -Z query-dep-graph -Z force-overflow-checks=off
-
-#![allow(warnings)]
-#![feature(rustc_attrs)]
-#![crate_type="rlib"]
-
-
-// Indexing expression ---------------------------------------------------------
-#[cfg(cfail1)]
-pub fn indexing(slice: &[u8]) -> u8 {
-    slice[100]
-}
-
-#[cfg(not(cfail1))]
-#[rustc_clean(cfg="cfail2", except="HirBody,MirValidated,MirOptimized")]
-#[rustc_clean(cfg="cfail3")]
-pub fn indexing(slice: &[u8]) -> u8 {
-    slice[100]
-}
-
-
-// Arithmetic overflow plus ----------------------------------------------------
-#[cfg(cfail1)]
-#[rustc_inherit_overflow_checks]
-pub fn arithmetic_overflow_plus_inherit(val: i32) -> i32 {
-    val + 1
-}
-
-#[cfg(not(cfail1))]
-#[rustc_clean(cfg="cfail2", except="HirBody,MirValidated,MirOptimized")]
-#[rustc_clean(cfg="cfail3")]
-#[rustc_inherit_overflow_checks]
-pub fn arithmetic_overflow_plus_inherit(val: i32) -> i32 {
-    val + 1
-}
-
-
-// Arithmetic overflow minus ----------------------------------------------------
-#[cfg(cfail1)]
-#[rustc_inherit_overflow_checks]
-pub fn arithmetic_overflow_minus_inherit(val: i32) -> i32 {
-    val - 1
-}
-
-#[cfg(not(cfail1))]
-#[rustc_clean(cfg="cfail2", except="HirBody,MirValidated,MirOptimized")]
-#[rustc_clean(cfg="cfail3")]
-#[rustc_inherit_overflow_checks]
-pub fn arithmetic_overflow_minus_inherit(val: i32) -> i32 {
-    val - 1
-}
-
-
-// Arithmetic overflow mult ----------------------------------------------------
-#[cfg(cfail1)]
-#[rustc_inherit_overflow_checks]
-pub fn arithmetic_overflow_mult_inherit(val: i32) -> i32 {
-    val * 2
-}
-
-#[cfg(not(cfail1))]
-#[rustc_clean(cfg="cfail2", except="HirBody,MirValidated,MirOptimized")]
-#[rustc_clean(cfg="cfail3")]
-#[rustc_inherit_overflow_checks]
-pub fn arithmetic_overflow_mult_inherit(val: i32) -> i32 {
-    val * 2
-}
-
-
-// Arithmetic overflow negation ------------------------------------------------
-#[cfg(cfail1)]
-#[rustc_inherit_overflow_checks]
-pub fn arithmetic_overflow_negation_inherit(val: i32) -> i32 {
-    -val
-}
-
-#[cfg(not(cfail1))]
-#[rustc_clean(cfg="cfail2", except="HirBody,MirValidated,MirOptimized")]
-#[rustc_clean(cfg="cfail3")]
-#[rustc_inherit_overflow_checks]
-pub fn arithmetic_overflow_negation_inherit(val: i32) -> i32 {
-    -val
-}
-
-
-// Division by zero ------------------------------------------------------------
-#[cfg(cfail1)]
-pub fn division_by_zero(val: i32) -> i32 {
-    2 / val
-}
-
-#[cfg(not(cfail1))]
-#[rustc_clean(cfg="cfail2", except="HirBody,MirValidated,MirOptimized")]
-#[rustc_clean(cfg="cfail3")]
-pub fn division_by_zero(val: i32) -> i32 {
-    2 / val
-}
-
-// Division by zero ------------------------------------------------------------
-#[cfg(cfail1)]
-pub fn mod_by_zero(val: i32) -> i32 {
-    2 % val
-}
-
-#[cfg(not(cfail1))]
-#[rustc_clean(cfg="cfail2", except="HirBody,MirValidated,MirOptimized")]
-#[rustc_clean(cfg="cfail3")]
-pub fn mod_by_zero(val: i32) -> i32 {
-    2 % val
-}
-
-
-
-// THE FOLLOWING ITEMS SHOULD NOT BE INFLUENCED BY THEIR SOURCE LOCATION
-
-// bitwise ---------------------------------------------------------------------
-#[cfg(cfail1)]
-pub fn bitwise(val: i32) -> i32 {
-    !val & 0x101010101 | 0x45689 ^ 0x2372382 << 1 >> 1
-}
-
-#[cfg(not(cfail1))]
-#[rustc_clean(cfg="cfail2")]
-#[rustc_clean(cfg="cfail3")]
-pub fn bitwise(val: i32) -> i32 {
-    !val & 0x101010101 | 0x45689 ^ 0x2372382 << 1 >> 1
-}
-
-
-// logical ---------------------------------------------------------------------
-#[cfg(cfail1)]
-pub fn logical(val1: bool, val2: bool, val3: bool) -> bool {
-    val1 && val2 || val3
-}
-
-#[cfg(not(cfail1))]
-#[rustc_clean(cfg="cfail2")]
-#[rustc_clean(cfg="cfail3")]
-pub fn logical(val1: bool, val2: bool, val3: bool) -> bool {
-    val1 && val2 || val3
-}
-
-// Arithmetic overflow plus ----------------------------------------------------
-#[cfg(cfail1)]
-pub fn arithmetic_overflow_plus(val: i32) -> i32 {
-    val + 1
-}
-
-#[cfg(not(cfail1))]
-#[rustc_clean(cfg="cfail2")]
-#[rustc_clean(cfg="cfail3")]
-pub fn arithmetic_overflow_plus(val: i32) -> i32 {
-    val + 1
-}
-
-
-// Arithmetic overflow minus ----------------------------------------------------
-#[cfg(cfail1)]
-pub fn arithmetic_overflow_minus(val: i32) -> i32 {
-    val - 1
-}
-
-#[cfg(not(cfail1))]
-#[rustc_clean(cfg="cfail2")]
-#[rustc_clean(cfg="cfail3")]
-pub fn arithmetic_overflow_minus(val: i32) -> i32 {
-    val - 1
-}
-
-
-// Arithmetic overflow mult ----------------------------------------------------
-#[cfg(cfail1)]
-pub fn arithmetic_overflow_mult(val: i32) -> i32 {
-    val * 2
-}
-
-#[cfg(not(cfail1))]
-#[rustc_clean(cfg="cfail2")]
-#[rustc_clean(cfg="cfail3")]
-pub fn arithmetic_overflow_mult(val: i32) -> i32 {
-    val * 2
-}
-
-
-// Arithmetic overflow negation ------------------------------------------------
-#[cfg(cfail1)]
-pub fn arithmetic_overflow_negation(val: i32) -> i32 {
-    -val
-}
-
-#[cfg(not(cfail1))]
-#[rustc_clean(cfg="cfail2")]
-#[rustc_clean(cfg="cfail3")]
-pub fn arithmetic_overflow_negation(val: i32) -> i32 {
-    -val
-}
diff --git a/src/test/incremental/hashes/statics.rs b/src/test/incremental/hashes/statics.rs
index e729a2c039e..b9616d8c6b5 100644
--- a/src/test/incremental/hashes/statics.rs
+++ b/src/test/incremental/hashes/statics.rs
@@ -18,7 +18,7 @@
 
 // must-compile-successfully
 // revisions: cfail1 cfail2 cfail3
-// compile-flags: -Z query-dep-graph
+// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans
 
 #![allow(warnings)]
 #![feature(rustc_attrs)]
diff --git a/src/test/incremental/hashes/struct_constructors.rs b/src/test/incremental/hashes/struct_constructors.rs
index a16f4a2fdfd..3cdaf0e468a 100644
--- a/src/test/incremental/hashes/struct_constructors.rs
+++ b/src/test/incremental/hashes/struct_constructors.rs
@@ -18,7 +18,7 @@
 
 // must-compile-successfully
 // revisions: cfail1 cfail2 cfail3
-// compile-flags: -Z query-dep-graph
+// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans
 
 #![allow(warnings)]
 #![feature(rustc_attrs)]
diff --git a/src/test/incremental/hashes/struct_defs.rs b/src/test/incremental/hashes/struct_defs.rs
index d89d779c849..d7b70720418 100644
--- a/src/test/incremental/hashes/struct_defs.rs
+++ b/src/test/incremental/hashes/struct_defs.rs
@@ -23,7 +23,7 @@
 
 // must-compile-successfully
 // revisions: cfail1 cfail2 cfail3
-// compile-flags: -Z query-dep-graph
+// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans
 
 
 #![allow(warnings)]
diff --git a/src/test/incremental/hashes/trait_defs.rs b/src/test/incremental/hashes/trait_defs.rs
index e09659be755..0816d6e5f45 100644
--- a/src/test/incremental/hashes/trait_defs.rs
+++ b/src/test/incremental/hashes/trait_defs.rs
@@ -23,7 +23,7 @@
 
 // must-compile-successfully
 // revisions: cfail1 cfail2 cfail3
-// compile-flags: -Z query-dep-graph
+// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans
 
 #![allow(warnings)]
 #![feature(rustc_attrs)]
diff --git a/src/test/incremental/hashes/trait_impls.rs b/src/test/incremental/hashes/trait_impls.rs
index eb31175b6f2..a232883f7a9 100644
--- a/src/test/incremental/hashes/trait_impls.rs
+++ b/src/test/incremental/hashes/trait_impls.rs
@@ -18,7 +18,7 @@
 
 // must-compile-successfully
 // revisions: cfail1 cfail2 cfail3
-// compile-flags: -Z query-dep-graph
+// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans
 
 
 #![allow(warnings)]
diff --git a/src/test/incremental/hashes/type_defs.rs b/src/test/incremental/hashes/type_defs.rs
index 59346f5fdb2..c5521d2fae2 100644
--- a/src/test/incremental/hashes/type_defs.rs
+++ b/src/test/incremental/hashes/type_defs.rs
@@ -23,7 +23,7 @@
 
 // must-compile-successfully
 // revisions: cfail1 cfail2 cfail3
-// compile-flags: -Z query-dep-graph
+// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans
 
 #![allow(warnings)]
 #![feature(rustc_attrs)]
diff --git a/src/test/incremental/hashes/unary_and_binary_exprs.rs b/src/test/incremental/hashes/unary_and_binary_exprs.rs
index ec4ae62b12b..85f6ef60c5d 100644
--- a/src/test/incremental/hashes/unary_and_binary_exprs.rs
+++ b/src/test/incremental/hashes/unary_and_binary_exprs.rs
@@ -18,7 +18,7 @@
 
 // must-compile-successfully
 // revisions: cfail1 cfail2 cfail3
-// compile-flags: -Z query-dep-graph -Z force-overflow-checks=off
+// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans
 
 #![allow(warnings)]
 #![feature(rustc_attrs)]
diff --git a/src/test/incremental/hashes/while_let_loops.rs b/src/test/incremental/hashes/while_let_loops.rs
index cab38d0adc2..d04ed03eb66 100644
--- a/src/test/incremental/hashes/while_let_loops.rs
+++ b/src/test/incremental/hashes/while_let_loops.rs
@@ -18,7 +18,7 @@
 
 // must-compile-successfully
 // revisions: cfail1 cfail2 cfail3
-// compile-flags: -Z query-dep-graph
+// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans
 
 #![allow(warnings)]
 #![feature(rustc_attrs)]
diff --git a/src/test/incremental/hashes/while_loops.rs b/src/test/incremental/hashes/while_loops.rs
index 30989f33b4b..7f2bbebde80 100644
--- a/src/test/incremental/hashes/while_loops.rs
+++ b/src/test/incremental/hashes/while_loops.rs
@@ -18,7 +18,7 @@
 
 // must-compile-successfully
 // revisions: cfail1 cfail2 cfail3
-// compile-flags: -Z query-dep-graph
+// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans
 
 #![allow(warnings)]
 #![feature(rustc_attrs)]
diff --git a/src/test/incremental/ich_method_call_trait_scope.rs b/src/test/incremental/ich_method_call_trait_scope.rs
index 7f4e2b0f176..996c9ed21cf 100644
--- a/src/test/incremental/ich_method_call_trait_scope.rs
+++ b/src/test/incremental/ich_method_call_trait_scope.rs
@@ -30,21 +30,10 @@ trait Trait2 {
 
 impl Trait2 for () { }
 
-#[cfg(rpass1)]
 mod mod3 {
+    #[cfg(rpass1)]
     use Trait1;
-
-    fn bar() {
-        ().method();
-    }
-
-    fn baz() {
-        22; // no method call, traits in scope don't matter
-    }
-}
-
-#[cfg(rpass2)]
-mod mod3 {
+    #[cfg(rpass2)]
     use Trait2;
 
     #[rustc_clean(label="Hir", cfg="rpass2")]
diff --git a/src/test/incremental/ich_nested_items.rs b/src/test/incremental/ich_nested_items.rs
index 2e0f0ba0837..8566a24c84b 100644
--- a/src/test/incremental/ich_nested_items.rs
+++ b/src/test/incremental/ich_nested_items.rs
@@ -17,23 +17,18 @@
 #![crate_type = "rlib"]
 #![feature(rustc_attrs)]
 
-#[cfg(cfail1)]
-pub fn foo() {
-    pub fn bar() { }
-    pub fn baz() { }
-}
-
-#[cfg(cfail2)]
 #[rustc_clean(label="Hir", cfg="cfail2")]
 #[rustc_dirty(label="HirBody", cfg="cfail2")]
 pub fn foo() {
-    #[rustc_clean(label="Hir", cfg="cfail2")]
-    #[rustc_clean(label="HirBody", cfg="cfail2")]
+    #[cfg(cfail1)]
     pub fn baz() { } // order is different...
 
     #[rustc_clean(label="Hir", cfg="cfail2")]
     #[rustc_clean(label="HirBody", cfg="cfail2")]
     pub fn bar() { } // but that doesn't matter.
 
+    #[cfg(cfail2)]
+    pub fn baz() { } // order is different...
+
     pub fn bap() { } // neither does adding a new item
 }
diff --git a/src/test/incremental/ich_resolve_results.rs b/src/test/incremental/ich_resolve_results.rs
index 49a88c530ff..9e5b51f3e7a 100644
--- a/src/test/incremental/ich_resolve_results.rs
+++ b/src/test/incremental/ich_resolve_results.rs
@@ -25,49 +25,29 @@ mod mod2 {
     pub struct Foo(pub i64);
 }
 
-#[cfg(rpass1)]
 mod mod3 {
-    use test;
+    #[cfg(rpass1)]
     use mod1::Foo;
-
-    fn in_expr() {
-        Foo(0);
-    }
-
-    fn in_type() {
-        test::<Foo>();
-    }
-}
-
-#[cfg(rpass2)]
-mod mod3 {
-    use mod1::Foo; // <-- Nothing changed, but reordered!
     use test;
 
-    #[rustc_clean(label="Hir", cfg="rpass2")]
-    #[rustc_clean(label="HirBody", cfg="rpass2")]
-    fn in_expr() {
-        Foo(0);
-    }
+    // In rpass2 we move the use declaration.
+    #[cfg(rpass2)]
+    use mod1::Foo;
+
+    // In rpass3 we let the declaration point to something else.
+    #[cfg(rpass3)]
+    use mod2::Foo;
 
     #[rustc_clean(label="Hir", cfg="rpass2")]
     #[rustc_clean(label="HirBody", cfg="rpass2")]
-    fn in_type() {
-        test::<Foo>();
-    }
-}
-
-#[cfg(rpass3)]
-mod mod3 {
-    use test;
-    use mod2::Foo; // <-- This changed!
-
     #[rustc_clean(label="Hir", cfg="rpass3")]
     #[rustc_dirty(label="HirBody", cfg="rpass3")]
     fn in_expr() {
         Foo(0);
     }
 
+    #[rustc_clean(label="Hir", cfg="rpass2")]
+    #[rustc_clean(label="HirBody", cfg="rpass2")]
     #[rustc_clean(label="Hir", cfg="rpass3")]
     #[rustc_dirty(label="HirBody", cfg="rpass3")]
     fn in_type() {
diff --git a/src/test/incremental/source_loc_macros.rs b/src/test/incremental/source_loc_macros.rs
index 36d1b3ecbcd..3f669ae3fc8 100644
--- a/src/test/incremental/source_loc_macros.rs
+++ b/src/test/incremental/source_loc_macros.rs
@@ -35,28 +35,30 @@ fn file_same() {
     let _ = file!();
 }
 
-#[cfg(rpass1)]
-fn line_different() {
-    let _ = line!();
-}
-
-#[cfg(rpass2)]
 #[rustc_clean(label="Hir", cfg="rpass2")]
 #[rustc_dirty(label="HirBody", cfg="rpass2")]
 fn line_different() {
-    let _ = line!();
-}
-
-#[cfg(rpass1)]
-fn col_different() {
-    let _ = column!();
+    #[cfg(rpass1)]
+    {
+        let _ = line!();
+    }
+    #[cfg(rpass2)]
+    {
+        let _ = line!();
+    }
 }
 
-#[cfg(rpass2)]
 #[rustc_clean(label="Hir", cfg="rpass2")]
 #[rustc_dirty(label="HirBody", cfg="rpass2")]
 fn col_different() {
-    let _ =        column!();
+    #[cfg(rpass1)]
+    {
+        let _ = column!();
+    }
+    #[cfg(rpass2)]
+    {
+        let _ =        column!();
+    }
 }
 
 fn main() {
diff --git a/src/test/incremental/spans_insignificant_w_o_debuginfo.rs b/src/test/incremental/spans_insignificant_w_o_debuginfo.rs
deleted file mode 100644
index 90ec4a9d558..00000000000
--- a/src/test/incremental/spans_insignificant_w_o_debuginfo.rs
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright 2016 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.
-
-// This test makes sure that just changing a definition's location in the
-// source file does *not* change its incr. comp. hash, if debuginfo is disabled.
-
-// revisions:rpass1 rpass2
-
-// compile-flags: -Z query-dep-graph
-
-#![feature(rustc_attrs)]
-
-#[cfg(rpass1)]
-pub fn main() {}
-
-#[cfg(rpass2)]
-#[rustc_clean(label="Hir", cfg="rpass2")]
-#[rustc_clean(label="HirBody", cfg="rpass2")]
-pub fn main() {}
diff --git a/src/test/incremental/spans_significant_w_panic.rs b/src/test/incremental/spans_significant_w_panic.rs
index c0bf35e781c..1fefec7a0a7 100644
--- a/src/test/incremental/spans_significant_w_panic.rs
+++ b/src/test/incremental/spans_significant_w_panic.rs
@@ -23,8 +23,7 @@ pub fn main() {
 }
 
 #[cfg(rpass2)]
-#[rustc_clean(label="Hir", cfg="rpass2")]
-#[rustc_dirty(label="HirBody", cfg="rpass2")]
+#[rustc_dirty(label="MirOptimized", cfg="rpass2")]
 pub fn main() {
     let _ = 0u8 + 1;
 }
diff --git a/src/test/run-pass/auxiliary/svh-a-comment.rs b/src/test/run-pass/auxiliary/svh-a-comment.rs
deleted file mode 100644
index 22e40822eec..00000000000
--- a/src/test/run-pass/auxiliary/svh-a-comment.rs
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright 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.
-
-//! The `svh-a-*.rs` files are all deviations from the base file
-//! svh-a-base.rs with some difference (usually in `fn foo`) that
-//! should not affect the strict version hash (SVH) computation
-//! (#14132).
-
-#![crate_name = "a"]
-
-macro_rules! three {
-    () => { 3 }
-}
-
-pub trait U {}
-pub trait V {}
-impl U for () {}
-impl V for () {}
-
-static A_CONSTANT : isize = 2;
-
-pub fn foo<T:U>(_: isize) -> isize {
-    // a comment does not affect the svh
-    3
-}
-
-pub fn an_unused_name() -> isize {
-    4
-}
diff --git a/src/test/run-pass/auxiliary/svh-a-doc.rs b/src/test/run-pass/auxiliary/svh-a-doc.rs
deleted file mode 100644
index 3d8a728967a..00000000000
--- a/src/test/run-pass/auxiliary/svh-a-doc.rs
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright 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.
-
-//! The `svh-a-*.rs` files are all deviations from the base file
-//! svh-a-base.rs with some difference (usually in `fn foo`) that
-//! should not affect the strict version hash (SVH) computation
-//! (#14132).
-
-#![crate_name = "a"]
-
-macro_rules! three {
-    () => { 3 }
-}
-
-pub trait U {}
-pub trait V {}
-impl U for () {}
-impl V for () {}
-
-static A_CONSTANT : isize = 2;
-
-// Adding some documentation does not affect the svh.
-
-/// foo always returns three.
-pub fn foo<T:U>(_: isize) -> isize {
-    3
-}
-
-pub fn an_unused_name() -> isize {
-    4
-}
diff --git a/src/test/run-pass/auxiliary/svh-a-macro.rs b/src/test/run-pass/auxiliary/svh-a-macro.rs
deleted file mode 100644
index 41d7eb7b186..00000000000
--- a/src/test/run-pass/auxiliary/svh-a-macro.rs
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright 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.
-
-//! The `svh-a-*.rs` files are all deviations from the base file
-//! svh-a-base.rs with some difference (usually in `fn foo`) that
-//! should not affect the strict version hash (SVH) computation
-//! (#14132).
-
-#![crate_name = "a"]
-
-macro_rules! three {
-    () => { 3 }
-}
-
-pub trait U {}
-pub trait V {}
-impl U for () {}
-impl V for () {}
-
-static A_CONSTANT : isize = 2;
-
-pub fn foo<T:U>(_: isize) -> isize {
-    // a macro invocation in a function body does not affect the svh,
-    // as long as it yields the same code.
-    three!()
-}
-
-pub fn an_unused_name() -> isize {
-    4
-}
diff --git a/src/test/run-pass/auxiliary/svh-a-no-change.rs b/src/test/run-pass/auxiliary/svh-a-no-change.rs
deleted file mode 100644
index 31a97f695f0..00000000000
--- a/src/test/run-pass/auxiliary/svh-a-no-change.rs
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright 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.
-
-//! The `svh-a-*.rs` files are all deviations from the base file
-//! svh-a-base.rs with some difference (usually in `fn foo`) that
-//! should not affect the strict version hash (SVH) computation
-//! (#14132).
-
-#![crate_name = "a"]
-
-macro_rules! three {
-    () => { 3 }
-}
-
-pub trait U {}
-pub trait V {}
-impl U for () {}
-impl V for () {}
-
-static A_CONSTANT : isize = 2;
-
-pub fn foo<T:U>(_: isize) -> isize {
-    3
-}
-
-pub fn an_unused_name() -> isize {
-    4
-}
diff --git a/src/test/run-pass/auxiliary/svh-a-redundant-cfg.rs b/src/test/run-pass/auxiliary/svh-a-redundant-cfg.rs
deleted file mode 100644
index e405c337abe..00000000000
--- a/src/test/run-pass/auxiliary/svh-a-redundant-cfg.rs
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright 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.
-
-//! The `svh-a-*.rs` files are all deviations from the base file
-//! svh-a-base.rs with some difference (usually in `fn foo`) that
-//! should not affect the strict version hash (SVH) computation
-//! (#14132).
-
-#![crate_name = "a"]
-
-macro_rules! three {
-    () => { 3 }
-}
-
-pub trait U {}
-pub trait V {}
-impl U for () {}
-impl V for () {}
-
-static A_CONSTANT : isize = 2;
-
-// cfg attribute does not affect the svh, as long as it yields the same code.
-#[cfg(not(an_unused_name))]
-pub fn foo<T:U>(_: isize) -> isize {
-    3
-}
-
-pub fn an_unused_name() -> isize {
-    4
-}
diff --git a/src/test/run-pass/auxiliary/svh-a-whitespace.rs b/src/test/run-pass/auxiliary/svh-a-whitespace.rs
deleted file mode 100644
index 9ef788c9842..00000000000
--- a/src/test/run-pass/auxiliary/svh-a-whitespace.rs
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright 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.
-
-//! The `svh-a-*.rs` files are all deviations from the base file
-//! svh-a-base.rs with some difference (usually in `fn foo`) that
-//! should not affect the strict version hash (SVH) computation
-//! (#14132).
-
-#![crate_name = "a"]
-
-macro_rules! three {
-    () => { 3 }
-}
-
-pub trait U {}
-pub trait V {}
-impl U for () {}
-impl V for () {}
-
-static A_CONSTANT : isize = 2;
-
-pub fn foo<T:U>(_: isize) -> isize {
-
-    3
-
-}
-
-pub fn an_unused_name() -> isize {
-    4
-}
diff --git a/src/test/run-pass/svh-add-doc.rs b/src/test/run-pass/hygiene/issue-44128.rs
index ea07ebe3646..213ee1edff4 100644
--- a/src/test/run-pass/svh-add-doc.rs
+++ b/src/test/run-pass/hygiene/issue-44128.rs
@@ -1,4 +1,4 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
 // file at the top-level directory of this distribution and at
 // http://rust-lang.org/COPYRIGHT.
 //
@@ -8,16 +8,18 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// note that these aux-build directives must be in this order
-// aux-build:svh-a-base.rs
-// aux-build:svh-b.rs
-// aux-build:svh-a-doc.rs
+#![feature(decl_macro)]
 
-// pretty-expanded FIXME #23616
-
-extern crate a;
-extern crate b;
+pub macro create_struct($a:ident) {
+    struct $a;
+    impl Clone for $a {
+        fn clone(&self) -> Self {
+            $a
+        }
+    }
+}
 
 fn main() {
-    b::foo()
+    create_struct!(Test);
+    Test.clone();
 }
diff --git a/src/test/run-pass/svh-add-comment.rs b/src/test/run-pass/svh-add-comment.rs
deleted file mode 100644
index 4d7b61e08f5..00000000000
--- a/src/test/run-pass/svh-add-comment.rs
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright 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.
-
-// note that these aux-build directives must be in this order
-// aux-build:svh-a-base.rs
-// aux-build:svh-b.rs
-// aux-build:svh-a-comment.rs
-
-// pretty-expanded FIXME #23616
-
-extern crate a;
-extern crate b;
-
-fn main() {
-    b::foo()
-}
diff --git a/src/test/run-pass/svh-add-nothing.rs b/src/test/run-pass/svh-add-nothing.rs
index 9aa56ed2a76..aca50859b6e 100644
--- a/src/test/run-pass/svh-add-nothing.rs
+++ b/src/test/run-pass/svh-add-nothing.rs
@@ -11,7 +11,7 @@
 // note that these aux-build directives must be in this order
 // aux-build:svh-a-base.rs
 // aux-build:svh-b.rs
-// aux-build:svh-a-no-change.rs
+// aux-build:svh-a-base.rs
 
 // pretty-expanded FIXME #23616
 
diff --git a/src/test/run-pass/svh-add-redundant-cfg.rs b/src/test/run-pass/svh-add-redundant-cfg.rs
deleted file mode 100644
index 2da3004aaf1..00000000000
--- a/src/test/run-pass/svh-add-redundant-cfg.rs
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright 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.
-
-// note that these aux-build directives must be in this order
-// aux-build:svh-a-base.rs
-// aux-build:svh-b.rs
-// aux-build:svh-a-redundant-cfg.rs
-
-// pretty-expanded FIXME #23616
-
-extern crate a;
-extern crate b;
-
-fn main() {
-    b::foo()
-}
diff --git a/src/test/run-pass/svh-add-whitespace.rs b/src/test/run-pass/svh-add-whitespace.rs
deleted file mode 100644
index bfc676bde26..00000000000
--- a/src/test/run-pass/svh-add-whitespace.rs
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright 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.
-
-// note that these aux-build directives must be in this order
-// aux-build:svh-a-base.rs
-// aux-build:svh-b.rs
-// aux-build:svh-a-whitespace.rs
-
-// pretty-expanded FIXME #23616
-
-extern crate a;
-extern crate b;
-
-fn main() {
-    b::foo()
-}
diff --git a/src/test/run-pass/svh-add-macro.rs b/src/test/run-pass/thinlto/weak-works.rs
index 4e0192c40c2..b9719e04f34 100644
--- a/src/test/run-pass/svh-add-macro.rs
+++ b/src/test/run-pass/thinlto/weak-works.rs
@@ -1,4 +1,4 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
 // file at the top-level directory of this distribution and at
 // http://rust-lang.org/COPYRIGHT.
 //
@@ -8,16 +8,30 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// note that these aux-build directives must be in this order
-// aux-build:svh-a-base.rs
-// aux-build:svh-b.rs
-// aux-build:svh-a-macro.rs
+// compile-flags: -C codegen-units=8 -Z thinlto
+// ignore-windows
+// min-llvm-version 4.0
 
-// pretty-expanded FIXME #23616
+#![feature(linkage)]
 
-extern crate a;
-extern crate b;
+pub mod foo {
+    #[linkage = "weak"]
+    #[no_mangle]
+    pub extern "C" fn FOO() -> i32 {
+        0
+    }
+}
+
+mod bar {
+    extern "C" {
+        fn FOO() -> i32;
+    }
+
+    pub fn bar() -> i32 {
+        unsafe { FOO() }
+    }
+}
 
 fn main() {
-    b::foo()
+    bar::bar();
 }