about summary refs log tree commit diff
diff options
context:
space:
mode:
-rwxr-xr-xconfigure71
-rw-r--r--src/doc/reference.md5
-rw-r--r--src/doc/trpl/choosing-your-guarantees.md2
-rw-r--r--src/doc/trpl/traits.md32
-rw-r--r--src/libcollections/str.rs118
-rw-r--r--src/libcore/result.rs2
-rw-r--r--src/librustc/diagnostics.rs3
-rw-r--r--src/librustc/middle/check_match.rs37
-rw-r--r--src/librustc_lint/builtin.rs21
-rw-r--r--src/librustc_resolve/diagnostics.rs165
-rw-r--r--src/librustc_trans/back/msvc/mod.rs88
-rw-r--r--src/librustc_trans/trans/base.rs38
-rw-r--r--src/librustc_trans/trans/context.rs24
-rw-r--r--src/librustc_typeck/check/mod.rs10
-rw-r--r--src/librustc_typeck/check/upvar.rs32
-rw-r--r--src/libstd/rand/os.rs11
-rw-r--r--src/libstd/thread/mod.rs59
-rw-r--r--src/libsyntax/ast.rs10
-rw-r--r--src/libsyntax/ext/build.rs2
-rw-r--r--src/libsyntax/ext/expand.rs3
-rw-r--r--src/libsyntax/fold.rs3
-rw-r--r--src/libsyntax/parse/parser.rs3
-rw-r--r--src/rustbook/build.rs15
-rw-r--r--src/rustbook/javascript.rs63
-rw-r--r--src/rustbook/main.rs1
-rw-r--r--src/rustbook/static/rustbook.css (renamed from src/rustbook/css.rs)73
-rw-r--r--src/rustbook/static/rustbook.js73
-rw-r--r--src/test/compile-fail/lint-ctypes.rs3
-rw-r--r--src/test/run-pass/coerce-expect-unsized.rs5
-rw-r--r--src/test/run-pass/issue-27268.rs (renamed from src/test/auxiliary/xcrate-static.rs)8
-rw-r--r--src/test/run-pass/xcrate-static.rs17
31 files changed, 603 insertions, 394 deletions
diff --git a/configure b/configure
index 652b0b47766..20143e631b8 100755
--- a/configure
+++ b/configure
@@ -283,7 +283,7 @@ opt_core() {
             fi
         done
     else
-        if [ ! -z "$META" ]
+        if [ -n "$META" ]
         then
             OP="$OP=<$META>"
         fi
@@ -317,7 +317,7 @@ envopt() {
     fi
 
     # If script or environment provided a value, save it.
-    if [ ! -z "$VV" ]
+    if [ -n "$VV" ]
     then
         putvar $V
     fi
@@ -767,7 +767,7 @@ probe CFG_LLDB             lldb
 # On MacOS X, invoking `javac` pops up a dialog if the JDK is not
 # installed. Since `javac` is only used if `antlr4` is available,
 # probe for it only in this case.
-if [ ! -z "$CFG_ANTLR4" ]
+if [ -n "$CFG_ANTLR4" ]
 then
    probe CFG_JAVAC            javac
 fi
@@ -786,14 +786,14 @@ then
     fi
 fi
 
-if [ ! -z "$CFG_GDB" ]
+if [ -n "$CFG_GDB" ]
 then
     # Store GDB's version
     CFG_GDB_VERSION=$($CFG_GDB --version 2>/dev/null | head -1)
     putvar CFG_GDB_VERSION
 fi
 
-if [ ! -z "$CFG_LLDB" ]
+if [ -n "$CFG_LLDB" ]
 then
     # Store LLDB's version
     CFG_LLDB_VERSION=$($CFG_LLDB --version 2>/dev/null | head -1)
@@ -819,7 +819,7 @@ step_msg "looking for target specific programs"
 
 probe CFG_ADB        adb
 
-if [ ! -z "$CFG_PANDOC" ]
+if [ -n "$CFG_PANDOC" ]
 then
     # Extract "MAJOR MINOR" from Pandoc's version number
     PV_MAJOR_MINOR=$(pandoc --version | grep '^pandoc' |
@@ -845,7 +845,7 @@ then
     BIN_SUF=.exe
 fi
 
-if [ ! -z "$CFG_ENABLE_LOCAL_RUST" ]
+if [ -n "$CFG_ENABLE_LOCAL_RUST" ]
 then
     system_rustc=$(which rustc)
     if [ -f ${CFG_LOCAL_RUST_ROOT}/bin/rustc${BIN_SUF} ]
@@ -930,18 +930,18 @@ fi
 
 # Okay, at this point, we have made up our minds about whether we are
 # going to force CFG_ENABLE_CLANG or not; save the setting if so.
-if [ ! -z "$CFG_ENABLE_CLANG" ]
+if [ -n "$CFG_ENABLE_CLANG" ]
 then
     putvar CFG_ENABLE_CLANG
 fi
 
 # Same with jemalloc.  save the setting here.
-if [ ! -z "$CFG_DISABLE_JEMALLOC" ]
+if [ -n "$CFG_DISABLE_JEMALLOC" ]
 then
     putvar CFG_DISABLE_JEMALLOC
 fi
 
-if [ ! -z "$CFG_LLVM_ROOT" -a -z "$CFG_DISABLE_LLVM_VERSION_CHECK" -a -e "$CFG_LLVM_ROOT/bin/llvm-config" ]
+if [ -n "$CFG_LLVM_ROOT" -a -z "$CFG_DISABLE_LLVM_VERSION_CHECK" -a -e "$CFG_LLVM_ROOT/bin/llvm-config" ]
 then
     step_msg "using custom LLVM at $CFG_LLVM_ROOT"
 
@@ -970,7 +970,7 @@ fi
 # CFG_ENABLE_CLANG is set, that indicates that we are opting into
 # running such safeguards.
 
-if [ ! -z "$CC" ]
+if [ -n "$CC" ]
 then
     msg "skipping compiler inference steps; using provided CC=$CC"
     CFG_CC="$CC"
@@ -983,7 +983,7 @@ then
         putvar CFG_USING_CLANG
     fi
 else
-    if [ ! -z "$CFG_ENABLE_CLANG" ]
+    if [ -n "$CFG_ENABLE_CLANG" ]
     then
         if [ -z "$CFG_CLANG" ]
         then
@@ -997,7 +997,7 @@ else
     fi
 fi
 
-if [ ! -z "$CFG_ENABLE_CLANG" ]
+if [ -n "$CFG_ENABLE_CLANG" ]
 then
     case "$CC" in
         (''|*clang)
@@ -1013,7 +1013,7 @@ then
             CFG_CLANG_VERSION=$(echo $CFG_CLANG_REPORTED_VERSION | sed 's/.*version \(.*\) .*/\1/')
         fi
 
-        if [ ! -z "$CFG_OSX_CLANG_VERSION" ]
+        if [ -n "$CFG_OSX_CLANG_VERSION" ]
         then
             case $CFG_OSX_CLANG_VERSION in
                 (7.0*)
@@ -1042,7 +1042,7 @@ then
     esac
 fi
 
-if [ ! -z "$CFG_ENABLE_CCACHE" ]
+if [ -n "$CFG_ENABLE_CCACHE" ]
 then
     if [ -z "$CFG_CCACHE" ]
     then
@@ -1177,8 +1177,13 @@ do
             # INCLUDE and LIB variables for MSVC so we can set those in the
             # build system as well.
             install=$(reg QUERY \
-                       'HKLM\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\12.0' \
+                       'HKLM\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\14.0' \
                        -v InstallDir)
+            if [ -z "$install" ]; then
+              install=$(reg QUERY \
+                         'HKLM\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\12.0' \
+                         -v InstallDir)
+            fi
             need_ok "couldn't find visual studio install root"
             CFG_MSVC_ROOT=$(echo "$install" | grep InstallDir | sed 's/.*REG_SZ[ ]*//')
             CFG_MSVC_ROOT=$(dirname "$CFG_MSVC_ROOT")
@@ -1199,7 +1204,7 @@ do
                     ;;
             esac
             bindir="${CFG_MSVC_ROOT}/VC/bin"
-            if [ ! -z "$msvc_part" ]; then
+            if [ -n "$msvc_part" ]; then
                 bindir="$bindir/$msvc_part"
             fi
             eval CFG_MSVC_BINDIR_$bits="\"$bindir\""
@@ -1229,7 +1234,7 @@ do
     esac
 done
 
-if [ ! -z "$CFG_PERF" ]
+if [ -n "$CFG_PERF" ]
 then
     HAVE_PERF_LOGFD=`$CFG_PERF stat --log-fd 2>&1 | grep 'unknown option'`
     if [ -z "$HAVE_PERF_LOGFD" ];
@@ -1339,11 +1344,11 @@ then
     "${CFG_GIT}" submodule init
 
     # Disable submodules that we're not using
-    if [ ! -z "${CFG_LLVM_ROOT}" ]; then
+    if [ -n "${CFG_LLVM_ROOT}" ]; then
         msg "git: submodule deinit src/llvm"
         "${CFG_GIT}" submodule deinit src/llvm
     fi
-    if [ ! -z "${CFG_JEMALLOC_ROOT}" ]; then
+    if [ -n "${CFG_JEMALLOC_ROOT}" ]; then
         msg "git: submodule deinit src/jemalloc"
         "${CFG_GIT}" submodule deinit src/jemalloc
     fi
@@ -1390,7 +1395,7 @@ do
     if [ -z $CFG_LLVM_ROOT ]
     then
         LLVM_BUILD_DIR=${CFG_BUILD_DIR}$t/llvm
-        if [ ! -z "$CFG_DISABLE_OPTIMIZE_LLVM" ]
+        if [ -n "$CFG_DISABLE_OPTIMIZE_LLVM" ]
         then
             LLVM_DBG_OPTS="--enable-debug-symbols --disable-optimized"
             # Just use LLVM straight from its build directory to
@@ -1446,7 +1451,7 @@ do
         msg "configuring LLVM for $t with cmake"
 
         CMAKE_ARGS="-DLLVM_INCLUDE_TESTS=OFF"
-        if [ ! -z "$CFG_DISABLE_OPTIMIZE_LLVM" ]; then
+        if [ -n "$CFG_DISABLE_OPTIMIZE_LLVM" ]; then
             CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_BUILD_TYPE=Debug"
         else
             CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_BUILD_TYPE=Release"
@@ -1460,12 +1465,22 @@ do
 
         msg "configuring LLVM with:"
         msg "$CMAKE_ARGS"
+        case "$CFG_MSVC_ROOT" in
+            *14.0*)
+                generator="Visual Studio 14 2015"
+                ;;
+            *12.0*)
+                generator="Visual Studio 12 2013"
+                ;;
+            *)
+                err "can't determine generator for LLVM cmake"
+                ;;
+        esac
         case "$t" in
             x86_64-*)
-                generator="Visual Studio 12 2013 Win64"
+                generator="$generator Win64"
                 ;;
             i686-*)
-                generator="Visual Studio 12 2013"
                 ;;
             *)
                 err "can only build LLVM for x86 platforms"
@@ -1538,7 +1553,7 @@ do
 
             (*)
             msg "inferring LLVM_CXX/CC from CXX/CC = $CXX/$CC"
-            if [ ! -z "$CFG_ENABLE_CCACHE" ]
+            if [ -n "$CFG_ENABLE_CCACHE" ]
             then
                 if [ -z "$CFG_CCACHE" ]
                 then
@@ -1672,20 +1687,20 @@ putvar CFG_MANDIR
 
 # Avoid spurious warnings from clang by feeding it original source on
 # ccache-miss rather than preprocessed input.
-if [ ! -z "$CFG_ENABLE_CCACHE" ] && [ ! -z "$CFG_USING_CLANG" ]
+if [ -n "$CFG_ENABLE_CCACHE" ] && [ -n "$CFG_USING_CLANG" ]
 then
     CFG_CCACHE_CPP2=1
     putvar CFG_CCACHE_CPP2
 fi
 
-if [ ! -z "$CFG_ENABLE_CCACHE" ]
+if [ -n "$CFG_ENABLE_CCACHE" ]
 then
     CFG_CCACHE_BASEDIR=${CFG_SRC_DIR}
     putvar CFG_CCACHE_BASEDIR
 fi
 
 
-if [ ! -z $BAD_PANDOC ]
+if [ -n $BAD_PANDOC ]
 then
     CFG_PANDOC=
     putvar CFG_PANDOC
diff --git a/src/doc/reference.md b/src/doc/reference.md
index 59721edda70..9528871a774 100644
--- a/src/doc/reference.md
+++ b/src/doc/reference.md
@@ -591,8 +591,9 @@ always been designed to be compiled. For these reasons, this section assumes a
 compiler.
 
 Rust's semantics obey a *phase distinction* between compile-time and
-run-time.[^phase-distinction] Those semantic rules that have a *static
-interpretation* govern the success or failure of compilation. Those semantics
+run-time.[^phase-distinction] Semantic rules that have a *static
+interpretation* govern the success or failure of compilation, while
+semantic rules
 that have a *dynamic interpretation* govern the behavior of the program at
 run-time.
 
diff --git a/src/doc/trpl/choosing-your-guarantees.md b/src/doc/trpl/choosing-your-guarantees.md
index db28ce6f428..1d3c76ce231 100644
--- a/src/doc/trpl/choosing-your-guarantees.md
+++ b/src/doc/trpl/choosing-your-guarantees.md
@@ -81,7 +81,7 @@ The main guarantee provided here is that the data will not be destroyed until al
 are out of scope.
 
 This should be used when we wish to dynamically allocate and share some data (read-only) between
-various portions of yur program, where it is not certain which portion will finish using the pointer
+various portions of your program, where it is not certain which portion will finish using the pointer
 last. It's a viable alternative to `&T` when `&T` is either impossible to statically check for
 correctness, or creates extremely unergonomic code where the programmer does not wish to spend the
 development cost of working with.
diff --git a/src/doc/trpl/traits.md b/src/doc/trpl/traits.md
index 687e2bbf00e..740e2d51c4c 100644
--- a/src/doc/trpl/traits.md
+++ b/src/doc/trpl/traits.md
@@ -347,40 +347,50 @@ easiest just to show an example:
 
 ```rust
 trait Foo {
-    fn bar(&self);
+    fn is_valid(&self) -> bool;
 
-    fn baz(&self) { println!("We called baz."); }
+    fn is_invalid(&self) -> bool { !self.is_valid() }
 }
 ```
 
-Implementors of the `Foo` trait need to implement `bar()`, but they don’t
-need to implement `baz()`. They’ll get this default behavior. They can
+Implementors of the `Foo` trait need to implement `is_valid()`, but they don’t
+need to implement `is_invalid()`. They’ll get this default behavior. They can
 override the default if they so choose:
 
 ```rust
 # trait Foo {
-# fn bar(&self);
-# fn baz(&self) { println!("We called baz."); }
+#     fn is_valid(&self) -> bool;
+#
+#     fn is_invalid(&self) -> bool { !self.is_valid() }
 # }
 struct UseDefault;
 
 impl Foo for UseDefault {
-    fn bar(&self) { println!("We called bar."); }
+    fn is_valid(&self) -> bool {
+        println!("Called UseDefault.is_valid.");
+        true
+    }
 }
 
 struct OverrideDefault;
 
 impl Foo for OverrideDefault {
-    fn bar(&self) { println!("We called bar."); }
+    fn is_valid(&self) -> bool {
+        println!("Called OverrideDefault.is_valid.");
+        true
+    }
 
-    fn baz(&self) { println!("Override baz!"); }
+    fn is_invalid(&self) -> bool {
+        println!("Called OverrideDefault.is_invalid!");
+        true // this implementation is a self-contradiction!
+    }
 }
 
 let default = UseDefault;
-default.baz(); // prints "We called baz."
+assert!(!default.is_invalid()); // prints "Called UseDefault.is_valid."
 
 let over = OverrideDefault;
-over.baz(); // prints "Override baz!"
+assert!(over.is_invalid()); // prints "Called OverrideDefault.is_invalid!"
 ```
 
 # Inheritance
diff --git a/src/libcollections/str.rs b/src/libcollections/str.rs
index 5b91475a28b..58affdc4729 100644
--- a/src/libcollections/str.rs
+++ b/src/libcollections/str.rs
@@ -500,7 +500,7 @@ impl str {
     ///
     /// # Unsafety
     ///
-    /// Caller must check both UTF-8 character boundaries and the boundaries
+    /// Caller must check both UTF-8 sequence boundaries and the boundaries
     /// of the entire slice as
     /// well.
     ///
@@ -526,15 +526,16 @@ impl str {
         core_str::StrExt::slice_mut_unchecked(self, begin, end)
     }
 
-    /// Returns a slice of the string from the character range [`begin`..`end`).
+    /// Returns a slice of the string from the range [`begin`..`end`) where indices
+    /// are counted in code points.
     ///
     /// That is, start at the `begin`-th code point of the string and continue
     /// to the `end`-th code point. This does not detect or handle edge cases
-    /// such as leaving a combining character as the first code point of the
+    /// such as leaving a combining character as the first `char` of the
     /// string.
     ///
     /// Due to the design of UTF-8, this operation is `O(end)`. Use slicing
-    /// syntax if you want to use byte indices rather than codepoint indices.
+    /// syntax if you want to use `O(1)` byte indices instead.
     ///
     /// # Panics
     ///
@@ -559,18 +560,18 @@ impl str {
         core_str::StrExt::slice_chars(self, begin, end)
     }
 
-    /// Given a byte position, return the next char and its index.
+    /// Given a byte position, return the next code point and its index.
     ///
-    /// This can be used to iterate over the Unicode characters of a string.
+    /// This can be used to iterate over the Unicode code points of a string.
     ///
     /// # Panics
     ///
     /// If `i` is greater than or equal to the length of the string.
-    /// If `i` is not the index of the beginning of a valid UTF-8 character.
+    /// If `i` is not the index of the beginning of a valid UTF-8 sequence.
     ///
     /// # Examples
     ///
-    /// This example manually iterates through the characters of a string;
+    /// This example manually iterates through the code points of a string;
     /// this should normally be
     /// done by `.chars()` or `.char_indices()`.
     ///
@@ -578,7 +579,7 @@ impl str {
     /// # #![feature(str_char, core)]
     /// use std::str::CharRange;
     ///
-    /// let s = "中华Việt Nam";
+    /// let s = "中华Việt Nam";
     /// let mut i = 0;
     /// while i < s.len() {
     ///     let CharRange {ch, next} = s.char_range_at(i);
@@ -594,12 +595,14 @@ impl str {
     /// 3: 华
     /// 6: V
     /// 7: i
-    /// 8: ệ
-    /// 11: t
-    /// 12:
-    /// 13: N
-    /// 14: a
-    /// 15: m
+    /// 8: e
+    /// 9: ̣
+    /// 11: ̂
+    /// 13: t
+    /// 14:
+    /// 15: N
+    /// 16: a
+    /// 17: m
     /// ```
     #[unstable(feature = "str_char",
                reason = "often replaced by char_indices, this method may \
@@ -611,18 +614,21 @@ impl str {
 
     /// Given a byte position, return the previous `char` and its position.
     ///
-    /// This function can be used to iterate over a Unicode string in reverse.
+    /// This function can be used to iterate over a Unicode code points in reverse.
+    ///
+    /// Note that Unicode has many features, such as combining marks, ligatures,
+    /// and direction marks, that need to be taken into account to correctly reverse a string.
     ///
     /// Returns 0 for next index if called on start index 0.
     ///
     /// # Panics
     ///
     /// If `i` is greater than the length of the string.
-    /// If `i` is not an index following a valid UTF-8 character.
+    /// If `i` is not an index following a valid UTF-8 sequence.
     ///
     /// # Examples
     ///
-    /// This example manually iterates through the characters of a string;
+    /// This example manually iterates through the code points of a string;
     /// this should normally be
     /// done by `.chars().rev()` or `.char_indices()`.
     ///
@@ -630,7 +636,7 @@ impl str {
     /// # #![feature(str_char, core)]
     /// use std::str::CharRange;
     ///
-    /// let s = "中华Việt Nam";
+    /// let s = "中华Việt Nam";
     /// let mut i = s.len();
     /// while i > 0 {
     ///     let CharRange {ch, next} = s.char_range_at_reverse(i);
@@ -642,12 +648,14 @@ impl str {
     /// This outputs:
     ///
     /// ```text
-    /// 16: m
-    /// 15: a
-    /// 14: N
-    /// 13:
-    /// 12: t
-    /// 11: ệ
+    /// 18: m
+    /// 17: a
+    /// 16: N
+    /// 15:
+    /// 14: t
+    /// 13: ̂
+    /// 11: ̣
+    /// 9: e
     /// 8: i
     /// 7: V
     /// 6: 华
@@ -666,7 +674,7 @@ impl str {
     /// # Panics
     ///
     /// If `i` is greater than or equal to the length of the string.
-    /// If `i` is not the index of the beginning of a valid UTF-8 character.
+    /// If `i` is not the index of the beginning of a valid UTF-8 sequence.
     ///
     /// # Examples
     ///
@@ -675,6 +683,7 @@ impl str {
     /// let s = "abπc";
     /// assert_eq!(s.char_at(1), 'b');
     /// assert_eq!(s.char_at(2), 'π');
+    /// assert_eq!(s.char_at(4), 'c');
     /// ```
     #[unstable(feature = "str_char",
                reason = "frequently replaced by the chars() iterator, this \
@@ -692,7 +701,7 @@ impl str {
     /// # Panics
     ///
     /// If `i` is greater than the length of the string.
-    /// If `i` is not an index following a valid UTF-8 character.
+    /// If `i` is not an index following a valid UTF-8 sequence.
     ///
     /// # Examples
     ///
@@ -701,6 +710,7 @@ impl str {
     /// let s = "abπc";
     /// assert_eq!(s.char_at_reverse(1), 'a');
     /// assert_eq!(s.char_at_reverse(2), 'b');
+    /// assert_eq!(s.char_at_reverse(3), 'π');
     /// ```
     #[unstable(feature = "str_char",
                reason = "see char_at for more details, but reverse semantics \
@@ -710,28 +720,30 @@ impl str {
         core_str::StrExt::char_at_reverse(self, i)
     }
 
-    /// Retrieves the first character from a `&str` and returns it.
+    /// Retrieves the first code point from a `&str` and returns it.
+    ///
+    /// Note that a single Unicode character (grapheme cluster)
+    /// can be composed of multiple `char`s.
     ///
     /// This does not allocate a new string; instead, it returns a slice that
-    /// points one character
-    /// beyond the character that was shifted.
+    /// points one code point beyond the code point that was shifted.
     ///
-    /// If the slice does not contain any characters, None is returned instead.
+    /// `None` is returned if the slice is empty.
     ///
     /// # Examples
     ///
     /// ```
     /// # #![feature(str_char)]
-    /// let s = "Löwe 老虎 Léopard";
+    /// let s = "Łódź"; // \u{141}o\u{301}dz\u{301}
     /// let (c, s1) = s.slice_shift_char().unwrap();
     ///
-    /// assert_eq!(c, 'L');
-    /// assert_eq!(s1, "öwe 老虎 Léopard");
+    /// assert_eq!(c, 'Ł');
+    /// assert_eq!(s1, "ódź");
     ///
     /// let (c, s2) = s1.slice_shift_char().unwrap();
     ///
-    /// assert_eq!(c, 'ö');
-    /// assert_eq!(s2, "we 老虎 Léopard");
+    /// assert_eq!(c, 'o');
+    /// assert_eq!(s2, "\u{301}dz\u{301}");
     /// ```
     #[unstable(feature = "str_char",
                reason = "awaiting conventions about shifting and slices and \
@@ -744,14 +756,14 @@ impl str {
     /// Divide one string slice into two at an index.
     ///
     /// The index `mid` is a byte offset from the start of the string
-    /// that must be on a character boundary.
+    /// that must be on a `char` boundary.
     ///
     /// Return slices `&self[..mid]` and `&self[mid..]`.
     ///
     /// # Panics
     ///
-    /// Panics if `mid` is beyond the last character of the string,
-    /// or if it is not on a character boundary.
+    /// Panics if `mid` is beyond the last code point of the string,
+    /// or if it is not on a `char` boundary.
     ///
     /// # Examples
     /// ```
@@ -776,27 +788,39 @@ impl str {
         core_str::StrExt::split_at_mut(self, mid)
     }
 
-    /// An iterator over the codepoints of `self`.
+    /// An iterator over the code points of `self`.
+    ///
+    /// In Unicode relationship between code points and characters is complex.
+    /// A single character may be composed of multiple code points
+    /// (e.g. diacritical marks added to a letter), and a single code point
+    /// (e.g. Hangul syllable) may contain multiple characters.
+    ///
+    /// For iteration over human-readable characters a grapheme cluster iterator
+    /// may be more appropriate. See the [unicode-segmentation crate][1].
+    ///
+    /// [1]: https://crates.io/crates/unicode-segmentation
     ///
     /// # Examples
     ///
     /// ```
-    /// let v: Vec<char> = "abc åäö".chars().collect();
+    /// let v: Vec<char> = "ASCII żółć 🇨🇭 한".chars().collect();
     ///
-    /// assert_eq!(v, ['a', 'b', 'c', ' ', 'å', 'ä', 'ö']);
+    /// assert_eq!(v, ['A', 'S', 'C', 'I', 'I', ' ',
+    ///     'z', '\u{307}', 'o', '\u{301}', 'ł', 'c', '\u{301}', ' ',
+    ///     '\u{1f1e8}', '\u{1f1ed}', ' ', '한']);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     pub fn chars(&self) -> Chars {
         core_str::StrExt::chars(self)
     }
 
-    /// An iterator over the characters of `self` and their byte offsets.
+    /// An iterator over the `char`s of `self` and their byte offsets.
     ///
     /// # Examples
     ///
     /// ```
-    /// let v: Vec<(usize, char)> = "abc".char_indices().collect();
-    /// let b = vec![(0, 'a'), (1, 'b'), (2, 'c')];
+    /// let v: Vec<(usize, char)> = "A🇨🇭".char_indices().collect();
+    /// let b = vec![(0, 'A'), (1, '\u{1f1e8}'), (5, '\u{1f1ed}')];
     ///
     /// assert_eq!(v, b);
     /// ```
@@ -825,7 +849,7 @@ impl str {
     /// # Examples
     ///
     /// ```
-    /// let some_words = " Mary   had\ta little  \n\t lamb";
+    /// let some_words = " Mary   had\ta\u{2009}little  \n\t lamb";
     /// let v: Vec<&str> = some_words.split_whitespace().collect();
     ///
     /// assert_eq!(v, ["Mary", "had", "a", "little", "lamb"]);
@@ -843,7 +867,7 @@ impl str {
     /// ```
     /// # #![feature(str_words)]
     /// # #![allow(deprecated)]
-    /// let some_words = " Mary   had\ta little  \n\t lamb";
+    /// let some_words = " Mary   had\ta\u{2009}little  \n\t lamb";
     /// let v: Vec<&str> = some_words.words().collect();
     ///
     /// assert_eq!(v, ["Mary", "had", "a", "little", "lamb"]);
diff --git a/src/libcore/result.rs b/src/libcore/result.rs
index d87c1020dcc..2b33b1f83d2 100644
--- a/src/libcore/result.rs
+++ b/src/libcore/result.rs
@@ -744,7 +744,7 @@ impl<T, E: fmt::Debug> Result<T, E> {
     /// x.expect("Testing expect"); // panics with `Testing expect: emergency failure`
     /// ```
     #[inline]
-    #[unstable(feature = "result_expect", reason = "newly introduced")]
+    #[unstable(feature = "result_expect", reason = "newly introduced", issue = "27277")]
     pub fn expect(self, msg: &str) -> T {
         match self {
             Ok(t) => t,
diff --git a/src/librustc/diagnostics.rs b/src/librustc/diagnostics.rs
index 879a2d740cb..768f792d269 100644
--- a/src/librustc/diagnostics.rs
+++ b/src/librustc/diagnostics.rs
@@ -766,6 +766,9 @@ Example:
 ```
 type X = u32; // this compiles
 ```
+
+Note that type parameters for enum-variant constructors go after the variant,
+not after the enum (Option::None::<u32>, not Option::<u32>::None).
 "##,
 
 E0110: r##"
diff --git a/src/librustc/middle/check_match.rs b/src/librustc/middle/check_match.rs
index ea86fa318b4..7c02045d083 100644
--- a/src/librustc/middle/check_match.rs
+++ b/src/librustc/middle/check_match.rs
@@ -1016,18 +1016,8 @@ pub fn specialize<'a>(cx: &MatchCheckCtxt, r: &[&'a Pat],
 fn check_local(cx: &mut MatchCheckCtxt, loc: &ast::Local) {
     visit::walk_local(cx, loc);
 
-    let name = match loc.source {
-        ast::LocalLet => "local",
-        ast::LocalFor => "`for` loop"
-    };
-
-    let mut static_inliner = StaticInliner::new(cx.tcx, None);
-    is_refutable(cx, &*static_inliner.fold_pat(loc.pat.clone()), |pat| {
-        span_err!(cx.tcx.sess, loc.pat.span, E0005,
-            "refutable pattern in {} binding: `{}` not covered",
-            name, pat_to_string(pat)
-        );
-    });
+    let pat = StaticInliner::new(cx.tcx, None).fold_pat(loc.pat.clone());
+    check_irrefutable(cx, &pat, false);
 
     // Check legality of move bindings and `@` patterns.
     check_legality_of_move_bindings(cx, false, slice::ref_slice(&loc.pat));
@@ -1048,17 +1038,28 @@ fn check_fn(cx: &mut MatchCheckCtxt,
     visit::walk_fn(cx, kind, decl, body, sp);
 
     for input in &decl.inputs {
-        is_refutable(cx, &*input.pat, |pat| {
-            span_err!(cx.tcx.sess, input.pat.span, E0005,
-                "refutable pattern in function argument: `{}` not covered",
-                pat_to_string(pat)
-            );
-        });
+        check_irrefutable(cx, &input.pat, true);
         check_legality_of_move_bindings(cx, false, slice::ref_slice(&input.pat));
         check_legality_of_bindings_in_at_patterns(cx, &*input.pat);
     }
 }
 
+fn check_irrefutable(cx: &MatchCheckCtxt, pat: &Pat, is_fn_arg: bool) {
+    let origin = if is_fn_arg {
+        "function argument"
+    } else {
+        "local binding"
+    };
+
+    is_refutable(cx, pat, |uncovered_pat| {
+        span_err!(cx.tcx.sess, pat.span, E0005,
+            "refutable pattern in {}: `{}` not covered",
+            origin,
+            pat_to_string(uncovered_pat),
+        );
+    });
+}
+
 fn is_refutable<A, F>(cx: &MatchCheckCtxt, pat: &Pat, refutable: F) -> Option<A> where
     F: FnOnce(&Pat) -> A,
 {
diff --git a/src/librustc_lint/builtin.rs b/src/librustc_lint/builtin.rs
index 6289d505881..751224e7286 100644
--- a/src/librustc_lint/builtin.rs
+++ b/src/librustc_lint/builtin.rs
@@ -436,6 +436,16 @@ fn is_repr_nullable_ptr<'tcx>(variants: &Vec<Rc<ty::VariantInfo<'tcx>>>) -> bool
     false
 }
 
+fn ast_ty_to_normalized<'tcx>(tcx: &ty::ctxt<'tcx>,
+                              id: ast::NodeId)
+                              -> Ty<'tcx> {
+    let tty = match tcx.ast_ty_to_ty_cache.borrow().get(&id) {
+        Some(&t) => t,
+        None => panic!("ast_ty_to_ty_cache was incomplete after typeck!")
+    };
+    infer::normalize_associated_type(tcx, &tty)
+}
+
 impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
     /// Check if the given type is "ffi-safe" (has a stable, well-defined
     /// representation which can be exported to C code).
@@ -638,11 +648,7 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
     }
 
     fn check_def(&mut self, sp: Span, id: ast::NodeId) {
-        let tty = match self.cx.tcx.ast_ty_to_ty_cache.borrow().get(&id) {
-            Some(&t) => t,
-            None => panic!("ast_ty_to_ty_cache was incomplete after typeck!")
-        };
-        let tty = infer::normalize_associated_type(self.cx.tcx, &tty);
+        let tty = ast_ty_to_normalized(self.cx.tcx, id);
 
         match ImproperCTypesVisitor::check_type_for_ffi(self, &mut FnvHashSet(), tty) {
             FfiResult::FfiSafe => {}
@@ -707,7 +713,10 @@ impl LintPass for ImproperCTypes {
                 check_ty(cx, &*input.ty);
             }
             if let ast::Return(ref ret_ty) = decl.output {
-                check_ty(cx, &**ret_ty);
+                let tty = ast_ty_to_normalized(cx.tcx, ret_ty.id);
+                if !tty.is_nil() {
+                    check_ty(cx, &ret_ty);
+                }
             }
         }
 
diff --git a/src/librustc_resolve/diagnostics.rs b/src/librustc_resolve/diagnostics.rs
index 9f8a5c90d4e..5ddc2547fd9 100644
--- a/src/librustc_resolve/diagnostics.rs
+++ b/src/librustc_resolve/diagnostics.rs
@@ -397,6 +397,115 @@ impl Bar {
 ```
 "##,
 
+E0417: r##"
+A static variable was referenced in a pattern. Example of erroneous code:
+
+```
+static FOO : i32 = 0;
+
+match 0 {
+    FOO => {} // error: static variables cannot be referenced in a
+              //        pattern, use a `const` instead
+    _ => {}
+}
+```
+
+The compiler needs to know the value of the pattern at compile time;
+compile-time patterns can defined via const or enum items. Please verify
+that the identifier is spelled correctly, and if so, use a const instead
+of static to define it. Example:
+
+```
+const FOO : i32 = 0;
+
+match 0 {
+    FOO => {} // ok!
+    _ => {}
+}
+```
+"##,
+
+E0424: r##"
+The `self` keyword was used in a static method. Example of erroneous code:
+
+```
+struct Foo;
+
+impl Foo {
+    fn bar(self) {}
+
+    fn foo() {
+        self.bar(); // error: `self` is not available in a static method.
+    }
+}
+```
+
+Please check if the method's argument list should have contained `self`,
+`&self`, or `&mut self` (in case you didn't want to create a static
+method), and add it if so. Example:
+
+```
+struct Foo;
+
+impl Foo {
+    fn bar(self) {}
+
+    fn foo(self) {
+        self.bar(); // ok!
+    }
+}
+```
+"##,
+
+E0425: r##"
+An unresolved name was used. Example of erroneous codes:
+
+```
+something_that_doesnt_exist::foo;
+// error: unresolved name `something_that_doesnt_exist::foo`
+
+// or:
+trait Foo {
+    fn bar() {
+        Self; // error: unresolved name `Self`
+    }
+}
+```
+
+Please verify you didn't misspell the name or that you're not using an
+invalid object. Example:
+
+```
+enum something_that_does_exist {
+    foo
+}
+// or:
+mod something_that_does_exist {
+    pub static foo : i32 = 0i32;
+}
+
+something_that_does_exist::foo; // ok!
+```
+"##,
+
+E0426: r##"
+An undeclared label was used. Example of erroneous code:
+
+```
+loop {
+    break 'a; // error: use of undeclared label `'a`
+}
+```
+
+Please verify you spelt or declare the label correctly. Example:
+
+```
+'a: loop {
+    break 'a; // ok!
+}
+```
+"##,
+
 E0428: r##"
 A type or module has been defined more than once. Example of erroneous
 code:
@@ -415,6 +524,53 @@ struct Bar2; // ok!
 ```
 "##,
 
+E0430: r##"
+The `self` import appears more than once in the list. Erroneous code example:
+
+```
+use something::{self, self}; // error: `self` import can only appear once in
+                             //        the list
+```
+
+Please verify you didn't misspell the import name or remove the duplicated
+`self` import. Example:
+
+```
+use something::self; // ok!
+```
+"##,
+
+E0431: r##"
+`self` import was made. Erroneous code example:
+
+```
+use {self}; // error: `self` import can only appear in an import list with a
+            //        non-empty prefix
+```
+
+You cannot import the current module into itself, please remove this import
+or verify you didn't misspell it.
+"##,
+
+E0432: r##"
+An import was unresolved. Erroneous code example:
+
+```
+use something::Foo; // error: unresolved import `something::Foo`.
+```
+
+Please verify you didn't misspell the import name or the import does exist
+in the module from where you tried to import it. Example:
+
+```
+use something::Foo; // ok!
+
+mod something {
+    pub struct Foo;
+}
+```
+"##,
+
 E0433: r##"
 Invalid import. Example of erroneous code:
 
@@ -499,8 +655,6 @@ register_diagnostics! {
     E0414, // only irrefutable patterns allowed here
     E0415, // identifier is bound more than once in this parameter list
     E0416, // identifier is bound more than once in the same pattern
-    E0417, // static variables cannot be referenced in a pattern, use a
-           // `const` instead
     E0418, // is not an enum variant, struct or const
     E0419, // unresolved enum variant, struct or const
     E0420, // is not an associated const
@@ -508,15 +662,8 @@ register_diagnostics! {
     E0422, // does not name a structure
     E0423, // is a struct variant name, but this expression uses it like a
            // function name
-    E0424, // `self` is not available in a static method.
-    E0425, // unresolved name
-    E0426, // use of undeclared label
     E0427, // cannot use `ref` binding mode with ...
     E0429, // `self` imports are only allowed within a { } list
-    E0430, // `self` import can only appear once in the list
-    E0431, // `self` import can only appear in an import list with a non-empty
-           // prefix
-    E0432, // unresolved import
     E0434, // can't capture dynamic environment in a fn item
     E0435, // attempt to use a non-constant value in a constant
 }
diff --git a/src/librustc_trans/back/msvc/mod.rs b/src/librustc_trans/back/msvc/mod.rs
index 0077e7eed52..bc0573d8281 100644
--- a/src/librustc_trans/back/msvc/mod.rs
+++ b/src/librustc_trans/back/msvc/mod.rs
@@ -42,7 +42,8 @@ pub fn link_exe_cmd(sess: &Session) -> Command {
     use std::env;
     use std::ffi::OsString;
     use std::fs;
-    use std::path::PathBuf;
+    use std::io;
+    use std::path::{Path, PathBuf};
     use self::registry::{RegistryKey, LOCAL_MACHINE};
 
     // When finding the link.exe binary the 32-bit version is at the top level
@@ -103,9 +104,16 @@ pub fn link_exe_cmd(sess: &Session) -> Command {
     // VS shells, so we only want to start adding our own pieces if it's not
     // set.
     //
-    // If we're adding our own pieces, then we need to add two primary
+    // If we're adding our own pieces, then we need to add a few primary
     // directories to the default search path for the linker. The first is in
-    // the VS install direcotry and the next is the Windows SDK directory.
+    // the VS install direcotry, the next is the Windows SDK directory, and the
+    // last is the possible UCRT installation directory.
+    //
+    // The UCRT is a recent addition to Visual Studio installs (2015 at the time
+    // of this writing), and it's in the normal windows SDK folder, but there
+    // apparently aren't registry keys pointing to it. As a result we detect the
+    // installation and then add it manually. This logic will probably need to
+    // be tweaked over time...
     if env::var_os("LIB").is_none() {
         if let Some(mut vs_install_dir) = vs_install_dir {
             vs_install_dir.push("VC/lib");
@@ -113,6 +121,15 @@ pub fn link_exe_cmd(sess: &Session) -> Command {
             let mut arg = OsString::from("/LIBPATH:");
             arg.push(&vs_install_dir);
             cmd.arg(arg);
+
+            if let Some((ucrt_root, vers)) = ucrt_install_dir(&vs_install_dir) {
+                if let Some(arch) = windows_sdk_v8_subdir(sess) {
+                    let mut arg = OsString::from("/LIBPATH:");
+                    arg.push(ucrt_root.join("Lib").join(vers)
+                                      .join("ucrt").join(arch));
+                    cmd.arg(arg);
+                }
+            }
         }
         if let Some(path) = get_windows_sdk_lib_path(sess) {
             let mut arg = OsString::from("/LIBPATH:");
@@ -189,7 +206,7 @@ pub fn link_exe_cmd(sess: &Session) -> Command {
         return max_key
     }
 
-    fn get_windows_sdk_lib_path(sess: &Session) -> Option<PathBuf> {
+    fn get_windows_sdk_path() -> Option<(PathBuf, usize)> {
         let key = r"SOFTWARE\Microsoft\Microsoft SDKs\Windows";
         let key = LOCAL_MACHINE.open(key.as_ref());
         let (n, k) = match key.ok().as_ref().and_then(max_version) {
@@ -199,10 +216,17 @@ pub fn link_exe_cmd(sess: &Session) -> Command {
         let mut parts = n.to_str().unwrap().trim_left_matches("v").splitn(2, ".");
         let major = parts.next().unwrap().parse::<usize>().unwrap();
         let _minor = parts.next().unwrap().parse::<usize>().unwrap();
-        let path = match k.query_str("InstallationFolder") {
-            Ok(p) => PathBuf::from(p).join("Lib"),
-            Err(..) => return None,
+        k.query_str("InstallationFolder").ok().map(|folder| {
+            (PathBuf::from(folder), major)
+        })
+    }
+
+    fn get_windows_sdk_lib_path(sess: &Session) -> Option<PathBuf> {
+        let (mut path, major) = match get_windows_sdk_path() {
+            Some(p) => p,
+            None => return None,
         };
+        path.push("Lib");
         if major <= 7 {
             // In Windows SDK 7.x, x86 libraries are directly in the Lib folder,
             // x64 libraries are inside, and it's not necessary to link agains
@@ -218,11 +242,9 @@ pub fn link_exe_cmd(sess: &Session) -> Command {
             // depend on the version of the OS you're targeting. By default
             // choose the newest, which usually corresponds to the version of
             // the OS you've installed the SDK on.
-            let extra = match &sess.target.target.arch[..] {
-                "x86" => "x86",
-                "x86_64" => "x64",
-                "arm" => "arm",
-                _ => return None,
+            let extra = match windows_sdk_v8_subdir(sess) {
+                Some(e) => e,
+                None => return None,
             };
             ["winv6.3", "win8", "win7"].iter().map(|p| path.join(p)).find(|part| {
                 fs::metadata(part).is_ok()
@@ -231,6 +253,48 @@ pub fn link_exe_cmd(sess: &Session) -> Command {
             })
         }
     }
+
+    fn windows_sdk_v8_subdir(sess: &Session) -> Option<&'static str> {
+        match &sess.target.target.arch[..] {
+            "x86" => Some("x86"),
+            "x86_64" => Some("x64"),
+            "arm" => Some("arm"),
+            _ => return None,
+        }
+    }
+
+    fn ucrt_install_dir(vs_install_dir: &Path) -> Option<(PathBuf, String)> {
+        let is_vs_14 = vs_install_dir.iter().filter_map(|p| p.to_str()).any(|s| {
+            s == "Microsoft Visual Studio 14.0"
+        });
+        if !is_vs_14 {
+            return None
+        }
+        let key = r"SOFTWARE\Microsoft\Windows Kits\Installed Roots";
+        let sdk_dir = LOCAL_MACHINE.open(key.as_ref()).and_then(|p| {
+            p.query_str("KitsRoot10")
+        }).map(PathBuf::from);
+        let sdk_dir = match sdk_dir {
+            Ok(p) => p,
+            Err(..) => return None,
+        };
+        (move || -> io::Result<_> {
+            let mut max = None;
+            let mut max_s = None;
+            for entry in try!(fs::read_dir(&sdk_dir.join("Lib"))) {
+                let entry = try!(entry);
+                if let Ok(s) = entry.file_name().into_string() {
+                    if let Ok(u) = s.replace(".", "").parse::<usize>() {
+                        if Some(u) > max {
+                            max = Some(u);
+                            max_s = Some(s);
+                        }
+                    }
+                }
+            }
+            Ok(max_s.map(|m| (sdk_dir, m)))
+        })().ok().and_then(|x| x)
+    }
 }
 
 #[cfg(not(windows))]
diff --git a/src/librustc_trans/trans/base.rs b/src/librustc_trans/trans/base.rs
index c331bf8d461..3d9989e093c 100644
--- a/src/librustc_trans/trans/base.rs
+++ b/src/librustc_trans/trans/base.rs
@@ -227,7 +227,6 @@ pub fn get_extern_const<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, did: ast::DefId,
     // FIXME(nagisa): perhaps the map of externs could be offloaded to llvm somehow?
     // FIXME(nagisa): investigate whether it can be changed into define_global
     let c = declare::declare_global(ccx, &name[..], ty);
-
     // Thread-local statics in some other crate need to *always* be linked
     // against in a thread-local fashion, so we need to be sure to apply the
     // thread-local attribute locally if it was present remotely. If we
@@ -239,42 +238,7 @@ pub fn get_extern_const<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, did: ast::DefId,
             llvm::set_thread_local(c, true);
         }
     }
-
-    // MSVC is a little ornery about how items are imported across dlls, and for
-    // lots more info on dllimport/dllexport see the large comment in
-    // SharedCrateContext::new. Unfortunately, unlike functions, statics
-    // imported from dlls *must* be tagged with dllimport (if you forget
-    // dllimport on a function then the linker fixes it up with an injected
-    // shim). This means that to link correctly to an upstream Rust dynamic
-    // library we need to make sure its statics are tagged with dllimport.
-    //
-    // Hence, if this translation is using dll storage attributes and the crate
-    // that this const originated from is being imported as a dylib at some
-    // point we tag this with dllimport.
-    //
-    // Note that this is not 100% correct for a variety of reasons:
-    //
-    // 1. If we are producing an rlib and linking to an upstream rlib, we'll
-    //    omit the dllimport. It's a possibility, though, that some later
-    //    downstream compilation will link the same upstream dependency as a
-    //    dylib and use our rlib, causing linker errors because we didn't use
-    //    dllimport.
-    // 2. We may have multiple crate output types. For example if we are
-    //    emitting a statically linked binary as well as a dynamic library we'll
-    //    want to omit dllimport for the binary but we need to have it for the
-    //    dylib.
-    //
-    // For most every day uses, however, this should suffice. During the
-    // bootstrap we're almost always linking upstream to a dylib for some crate
-    // type output, so most imports will be tagged with dllimport (somewhat
-    // appropriately). Otherwise rust dylibs linking against rust dylibs is
-    // pretty rare in Rust so this will likely always be `false` and we'll never
-    // tag with dllimport.
-    //
-    // Note that we can't just blindly tag all constants with dllimport as can
-    // cause linkage errors when we're not actually linking against a dll. For
-    // more info on this see rust-lang/rust#26591.
-    if ccx.use_dll_storage_attrs() && ccx.upstream_dylib_used(did.krate) {
+    if ccx.use_dll_storage_attrs() {
         llvm::SetDLLStorageClass(c, llvm::DLLImportStorageClass);
     }
     ccx.externs().borrow_mut().insert(name.to_string(), c);
diff --git a/src/librustc_trans/trans/context.rs b/src/librustc_trans/trans/context.rs
index 1b6307f28bf..235538f62c2 100644
--- a/src/librustc_trans/trans/context.rs
+++ b/src/librustc_trans/trans/context.rs
@@ -11,7 +11,6 @@
 use llvm;
 use llvm::{ContextRef, ModuleRef, ValueRef, BuilderRef};
 use metadata::common::LinkMeta;
-use metadata::cstore;
 use middle::def::ExportMap;
 use middle::traits;
 use trans::adt;
@@ -788,29 +787,6 @@ impl<'b, 'tcx> CrateContext<'b, 'tcx> {
     pub fn use_dll_storage_attrs(&self) -> bool {
         self.shared.use_dll_storage_attrs()
     }
-
-    /// Tests whether the given `krate` (an upstream crate) is ever used as a
-    /// dynamic library for the final linkage of this crate.
-    pub fn upstream_dylib_used(&self, krate: ast::CrateNum) -> bool {
-        let tcx = self.tcx();
-        let formats = tcx.dependency_formats.borrow();
-        tcx.sess.crate_types.borrow().iter().any(|ct| {
-            match formats[ct].get(krate as usize - 1) {
-                // If a crate is explicitly linked dynamically then we're
-                // definitely using it dynamically. If it's not being linked
-                // then currently that means it's being included through another
-                // dynamic library, so we're including it dynamically.
-                Some(&Some(cstore::RequireDynamic)) |
-                Some(&None) => true,
-
-                // Static linkage isn't included dynamically and if there's not
-                // an entry in the array then this crate type isn't actually
-                // doing much linkage so there's nothing dynamic going on.
-                Some(&Some(cstore::RequireStatic)) |
-                None => false,
-            }
-        })
-    }
 }
 
 /// Declare any llvm intrinsics that you might need
diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs
index 85df5d67ff6..0c60cdc4ca2 100644
--- a/src/librustc_typeck/check/mod.rs
+++ b/src/librustc_typeck/check/mod.rs
@@ -2490,7 +2490,7 @@ fn check_argument_types<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
                 // The special-cased logic below has three functions:
                 // 1. Provide as good of an expected type as possible.
                 let expected = expected_arg_tys.get(i).map(|&ty| {
-                    Expectation::rvalue_hint(ty)
+                    Expectation::rvalue_hint(fcx.tcx(), ty)
                 });
 
                 check_expr_with_unifier(fcx, &**arg,
@@ -3268,7 +3268,7 @@ fn check_expr_with_unifier<'a, 'tcx, F>(fcx: &FnCtxt<'a, 'tcx>,
             match unop {
                 ast::UnUniq => match ty.sty {
                     ty::TyBox(ty) => {
-                        Expectation::rvalue_hint(ty)
+                        Expectation::rvalue_hint(tcx, ty)
                     }
                     _ => {
                         NoExpectation
@@ -3345,7 +3345,7 @@ fn check_expr_with_unifier<'a, 'tcx, F>(fcx: &FnCtxt<'a, 'tcx>,
                         // the last field of a struct can be unsized.
                         ExpectHasType(mt.ty)
                     } else {
-                        Expectation::rvalue_hint(mt.ty)
+                        Expectation::rvalue_hint(tcx, mt.ty)
                     }
                 }
                 _ => NoExpectation
@@ -3982,8 +3982,8 @@ impl<'tcx> Expectation<'tcx> {
     /// which still is useful, because it informs integer literals and the like.
     /// See the test case `test/run-pass/coerce-expect-unsized.rs` and #20169
     /// for examples of where this comes up,.
-    fn rvalue_hint(ty: Ty<'tcx>) -> Expectation<'tcx> {
-        match ty.sty {
+    fn rvalue_hint(tcx: &ty::ctxt<'tcx>, ty: Ty<'tcx>) -> Expectation<'tcx> {
+        match tcx.struct_tail(ty).sty {
             ty::TySlice(_) | ty::TyTrait(..) => {
                 ExpectRvalueLikeUnsized(ty)
             }
diff --git a/src/librustc_typeck/check/upvar.rs b/src/librustc_typeck/check/upvar.rs
index 0e3fa654efa..f9b7a330816 100644
--- a/src/librustc_typeck/check/upvar.rs
+++ b/src/librustc_typeck/check/upvar.rs
@@ -93,22 +93,8 @@ impl<'a, 'tcx, 'v> Visitor<'v> for SeedBorrowKind<'a, 'tcx> {
         visit::walk_expr(self, expr);
     }
 
-    fn visit_fn(&mut self,
-                fn_kind: visit::FnKind<'v>,
-                decl: &'v ast::FnDecl,
-                block: &'v ast::Block,
-                span: Span,
-                _id: ast::NodeId)
-    {
-        match fn_kind {
-            visit::FkItemFn(..) | visit::FkMethod(..) => {
-                // ignore nested fn items
-            }
-            visit::FkFnBlock => {
-                visit::walk_fn(self, fn_kind, decl, block, span);
-            }
-        }
-    }
+    // Skip all items; they aren't in the same context.
+    fn visit_item(&mut self, _: &'v ast::Item) { }
 }
 
 impl<'a,'tcx> SeedBorrowKind<'a,'tcx> {
@@ -515,16 +501,12 @@ impl<'a, 'tcx, 'v> Visitor<'v> for AdjustBorrowKind<'a, 'tcx> {
                 span: Span,
                 id: ast::NodeId)
     {
-        match fn_kind {
-            visit::FkItemFn(..) | visit::FkMethod(..) => {
-                // ignore nested fn items
-            }
-            visit::FkFnBlock => {
-                visit::walk_fn(self, fn_kind, decl, body, span);
-                self.analyze_closure(id, span, decl, body);
-            }
-        }
+        visit::walk_fn(self, fn_kind, decl, body, span);
+        self.analyze_closure(id, span, decl, body);
     }
+
+    // Skip all items; they aren't in the same context.
+    fn visit_item(&mut self, _: &'v ast::Item) { }
 }
 
 impl<'a,'tcx> euv::Delegate<'tcx> for AdjustBorrowKind<'a,'tcx> {
diff --git a/src/libstd/rand/os.rs b/src/libstd/rand/os.rs
index fc9585d9190..3f75c8bca83 100644
--- a/src/libstd/rand/os.rs
+++ b/src/libstd/rand/os.rs
@@ -41,8 +41,10 @@ mod imp {
         const NR_GETRANDOM: libc::c_long = 318;
         #[cfg(target_arch = "x86")]
         const NR_GETRANDOM: libc::c_long = 355;
-        #[cfg(any(target_arch = "arm", target_arch = "aarch64", target_arch = "powerpc"))]
+        #[cfg(any(target_arch = "arm", target_arch = "powerpc"))]
         const NR_GETRANDOM: libc::c_long = 384;
+        #[cfg(any(target_arch = "aarch64"))]
+        const NR_GETRANDOM: libc::c_long = 278;
 
         unsafe {
             syscall(NR_GETRANDOM, buf.as_mut_ptr(), buf.len(), 0)
@@ -185,7 +187,7 @@ mod imp {
     use io;
     use mem;
     use rand::Rng;
-    use libc::{c_int, size_t};
+    use libc::{c_int, c_void, size_t};
 
     /// A random number generator that retrieves randomness straight from
     /// the operating system. Platform sources:
@@ -203,8 +205,9 @@ mod imp {
         _dummy: (),
     }
 
-    #[repr(C)]
-    struct SecRandom;
+    // Fake definition; this is actually a struct, but we don't use the
+    // contents here.
+    type SecRandom = c_void;
 
     #[allow(non_upper_case_globals)]
     const kSecRandomDefault: *const SecRandom = 0 as *const SecRandom;
diff --git a/src/libstd/thread/mod.rs b/src/libstd/thread/mod.rs
index 20fcd309a6b..3388968c56c 100644
--- a/src/libstd/thread/mod.rs
+++ b/src/libstd/thread/mod.rs
@@ -85,33 +85,6 @@
 //! value produced by the child thread, or `Err` of the value given to
 //! a call to `panic!` if the child panicked.
 //!
-//! ## Scoped threads
-//!
-//! The `spawn` method does not allow the child and parent threads to
-//! share any stack data, since that is not safe in general. However,
-//! `scoped` makes it possible to share the parent's stack by forcing
-//! a join before any relevant stack frames are popped:
-//!
-//! ```rust
-//! # #![feature(scoped)]
-//! use std::thread;
-//!
-//! let guard = thread::scoped(move || {
-//!     // some work here
-//! });
-//!
-//! // do some other work in the meantime
-//! let output = guard.join();
-//! ```
-//!
-//! The `scoped` function doesn't return a `Thread` directly; instead,
-//! it returns a *join guard*. The join guard is an RAII-style guard
-//! that will automatically join the child thread (block until it
-//! terminates) when it is dropped. You can join the child thread in
-//! advance by calling the `join` method on the guard, which will also
-//! return the result produced by the thread.  A handle to the thread
-//! itself is available via the `thread` method of the join guard.
-//!
 //! ## Configuring threads
 //!
 //! A new thread can be configured before it is spawned via the `Builder` type,
@@ -288,7 +261,7 @@ impl Builder {
     /// upon being dropped. Because the child thread may refer to data on the
     /// current thread's stack (hence the "scoped" name), it cannot be detached;
     /// it *must* be joined before the relevant stack frame is popped. See the
-    /// module documentation for additional details.
+    /// documentation on `thread::scoped` for additional details.
     ///
     /// # Errors
     ///
@@ -388,12 +361,30 @@ pub fn spawn<F, T>(f: F) -> JoinHandle<T> where
 
 /// Spawns a new *scoped* thread, returning a `JoinGuard` for it.
 ///
-/// The join guard can be used to explicitly join the child thread (via
-/// `join`), returning `Result<T>`, or it will implicitly join the child
-/// upon being dropped. Because the child thread may refer to data on the
-/// current thread's stack (hence the "scoped" name), it cannot be detached;
-/// it *must* be joined before the relevant stack frame is popped. See the
-/// module documentation for additional details.
+/// The `spawn` method does not allow the child and parent threads to
+/// share any stack data, since that is not safe in general. However,
+/// `scoped` makes it possible to share the parent's stack by forcing
+/// a join before any relevant stack frames are popped:
+///
+/// ```rust
+/// # #![feature(scoped)]
+/// use std::thread;
+///
+/// let guard = thread::scoped(move || {
+///     // some work here
+/// });
+///
+/// // do some other work in the meantime
+/// let output = guard.join();
+/// ```
+///
+/// The `scoped` function doesn't return a `Thread` directly; instead, it
+/// returns a *join guard*. The join guard can be used to explicitly join
+/// the child thread (via `join`), returning `Result<T>`, or it will
+/// implicitly join the child upon being dropped. Because the child thread
+/// may refer to data on the current thread's stack (hence the "scoped"
+/// name), it cannot be detached; it *must* be joined before the relevant
+/// stack frame is popped.
 ///
 /// # Panics
 ///
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs
index fba9db401db..72711f2ed18 100644
--- a/src/libsyntax/ast.rs
+++ b/src/libsyntax/ast.rs
@@ -29,7 +29,6 @@ pub use self::Item_::*;
 pub use self::KleeneOp::*;
 pub use self::Lit_::*;
 pub use self::LitIntType::*;
-pub use self::LocalSource::*;
 pub use self::Mac_::*;
 pub use self::MacStmtStyle::*;
 pub use self::MetaItem_::*;
@@ -756,14 +755,6 @@ pub enum MacStmtStyle {
     MacStmtWithoutBraces,
 }
 
-/// Where a local declaration came from: either a true `let ... =
-/// ...;`, or one desugared from the pattern of a for loop.
-#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)]
-pub enum LocalSource {
-    LocalLet,
-    LocalFor,
-}
-
 // FIXME (pending discussion of #1697, #2178...): local should really be
 // a refinement on pat.
 /// Local represents a `let` statement, e.g., `let <pat>:<ty> = <expr>;`
@@ -775,7 +766,6 @@ pub struct Local {
     pub init: Option<P<Expr>>,
     pub id: NodeId,
     pub span: Span,
-    pub source: LocalSource,
 }
 
 pub type Decl = Spanned<Decl_>;
diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs
index 8a80e291a53..79210cb3260 100644
--- a/src/libsyntax/ext/build.rs
+++ b/src/libsyntax/ext/build.rs
@@ -538,7 +538,6 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
             init: Some(ex),
             id: ast::DUMMY_NODE_ID,
             span: sp,
-            source: ast::LocalLet,
         });
         let decl = respan(sp, ast::DeclLocal(local));
         P(respan(sp, ast::StmtDecl(P(decl), ast::DUMMY_NODE_ID)))
@@ -562,7 +561,6 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
             init: Some(ex),
             id: ast::DUMMY_NODE_ID,
             span: sp,
-            source: ast::LocalLet,
         });
         let decl = respan(sp, ast::DeclLocal(local));
         P(respan(sp, ast::StmtDecl(P(decl), ast::DUMMY_NODE_ID)))
diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs
index faa1e5b2f51..286dc91299f 100644
--- a/src/libsyntax/ext/expand.rs
+++ b/src/libsyntax/ext/expand.rs
@@ -911,7 +911,7 @@ fn expand_non_macro_stmt(Spanned {node, span: stmt_span}: Stmt, fld: &mut MacroE
         StmtDecl(decl, node_id) => decl.and_then(|Spanned {node: decl, span}| match decl {
             DeclLocal(local) => {
                 // take it apart:
-                let rewritten_local = local.map(|Local {id, pat, ty, init, source, span}| {
+                let rewritten_local = local.map(|Local {id, pat, ty, init, span}| {
                     // expand the ty since TyFixedLengthVec contains an Expr
                     // and thus may have a macro use
                     let expanded_ty = ty.map(|t| fld.fold_ty(t));
@@ -941,7 +941,6 @@ fn expand_non_macro_stmt(Spanned {node, span: stmt_span}: Stmt, fld: &mut MacroE
                         pat: rewritten_pat,
                         // also, don't forget to expand the init:
                         init: init.map(|e| fld.fold_expr(e)),
-                        source: source,
                         span: span
                     }
                 });
diff --git a/src/libsyntax/fold.rs b/src/libsyntax/fold.rs
index 14742d2e74c..dab6d41df30 100644
--- a/src/libsyntax/fold.rs
+++ b/src/libsyntax/fold.rs
@@ -515,12 +515,11 @@ pub fn noop_fold_parenthesized_parameter_data<T: Folder>(data: ParenthesizedPara
 }
 
 pub fn noop_fold_local<T: Folder>(l: P<Local>, fld: &mut T) -> P<Local> {
-    l.map(|Local {id, pat, ty, init, source, span}| Local {
+    l.map(|Local {id, pat, ty, init, span}| Local {
         id: fld.new_id(id),
         ty: ty.map(|t| fld.fold_ty(t)),
         pat: fld.fold_pat(pat),
         init: init.map(|e| fld.fold_expr(e)),
-        source: source,
         span: fld.new_span(span)
     })
 }
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index c2a2259a80a..04665140e2f 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -35,7 +35,7 @@ use ast::{ItemMac, ItemMod, ItemStruct, ItemTrait, ItemTy, ItemDefaultImpl};
 use ast::{ItemExternCrate, ItemUse};
 use ast::{LifetimeDef, Lit, Lit_};
 use ast::{LitBool, LitChar, LitByte, LitBinary};
-use ast::{LitStr, LitInt, Local, LocalLet};
+use ast::{LitStr, LitInt, Local};
 use ast::{MacStmtWithBraces, MacStmtWithSemicolon, MacStmtWithoutBraces};
 use ast::{MutImmutable, MutMutable, Mac_, MacInvocTT, MatchSource};
 use ast::{MutTy, BiMul, Mutability};
@@ -3432,7 +3432,6 @@ impl<'a> Parser<'a> {
             init: init,
             id: ast::DUMMY_NODE_ID,
             span: mk_sp(lo, self.last_span.hi),
-            source: LocalLet,
         }))
     }
 
diff --git a/src/rustbook/build.rs b/src/rustbook/build.rs
index a7a6ed3bfe7..3ac71c167cd 100644
--- a/src/rustbook/build.rs
+++ b/src/rustbook/build.rs
@@ -22,7 +22,7 @@ use term::Term;
 use error::{err, CliResult, CommandResult};
 use book;
 use book::{Book, BookItem};
-use css;
+
 use javascript;
 
 use rustdoc;
@@ -195,9 +195,16 @@ impl Subcommand for Build {
         }
         try!(fs::create_dir(&tgt));
 
-        try!(File::create(&tgt.join("rust-book.css")).and_then(|mut f| {
-            f.write_all(css::STYLE.as_bytes())
-        }));
+        // Copy static files
+        let css = include_bytes!("static/rustbook.css");
+        let js = include_bytes!("static/rustbook.js");
+
+        let mut css_file = try!(File::create(tgt.join("rust-book.css")));
+        try!(css_file.write_all(css));
+
+        let mut js_file = try!(File::create(tgt.join("rust-book.js")));
+        try!(js_file.write_all(js));
+
 
         let mut summary = try!(File::open(&src.join("SUMMARY.md")));
         match book::parse_summary(&mut summary, &src) {
diff --git a/src/rustbook/javascript.rs b/src/rustbook/javascript.rs
index 8e530bee39a..beddc23fe2b 100644
--- a/src/rustbook/javascript.rs
+++ b/src/rustbook/javascript.rs
@@ -11,67 +11,6 @@
 // The rust-book JavaScript in string form.
 
 pub static JAVASCRIPT: &'static str = r#"
-<script type="text/javascript">
-document.addEventListener("DOMContentLoaded", function(event) {
-  document.getElementById("toggle-nav").onclick = toggleNav;
-  function toggleNav() {
-    var toc = document.getElementById("toc");
-    var pagewrapper = document.getElementById("page-wrapper");
-    toggleClass(toc, "mobile-hidden");
-    toggleClass(pagewrapper, "mobile-hidden");
-  };
-
-  function toggleClass(el, className) {
-     // from http://youmightnotneedjquery.com/
-     if (el.classList) {
-       el.classList.toggle(className);
-     } else {
-       var classes = el.className.split(' ');
-       var existingIndex = classes.indexOf(className);
-
-       if (existingIndex >= 0) {
-         classes.splice(existingIndex, 1);
-       } else {
-         classes.push(className);
-       }
-
-       el.className = classes.join(' ');
-     }
-  }
-
-  // The below code is used to add prev and next navigation links to the bottom
-  // of each of the sections.
-  // It works by extracting the current page based on the url and iterates over
-  // the menu links until it finds the menu item for the current page. We then
-  // create a copy of the preceding and following menu links and add the
-  // correct css class and insert them into the bottom of the page.
-  var toc = document.getElementById('toc').getElementsByTagName('a');
-  var href = document.location.pathname.split('/').pop();
-  if (href === 'index.html' || href === '') {
-    href = 'README.html';
-  }
-
-  for (var i = 0; i < toc.length; i++) {
-    if (toc[i].attributes['href'].value.split('/').pop() === href) {
-      var nav = document.createElement('p');
-      if (i > 0) {
-        var prevNode = toc[i-1].cloneNode(true);
-        prevNode.className = 'left';
-        prevNode.setAttribute('rel', 'prev');
-        nav.appendChild(prevNode);
-      }
-      if (i < toc.length - 1) {
-        var nextNode = toc[i+1].cloneNode(true);
-        nextNode.className = 'right';
-        nextNode.setAttribute('rel', 'next');
-        nav.appendChild(nextNode);
-      }
-      document.getElementById('page').appendChild(nav);
-      break;
-    }
-  }
-
-});
-</script>
+<script type="text/javascript" src="rust-book.js"></script>
 <script type="text/javascript" src="playpen.js"></script>
 "#;
diff --git a/src/rustbook/main.rs b/src/rustbook/main.rs
index acb1c5cbd90..81f8c8c40fd 100644
--- a/src/rustbook/main.rs
+++ b/src/rustbook/main.rs
@@ -35,7 +35,6 @@ mod build;
 mod serve;
 mod test;
 
-mod css;
 mod javascript;
 
 static EXIT_STATUS: AtomicIsize = ATOMIC_ISIZE_INIT;
diff --git a/src/rustbook/css.rs b/src/rustbook/static/rustbook.css
index aae5f21a73d..3e0537c5551 100644
--- a/src/rustbook/css.rs
+++ b/src/rustbook/static/rustbook.css
@@ -1,20 +1,28 @@
-// 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 rust-book CSS in string form.
-
-pub static STYLE: &'static str = r#"
+/**
+ * Copyright 2013 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.
+ */
+
 @import url("../rust.css");
 
 body {
     max-width:none;
+    font: 16px/1.4 'Source Serif Pro', Georgia, Times, 'Times New Roman', serif;
+    line-height: 1.6;
+    color: #333;
+}
+
+h1, h2, h3, h4, h5, h6 {
+    font-family: 'Open Sans', 'Fira Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
+    font-weight: bold;
+    color: #333;
 }
 
 @media only screen {
@@ -23,20 +31,21 @@ body {
         left: 0px;
         top: 0px;
         bottom: 0px;
-        width: 250px;
+        width: 300px;
         overflow-y: auto;
         border-right: 1px solid rgba(0, 0, 0, 0.07);
         padding: 10px 10px;
-        font-size: 16px;
-        background: none repeat scroll 0% 0% #FFF;
+        font-size: 14px;
         box-sizing: border-box;
         -webkit-overflow-scrolling: touch;
+        background-color: #fafafa;
+        color: #364149;
     }
 
     #page-wrapper {
         position: absolute;
         overflow-y: auto;
-        left: 260px;
+        left: 310px;
         right: 0px;
         top: 0px;
         bottom: 0px;
@@ -47,7 +56,7 @@ body {
 }
 
 @media only print {
-    #toc, #nav {
+    #toc, #nav, #menu-bar {
         display: none;
     }
 }
@@ -84,7 +93,7 @@ body {
 .section {
     list-style: none outside none;
     padding-left: 20px;
-    line-height: 30px;
+    line-height: 40px;
 }
 
 .section li {
@@ -94,12 +103,17 @@ body {
 }
 
 .chapter li a {
-    color: #000000;
+    color: #333;
+    padding: 5px 0;
 }
 
 .chapter li a.active {
-    text-decoration: underline;
-    font-weight: bold;
+    color: #008cff;
+}
+
+.chapter li a:hover {
+    color: #008cff;
+    text-decoration: none;
 }
 
 #toggle-nav {
@@ -138,6 +152,20 @@ body {
     padding: 0;
 }
 
+pre {
+    padding: 16px;
+    overflow: auto;
+    font-size: 85%;
+    line-height: 1.45;
+    background-color: #f7f7f7;
+    border: 0;
+    border-radius: 3px;
+}
+
+.nav-previous-next {
+    margin-top: 60px;
+}
+
 .left {
     float: left;
 }
@@ -145,4 +173,3 @@ body {
 .right {
     float: right;
 }
-"#;
diff --git a/src/rustbook/static/rustbook.js b/src/rustbook/static/rustbook.js
new file mode 100644
index 00000000000..fdefab28759
--- /dev/null
+++ b/src/rustbook/static/rustbook.js
@@ -0,0 +1,73 @@
+// 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.
+
+
+document.addEventListener("DOMContentLoaded", function(event) {
+
+  document.getElementById("toggle-nav").onclick = toggleNav;
+
+  function toggleNav() {
+    var toc = document.getElementById("toc");
+    var pagewrapper = document.getElementById("page-wrapper");
+    toggleClass(toc, "mobile-hidden");
+    toggleClass(pagewrapper, "mobile-hidden");
+  }
+
+  function toggleClass(el, className) {
+     // from http://youmightnotneedjquery.com/
+     if (el.classList) {
+       el.classList.toggle(className);
+     } else {
+       var classes = el.className.split(' ');
+       var existingIndex = classes.indexOf(className);
+
+       if (existingIndex >= 0) {
+         classes.splice(existingIndex, 1);
+       } else {
+         classes.push(className);
+       }
+
+       el.className = classes.join(' ');
+     }
+  }
+
+  // The below code is used to add prev and next navigation links to the bottom
+  // of each of the sections.
+  // It works by extracting the current page based on the url and iterates over
+  // the menu links until it finds the menu item for the current page. We then
+  // create a copy of the preceding and following menu links and add the
+  // correct css class and insert them into the bottom of the page.
+  var toc = document.getElementById('toc').getElementsByTagName('a');
+  var href = document.location.pathname.split('/').pop();
+  if (href === 'index.html' || href === '') {
+    href = 'README.html';
+  }
+
+  for (var i = 0; i < toc.length; i++) {
+    if (toc[i].attributes.href.value.split('/').pop() === href) {
+      var nav = document.createElement('p');
+      if (i > 0) {
+        var prevNode = toc[i-1].cloneNode(true);
+        prevNode.className = 'left';
+        prevNode.setAttribute('rel', 'prev');
+        nav.appendChild(prevNode);
+      }
+      if (i < toc.length - 1) {
+        var nextNode = toc[i+1].cloneNode(true);
+        nextNode.className = 'right';
+        nextNode.setAttribute('rel', 'next');
+        nav.appendChild(nextNode);
+      }
+      document.getElementById('page').appendChild(nav);
+      break;
+    }
+  }
+
+});
diff --git a/src/test/compile-fail/lint-ctypes.rs b/src/test/compile-fail/lint-ctypes.rs
index 614f8e6fde8..4daba86679d 100644
--- a/src/test/compile-fail/lint-ctypes.rs
+++ b/src/test/compile-fail/lint-ctypes.rs
@@ -26,6 +26,7 @@ pub type I32Pair = (i32, i32);
 pub struct ZeroSize;
 pub type RustFn = fn();
 pub type RustBadRet = extern fn() -> Box<u32>;
+pub type CVoidRet = ();
 
 extern {
     pub fn bare_type1(size: isize); //~ ERROR: found Rust type
@@ -52,6 +53,8 @@ extern {
     pub fn good6(s: StructWithProjectionAndLifetime);
     pub fn good7(fptr: extern fn() -> ());
     pub fn good8(fptr: extern fn() -> !);
+    pub fn good9() -> ();
+    pub fn good10() -> CVoidRet;
 }
 
 fn main() {
diff --git a/src/test/run-pass/coerce-expect-unsized.rs b/src/test/run-pass/coerce-expect-unsized.rs
index 6926879856c..ee4ec24b7e3 100644
--- a/src/test/run-pass/coerce-expect-unsized.rs
+++ b/src/test/run-pass/coerce-expect-unsized.rs
@@ -13,7 +13,9 @@
 #![allow(unknown_features)]
 #![feature(box_syntax)]
 
+use std::cell::RefCell;
 use std::fmt::Debug;
+use std::rc::Rc;
 
 // Check that coercions apply at the pointer level and don't cause
 // rvalue expressions to be unsized. See #20169 for more information.
@@ -45,6 +47,9 @@ pub fn main() {
     let _: Box<[isize]> = Box::new([1, 2, 3]);
     let _: Box<Fn(isize) -> _> = Box::new(|x| (x as u8));
 
+    let _: Rc<RefCell<[isize]>> = Rc::new(RefCell::new([1, 2, 3]));
+    let _: Rc<RefCell<FnMut(isize) -> _>> = Rc::new(RefCell::new(|x| (x as u8)));
+
     let _: Vec<Box<Fn(isize) -> _>> = vec![
         Box::new(|x| (x as u8)),
         Box::new(|x| (x as i16 as u8)),
diff --git a/src/test/auxiliary/xcrate-static.rs b/src/test/run-pass/issue-27268.rs
index 85093869ba2..8af850bbada 100644
--- a/src/test/auxiliary/xcrate-static.rs
+++ b/src/test/run-pass/issue-27268.rs
@@ -8,8 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// no-prefer-dynamic
-
-#![crate_type = "rlib"]
-
-pub static FOO: u8 = 8;
+fn main() {
+    const _C: &'static Fn() = &||{};
+}
diff --git a/src/test/run-pass/xcrate-static.rs b/src/test/run-pass/xcrate-static.rs
deleted file mode 100644
index d1f08e726bc..00000000000
--- a/src/test/run-pass/xcrate-static.rs
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// aux-build:xcrate-static.rs
-
-extern crate xcrate_static;
-
-fn main() {
-    println!("{}", xcrate_static::FOO);
-}