about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--.gitignore7
-rw-r--r--src/bootstrap/test.rs4
-rw-r--r--src/bootstrap/tool.rs4
-rw-r--r--src/ci/docker/dist-various-1/Dockerfile9
-rw-r--r--src/doc/rustdoc/src/passes.md4
-rw-r--r--src/liballoc/str.rs8
-rw-r--r--src/liballoc/string.rs2
-rw-r--r--src/liballoc/tests/str.rs8
-rw-r--r--src/libcore/macros.rs49
-rw-r--r--src/libcore/mem.rs2
-rw-r--r--src/libcore/ptr.rs23
-rw-r--r--src/libcore/str/mod.rs28
-rw-r--r--src/libcore/str/pattern.rs2
-rw-r--r--src/librustc/hir/lowering.rs3
-rw-r--r--src/librustc/infer/error_reporting/need_type_info.rs9
-rw-r--r--src/librustc_mir/borrow_check/nll/universal_regions.rs2
-rw-r--r--src/librustdoc/clean/mod.rs12
-rw-r--r--src/libstd/macros.rs34
-rw-r--r--src/libstd/path.rs2
-rw-r--r--src/libsyntax/feature_gate.rs3
-rw-r--r--src/test/codegen/swap-small-types.rs27
-rw-r--r--src/test/ui/error-codes/E0282.stderr2
-rw-r--r--src/test/ui/issue-12187-1.stderr2
-rw-r--r--src/test/ui/issue-12187-2.stderr2
-rw-r--r--src/test/ui/issue-15965.stderr2
-rw-r--r--src/test/ui/issue-18159.stderr2
-rw-r--r--src/test/ui/issue-20261.stderr2
-rw-r--r--src/test/ui/issue-2151.stderr2
-rw-r--r--src/test/ui/issue-23041.stderr2
-rw-r--r--src/test/ui/issue-24013.stderr2
-rw-r--r--src/test/ui/issue-51116.rs2
-rw-r--r--src/test/ui/issue-51116.stderr2
-rw-r--r--src/test/ui/issue-7813.stderr2
-rw-r--r--src/test/ui/span/issue-42234-unknown-receiver-type.stderr2
-rw-r--r--src/test/ui/span/method-and-field-eager-resolution.stderr4
-rw-r--r--src/test/ui/type-check/cannot_infer_local_or_array.stderr2
36 files changed, 165 insertions, 109 deletions
diff --git a/.gitignore b/.gitignore
index 2f65ee3e777..9ffaa82e1c8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -86,15 +86,18 @@ __pycache__/
 target/
 /test/
 /tmp/
+tags
+tags.*
 TAGS
-TAGS.emacs
-TAGS.vi
+TAGS.*
 \#*
 \#*\#
 config.mk
 config.stamp
 keywords.md
 lexer.ml
+mir_dump
+Session.vim
 src/etc/dl
 tmp.*.rs
 version.md
diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs
index 6254f981656..38bba40aa65 100644
--- a/src/bootstrap/test.rs
+++ b/src/bootstrap/test.rs
@@ -966,7 +966,9 @@ impl Step for Compiletest {
             builder.ensure(compile::Rustc { compiler, target });
         }
 
-        builder.ensure(compile::Test { compiler, target });
+        if builder.no_std(target) != Some(true) {
+            builder.ensure(compile::Test { compiler, target });
+        }
         builder.ensure(native::TestHelpers { target });
         builder.ensure(RemoteCopyLibs { compiler, target });
 
diff --git a/src/bootstrap/tool.rs b/src/bootstrap/tool.rs
index 42c65b750d3..0969e5abe07 100644
--- a/src/bootstrap/tool.rs
+++ b/src/bootstrap/tool.rs
@@ -275,7 +275,7 @@ pub fn prepare_tool_cargo(
 
 macro_rules! tool {
     ($($name:ident, $path:expr, $tool_name:expr, $mode:expr $(,llvm_tools = $llvm:expr)*;)+) => {
-        #[derive(Copy, Clone)]
+        #[derive(Copy, PartialEq, Eq, Clone)]
         pub enum Tool {
             $(
                 $name,
@@ -640,7 +640,7 @@ impl<'a> Builder<'a> {
     fn prepare_tool_cmd(&self, compiler: Compiler, tool: Tool, cmd: &mut Command) {
         let host = &compiler.host;
         let mut lib_paths: Vec<PathBuf> = vec![
-            if compiler.stage == 0 {
+            if compiler.stage == 0 && tool != Tool::ErrorIndex {
                 self.build.rustc_snapshot_libdir()
             } else {
                 PathBuf::from(&self.sysroot_libdir(compiler, compiler.host))
diff --git a/src/ci/docker/dist-various-1/Dockerfile b/src/ci/docker/dist-various-1/Dockerfile
index b195decfcf5..702f9b2886e 100644
--- a/src/ci/docker/dist-various-1/Dockerfile
+++ b/src/ci/docker/dist-various-1/Dockerfile
@@ -80,6 +80,11 @@ RUN \
   echo "# a" >> /usr/local/mips-linux-musl/bin/mips-openwrt-linux-musl-wrapper.sh && \
   echo "# b" >> /usr/local/mipsel-linux-musl/bin/mipsel-openwrt-linux-musl-wrapper.sh
 
+ENV RUN_MAKE_TARGETS=thumbv6m-none-eabi
+ENV RUN_MAKE_TARGETS=$RUN_MAKE_TARGETS,thumbv7m-none-eabi
+ENV RUN_MAKE_TARGETS=$RUN_MAKE_TARGETS,thumbv7em-none-eabi
+ENV RUN_MAKE_TARGETS=$RUN_MAKE_TARGETS,thumbv7em-none-eabihf
+
 ENV TARGETS=asmjs-unknown-emscripten
 ENV TARGETS=$TARGETS,wasm32-unknown-emscripten
 ENV TARGETS=$TARGETS,x86_64-rumprun-netbsd
@@ -120,7 +125,9 @@ ENV RUST_CONFIGURE_ARGS \
       --enable-emscripten \
       --disable-docs
 
-ENV SCRIPT python2.7 ../x.py dist --target $TARGETS
+ENV SCRIPT \ 
+      python2.7 ../x.py test --target $RUN_MAKE_TARGETS src/test/run-make && \
+      python2.7 ../x.py dist --target $TARGETS
 
 # sccache
 COPY scripts/sccache.sh /scripts/
diff --git a/src/doc/rustdoc/src/passes.md b/src/doc/rustdoc/src/passes.md
index de7c1029268..615b3dca199 100644
--- a/src/doc/rustdoc/src/passes.md
+++ b/src/doc/rustdoc/src/passes.md
@@ -5,8 +5,8 @@ Rustdoc has a concept called "passes". These are transformations that
 
 In addition to the passes below, check out the docs for these flags:
 
-* [`--passes`](command-line-arguments.html#--passes-add-more-rustdoc-passes)
-* [`--no-defaults`](command-line-arguments.html#--no-defaults-dont-run-default-passes)
+* [`--passes`](command-line-arguments.html#a--passes-add-more-rustdoc-passes)
+* [`--no-defaults`](command-line-arguments.html#a--no-defaults-dont-run-default-passes)
 
 ## Default passes
 
diff --git a/src/liballoc/str.rs b/src/liballoc/str.rs
index 4d6434c378e..870bf971cd3 100644
--- a/src/liballoc/str.rs
+++ b/src/liballoc/str.rs
@@ -268,11 +268,11 @@ impl str {
         let mut result = String::new();
         let mut last_end = 0;
         for (start, part) in self.match_indices(from) {
-            result.push_str(unsafe { self.slice_unchecked(last_end, start) });
+            result.push_str(unsafe { self.get_unchecked(last_end..start) });
             result.push_str(to);
             last_end = start + part.len();
         }
-        result.push_str(unsafe { self.slice_unchecked(last_end, self.len()) });
+        result.push_str(unsafe { self.get_unchecked(last_end..self.len()) });
         result
     }
 
@@ -309,11 +309,11 @@ impl str {
         let mut result = String::with_capacity(32);
         let mut last_end = 0;
         for (start, part) in self.match_indices(pat).take(count) {
-            result.push_str(unsafe { self.slice_unchecked(last_end, start) });
+            result.push_str(unsafe { self.get_unchecked(last_end..start) });
             result.push_str(to);
             last_end = start + part.len();
         }
-        result.push_str(unsafe { self.slice_unchecked(last_end, self.len()) });
+        result.push_str(unsafe { self.get_unchecked(last_end..self.len()) });
         result
     }
 
diff --git a/src/liballoc/string.rs b/src/liballoc/string.rs
index 6b28687a060..631779a17a1 100644
--- a/src/liballoc/string.rs
+++ b/src/liballoc/string.rs
@@ -1222,7 +1222,7 @@ impl String {
 
         while idx < len {
             let ch = unsafe {
-                self.slice_unchecked(idx, len).chars().next().unwrap()
+                self.get_unchecked(idx..len).chars().next().unwrap()
             };
             let ch_len = ch.len_utf8();
 
diff --git a/src/liballoc/tests/str.rs b/src/liballoc/tests/str.rs
index 75306ac82df..6275c7bb112 100644
--- a/src/liballoc/tests/str.rs
+++ b/src/liballoc/tests/str.rs
@@ -177,9 +177,9 @@ fn test_join_for_different_lengths_with_long_separator() {
 
 #[test]
 fn test_unsafe_slice() {
-    assert_eq!("ab", unsafe {"abc".slice_unchecked(0, 2)});
-    assert_eq!("bc", unsafe {"abc".slice_unchecked(1, 3)});
-    assert_eq!("", unsafe {"abc".slice_unchecked(1, 1)});
+    assert_eq!("ab", unsafe {"abc".get_unchecked(0..2)});
+    assert_eq!("bc", unsafe {"abc".get_unchecked(1..3)});
+    assert_eq!("", unsafe {"abc".get_unchecked(1..1)});
     fn a_million_letter_a() -> String {
         let mut i = 0;
         let mut rs = String::new();
@@ -200,7 +200,7 @@ fn test_unsafe_slice() {
     }
     let letters = a_million_letter_a();
     assert_eq!(half_a_million_letter_a(),
-        unsafe { letters.slice_unchecked(0, 500000)});
+        unsafe { letters.get_unchecked(0..500000)});
 }
 
 #[test]
diff --git a/src/libcore/macros.rs b/src/libcore/macros.rs
index c830c22ee5f..83f9dfea8f2 100644
--- a/src/libcore/macros.rs
+++ b/src/libcore/macros.rs
@@ -543,6 +543,7 @@ macro_rules! unimplemented {
 /// into libsyntax itself.
 ///
 /// For more information, see documentation for `std`'s macros.
+#[cfg(dox)]
 mod builtin {
 
     /// Unconditionally causes compilation to fail with the given error message when encountered.
@@ -551,8 +552,7 @@ mod builtin {
     ///
     /// [`std::compile_error!`]: ../std/macro.compile_error.html
     #[stable(feature = "compile_error_macro", since = "1.20.0")]
-    #[macro_export]
-    #[cfg(dox)]
+    #[rustc_doc_only_macro]
     macro_rules! compile_error {
         ($msg:expr) => ({ /* compiler built-in */ });
         ($msg:expr,) => ({ /* compiler built-in */ });
@@ -564,8 +564,7 @@ mod builtin {
     ///
     /// [`std::format_args!`]: ../std/macro.format_args.html
     #[stable(feature = "rust1", since = "1.0.0")]
-    #[macro_export]
-    #[cfg(dox)]
+    #[rustc_doc_only_macro]
     macro_rules! format_args {
         ($fmt:expr) => ({ /* compiler built-in */ });
         ($fmt:expr, $($args:tt)*) => ({ /* compiler built-in */ });
@@ -577,8 +576,7 @@ mod builtin {
     ///
     /// [`std::env!`]: ../std/macro.env.html
     #[stable(feature = "rust1", since = "1.0.0")]
-    #[macro_export]
-    #[cfg(dox)]
+    #[rustc_doc_only_macro]
     macro_rules! env {
         ($name:expr) => ({ /* compiler built-in */ });
         ($name:expr,) => ({ /* compiler built-in */ });
@@ -590,8 +588,7 @@ mod builtin {
     ///
     /// [`std::option_env!`]: ../std/macro.option_env.html
     #[stable(feature = "rust1", since = "1.0.0")]
-    #[macro_export]
-    #[cfg(dox)]
+    #[rustc_doc_only_macro]
     macro_rules! option_env {
         ($name:expr) => ({ /* compiler built-in */ });
         ($name:expr,) => ({ /* compiler built-in */ });
@@ -603,8 +600,7 @@ mod builtin {
     ///
     /// [`std::concat_idents!`]: ../std/macro.concat_idents.html
     #[unstable(feature = "concat_idents_macro", issue = "29599")]
-    #[macro_export]
-    #[cfg(dox)]
+    #[rustc_doc_only_macro]
     macro_rules! concat_idents {
         ($($e:ident),+) => ({ /* compiler built-in */ });
         ($($e:ident,)+) => ({ /* compiler built-in */ });
@@ -616,8 +612,7 @@ mod builtin {
     ///
     /// [`std::concat!`]: ../std/macro.concat.html
     #[stable(feature = "rust1", since = "1.0.0")]
-    #[macro_export]
-    #[cfg(dox)]
+    #[rustc_doc_only_macro]
     macro_rules! concat {
         ($($e:expr),*) => ({ /* compiler built-in */ });
         ($($e:expr,)*) => ({ /* compiler built-in */ });
@@ -629,8 +624,7 @@ mod builtin {
     ///
     /// [`std::line!`]: ../std/macro.line.html
     #[stable(feature = "rust1", since = "1.0.0")]
-    #[macro_export]
-    #[cfg(dox)]
+    #[rustc_doc_only_macro]
     macro_rules! line { () => ({ /* compiler built-in */ }) }
 
     /// A macro which expands to the column number on which it was invoked.
@@ -639,8 +633,7 @@ mod builtin {
     ///
     /// [`std::column!`]: ../std/macro.column.html
     #[stable(feature = "rust1", since = "1.0.0")]
-    #[macro_export]
-    #[cfg(dox)]
+    #[rustc_doc_only_macro]
     macro_rules! column { () => ({ /* compiler built-in */ }) }
 
     /// A macro which expands to the file name from which it was invoked.
@@ -649,8 +642,7 @@ mod builtin {
     ///
     /// [`std::file!`]: ../std/macro.file.html
     #[stable(feature = "rust1", since = "1.0.0")]
-    #[macro_export]
-    #[cfg(dox)]
+    #[rustc_doc_only_macro]
     macro_rules! file { () => ({ /* compiler built-in */ }) }
 
     /// A macro which stringifies its arguments.
@@ -659,8 +651,7 @@ mod builtin {
     ///
     /// [`std::stringify!`]: ../std/macro.stringify.html
     #[stable(feature = "rust1", since = "1.0.0")]
-    #[macro_export]
-    #[cfg(dox)]
+    #[rustc_doc_only_macro]
     macro_rules! stringify { ($($t:tt)*) => ({ /* compiler built-in */ }) }
 
     /// Includes a utf8-encoded file as a string.
@@ -669,8 +660,7 @@ mod builtin {
     ///
     /// [`std::include_str!`]: ../std/macro.include_str.html
     #[stable(feature = "rust1", since = "1.0.0")]
-    #[macro_export]
-    #[cfg(dox)]
+    #[rustc_doc_only_macro]
     macro_rules! include_str {
         ($file:expr) => ({ /* compiler built-in */ });
         ($file:expr,) => ({ /* compiler built-in */ });
@@ -682,8 +672,7 @@ mod builtin {
     ///
     /// [`std::include_bytes!`]: ../std/macro.include_bytes.html
     #[stable(feature = "rust1", since = "1.0.0")]
-    #[macro_export]
-    #[cfg(dox)]
+    #[rustc_doc_only_macro]
     macro_rules! include_bytes {
         ($file:expr) => ({ /* compiler built-in */ });
         ($file:expr,) => ({ /* compiler built-in */ });
@@ -695,8 +684,7 @@ mod builtin {
     ///
     /// [`std::module_path!`]: ../std/macro.module_path.html
     #[stable(feature = "rust1", since = "1.0.0")]
-    #[macro_export]
-    #[cfg(dox)]
+    #[rustc_doc_only_macro]
     macro_rules! module_path { () => ({ /* compiler built-in */ }) }
 
     /// Boolean evaluation of configuration flags, at compile-time.
@@ -705,8 +693,7 @@ mod builtin {
     ///
     /// [`std::cfg!`]: ../std/macro.cfg.html
     #[stable(feature = "rust1", since = "1.0.0")]
-    #[macro_export]
-    #[cfg(dox)]
+    #[rustc_doc_only_macro]
     macro_rules! cfg { ($($cfg:tt)*) => ({ /* compiler built-in */ }) }
 
     /// Parse a file as an expression or an item according to the context.
@@ -715,8 +702,7 @@ mod builtin {
     ///
     /// [`std::include!`]: ../std/macro.include.html
     #[stable(feature = "rust1", since = "1.0.0")]
-    #[macro_export]
-    #[cfg(dox)]
+    #[rustc_doc_only_macro]
     macro_rules! include {
         ($file:expr) => ({ /* compiler built-in */ });
         ($file:expr,) => ({ /* compiler built-in */ });
@@ -727,9 +713,8 @@ mod builtin {
     /// For more information, see the documentation for [`std::assert!`].
     ///
     /// [`std::assert!`]: ../std/macro.assert.html
-    #[macro_export]
+    #[rustc_doc_only_macro]
     #[stable(feature = "rust1", since = "1.0.0")]
-    #[cfg(dox)]
     macro_rules! assert {
         ($cond:expr) => ({ /* compiler built-in */ });
         ($cond:expr,) => ({ /* compiler built-in */ });
diff --git a/src/libcore/mem.rs b/src/libcore/mem.rs
index 8fb4e0d6a02..a0fe6e98806 100644
--- a/src/libcore/mem.rs
+++ b/src/libcore/mem.rs
@@ -638,7 +638,7 @@ pub unsafe fn uninitialized<T>() -> T {
 #[stable(feature = "rust1", since = "1.0.0")]
 pub fn swap<T>(x: &mut T, y: &mut T) {
     unsafe {
-        ptr::swap_nonoverlapping(x, y, 1);
+        ptr::swap_nonoverlapping_one(x, y);
     }
 }
 
diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs
index 0af642258c2..d020e14be4c 100644
--- a/src/libcore/ptr.rs
+++ b/src/libcore/ptr.rs
@@ -188,6 +188,19 @@ pub unsafe fn swap_nonoverlapping<T>(x: *mut T, y: *mut T, count: usize) {
 }
 
 #[inline]
+pub(crate) unsafe fn swap_nonoverlapping_one<T>(x: *mut T, y: *mut T) {
+    // For types smaller than the block optimization below,
+    // just swap directly to avoid pessimizing codegen.
+    if mem::size_of::<T>() < 32 {
+        let z = read(x);
+        copy_nonoverlapping(y, x, 1);
+        write(y, z);
+    } else {
+        swap_nonoverlapping(x, y, 1);
+    }
+}
+
+#[inline]
 unsafe fn swap_nonoverlapping_bytes(x: *mut u8, y: *mut u8, len: usize) {
     // The approach here is to utilize simd to swap x & y efficiently. Testing reveals
     // that swapping either 32 bytes or 64 bytes at a time is most efficient for intel
@@ -2703,6 +2716,11 @@ impl<T: Sized> Unique<T> {
     ///
     /// This is useful for initializing types which lazily allocate, like
     /// `Vec::new` does.
+    ///
+    /// Note that the pointer value may potentially represent a valid pointer to
+    /// a `T`, which means this must not be used as a "not yet initialized"
+    /// sentinel value. Types that lazily allocate must track initialization by
+    /// some other means.
     // FIXME: rename to dangling() to match NonNull?
     pub const fn empty() -> Self {
         unsafe {
@@ -2834,6 +2852,11 @@ impl<T: Sized> NonNull<T> {
     ///
     /// This is useful for initializing types which lazily allocate, like
     /// `Vec::new` does.
+    ///
+    /// Note that the pointer value may potentially represent a valid pointer to
+    /// a `T`, which means this must not be used as a "not yet initialized"
+    /// sentinel value. Types that lazily allocate must track initialization by
+    /// some other means.
     #[stable(feature = "nonnull", since = "1.25.0")]
     pub fn dangling() -> Self {
         unsafe {
diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs
index 255e8a07d75..3e215de58dd 100644
--- a/src/libcore/str/mod.rs
+++ b/src/libcore/str/mod.rs
@@ -1055,7 +1055,7 @@ impl<'a, P: Pattern<'a>> SplitInternal<'a, P> {
         if !self.finished && (self.allow_trailing_empty || self.end - self.start > 0) {
             self.finished = true;
             unsafe {
-                let string = self.matcher.haystack().slice_unchecked(self.start, self.end);
+                let string = self.matcher.haystack().get_unchecked(self.start..self.end);
                 Some(string)
             }
         } else {
@@ -1070,7 +1070,7 @@ impl<'a, P: Pattern<'a>> SplitInternal<'a, P> {
         let haystack = self.matcher.haystack();
         match self.matcher.next_match() {
             Some((a, b)) => unsafe {
-                let elt = haystack.slice_unchecked(self.start, a);
+                let elt = haystack.get_unchecked(self.start..a);
                 self.start = b;
                 Some(elt)
             },
@@ -1095,13 +1095,13 @@ impl<'a, P: Pattern<'a>> SplitInternal<'a, P> {
         let haystack = self.matcher.haystack();
         match self.matcher.next_match_back() {
             Some((a, b)) => unsafe {
-                let elt = haystack.slice_unchecked(b, self.end);
+                let elt = haystack.get_unchecked(b..self.end);
                 self.end = a;
                 Some(elt)
             },
             None => unsafe {
                 self.finished = true;
-                Some(haystack.slice_unchecked(self.start, self.end))
+                Some(haystack.get_unchecked(self.start..self.end))
             },
         }
     }
@@ -1222,7 +1222,7 @@ impl<'a, P: Pattern<'a>> MatchIndicesInternal<'a, P> {
     #[inline]
     fn next(&mut self) -> Option<(usize, &'a str)> {
         self.0.next_match().map(|(start, end)| unsafe {
-            (start, self.0.haystack().slice_unchecked(start, end))
+            (start, self.0.haystack().get_unchecked(start..end))
         })
     }
 
@@ -1231,7 +1231,7 @@ impl<'a, P: Pattern<'a>> MatchIndicesInternal<'a, P> {
         where P::Searcher: ReverseSearcher<'a>
     {
         self.0.next_match_back().map(|(start, end)| unsafe {
-            (start, self.0.haystack().slice_unchecked(start, end))
+            (start, self.0.haystack().get_unchecked(start..end))
         })
     }
 }
@@ -1274,7 +1274,7 @@ impl<'a, P: Pattern<'a>> MatchesInternal<'a, P> {
     fn next(&mut self) -> Option<&'a str> {
         self.0.next_match().map(|(a, b)| unsafe {
             // Indices are known to be on utf8 boundaries
-            self.0.haystack().slice_unchecked(a, b)
+            self.0.haystack().get_unchecked(a..b)
         })
     }
 
@@ -1284,7 +1284,7 @@ impl<'a, P: Pattern<'a>> MatchesInternal<'a, P> {
     {
         self.0.next_match_back().map(|(a, b)| unsafe {
             // Indices are known to be on utf8 boundaries
-            self.0.haystack().slice_unchecked(a, b)
+            self.0.haystack().get_unchecked(a..b)
         })
     }
 }
@@ -2453,6 +2453,7 @@ impl str {
     /// }
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
+    #[rustc_deprecated(since = "1.29.0", reason = "use `get_unchecked(begin..end)` instead")]
     #[inline]
     pub unsafe fn slice_unchecked(&self, begin: usize, end: usize) -> &str {
         (begin..end).get_unchecked(self)
@@ -2483,6 +2484,7 @@ impl str {
     /// * `begin` and `end` must be byte positions within the string slice.
     /// * `begin` and `end` must lie on UTF-8 sequence boundaries.
     #[stable(feature = "str_slice_mut", since = "1.5.0")]
+    #[rustc_deprecated(since = "1.29.0", reason = "use `get_unchecked_mut(begin..end)` instead")]
     #[inline]
     pub unsafe fn slice_mut_unchecked(&mut self, begin: usize, end: usize) -> &mut str {
         (begin..end).get_unchecked_mut(self)
@@ -2524,8 +2526,8 @@ impl str {
         // is_char_boundary checks that the index is in [0, .len()]
         if self.is_char_boundary(mid) {
             unsafe {
-                (self.slice_unchecked(0, mid),
-                 self.slice_unchecked(mid, self.len()))
+                (self.get_unchecked(0..mid),
+                 self.get_unchecked(mid..self.len()))
             }
         } else {
             slice_error_fail(self, 0, mid)
@@ -3702,7 +3704,7 @@ impl str {
         }
         unsafe {
             // Searcher is known to return valid indices
-            self.slice_unchecked(i, j)
+            self.get_unchecked(i..j)
         }
     }
 
@@ -3741,7 +3743,7 @@ impl str {
         }
         unsafe {
             // Searcher is known to return valid indices
-            self.slice_unchecked(i, self.len())
+            self.get_unchecked(i..self.len())
         }
     }
 
@@ -3788,7 +3790,7 @@ impl str {
         }
         unsafe {
             // Searcher is known to return valid indices
-            self.slice_unchecked(0, j)
+            self.get_unchecked(0..j)
         }
     }
 
diff --git a/src/libcore/str/pattern.rs b/src/libcore/str/pattern.rs
index 464d57a2702..5e63fa9ff35 100644
--- a/src/libcore/str/pattern.rs
+++ b/src/libcore/str/pattern.rs
@@ -354,7 +354,7 @@ unsafe impl<'a> ReverseSearcher<'a> for CharSearcher<'a> {
     #[inline]
     fn next_back(&mut self) -> SearchStep {
         let old_finger = self.finger_back;
-        let slice = unsafe { self.haystack.slice_unchecked(self.finger, old_finger) };
+        let slice = unsafe { self.haystack.get_unchecked(self.finger..old_finger) };
         let mut iter = slice.chars();
         let old_len = iter.iter.len();
         if let Some(ch) = iter.next_back() {
diff --git a/src/librustc/hir/lowering.rs b/src/librustc/hir/lowering.rs
index 99db718bdf8..8e27a9914f4 100644
--- a/src/librustc/hir/lowering.rs
+++ b/src/librustc/hir/lowering.rs
@@ -3191,7 +3191,8 @@ impl<'a> LoweringContext<'a> {
         let mut vis = self.lower_visibility(&i.vis, None);
         let attrs = self.lower_attrs(&i.attrs);
         if let ItemKind::MacroDef(ref def) = i.node {
-            if !def.legacy || attr::contains_name(&i.attrs, "macro_export") {
+            if !def.legacy || attr::contains_name(&i.attrs, "macro_export") ||
+                              attr::contains_name(&i.attrs, "rustc_doc_only_macro") {
                 let body = self.lower_token_stream(def.stream());
                 self.exported_macros.push(hir::MacroDef {
                     name,
diff --git a/src/librustc/infer/error_reporting/need_type_info.rs b/src/librustc/infer/error_reporting/need_type_info.rs
index 04d14f40b85..dbcb63addb8 100644
--- a/src/librustc/infer/error_reporting/need_type_info.rs
+++ b/src/librustc/infer/error_reporting/need_type_info.rs
@@ -97,7 +97,14 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
         let name = self.extract_type_name(&ty);
 
         let mut err_span = span;
-        let mut labels = vec![(span, format!("cannot infer type for `{}`", name))];
+        let mut labels = vec![(
+            span,
+            if &name == "_" {
+                "cannot infer type".to_string()
+            } else {
+                format!("cannot infer type for `{}`", name)
+            },
+        )];
 
         let mut local_visitor = FindLocalByTypeVisitor {
             infcx: &self,
diff --git a/src/librustc_mir/borrow_check/nll/universal_regions.rs b/src/librustc_mir/borrow_check/nll/universal_regions.rs
index e7930b21481..808e8b6b8fd 100644
--- a/src/librustc_mir/borrow_check/nll/universal_regions.rs
+++ b/src/librustc_mir/borrow_check/nll/universal_regions.rs
@@ -57,7 +57,7 @@ pub struct UniversalRegions<'tcx> {
     /// externals, then locals. So things from:
     /// - `FIRST_GLOBAL_INDEX..first_extern_index` are global;
     /// - `first_extern_index..first_local_index` are external; and
-    /// - first_local_index..num_universals` are local.
+    /// - `first_local_index..num_universals` are local.
     first_extern_index: usize,
 
     /// See `first_extern_index`.
diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs
index 77521db835b..54cf82a19b4 100644
--- a/src/librustdoc/clean/mod.rs
+++ b/src/librustdoc/clean/mod.rs
@@ -1273,15 +1273,13 @@ fn macro_resolve(cx: &DocContext, path_str: &str) -> Option<Def> {
         .resolve_macro_to_def_inner(mark, &path, MacroKind::Bang, false);
     if let Ok(def) = res {
         if let SyntaxExtension::DeclMacro { .. } = *resolver.get_macro(def) {
-            Some(def)
-        } else {
-            None
+            return Some(def);
         }
-    } else if let Some(def) = resolver.all_macros.get(&Symbol::intern(path_str)) {
-        Some(*def)
-    } else {
-        None
     }
+    if let Some(def) = resolver.all_macros.get(&Symbol::intern(path_str)) {
+        return Some(*def);
+    }
+    None
 }
 
 #[derive(Debug)]
diff --git a/src/libstd/macros.rs b/src/libstd/macros.rs
index 76f38646308..0025f21da22 100644
--- a/src/libstd/macros.rs
+++ b/src/libstd/macros.rs
@@ -317,7 +317,7 @@ macro_rules! assert_approx_eq {
 /// macro, but are documented here. Their implementations can be found hardcoded
 /// into libsyntax itself.
 #[cfg(dox)]
-pub mod builtin {
+mod builtin {
 
     /// Unconditionally causes compilation to fail with the given error message when encountered.
     ///
@@ -355,7 +355,7 @@ pub mod builtin {
     ///
     /// [`panic!`]: ../std/macro.panic.html
     #[stable(feature = "compile_error_macro", since = "1.20.0")]
-    #[macro_export]
+    #[rustc_doc_only_macro]
     macro_rules! compile_error {
         ($msg:expr) => ({ /* compiler built-in */ });
         ($msg:expr,) => ({ /* compiler built-in */ });
@@ -407,7 +407,7 @@ pub mod builtin {
     /// assert_eq!(s, format!("hello {}", "world"));
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    #[macro_export]
+    #[rustc_doc_only_macro]
     macro_rules! format_args {
         ($fmt:expr) => ({ /* compiler built-in */ });
         ($fmt:expr, $($args:tt)*) => ({ /* compiler built-in */ });
@@ -445,7 +445,7 @@ pub mod builtin {
     /// error: what's that?!
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    #[macro_export]
+    #[rustc_doc_only_macro]
     macro_rules! env {
         ($name:expr) => ({ /* compiler built-in */ });
         ($name:expr,) => ({ /* compiler built-in */ });
@@ -471,7 +471,7 @@ pub mod builtin {
     /// println!("the secret key might be: {:?}", key);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    #[macro_export]
+    #[rustc_doc_only_macro]
     macro_rules! option_env {
         ($name:expr) => ({ /* compiler built-in */ });
         ($name:expr,) => ({ /* compiler built-in */ });
@@ -502,7 +502,7 @@ pub mod builtin {
     /// # }
     /// ```
     #[unstable(feature = "concat_idents_macro", issue = "29599")]
-    #[macro_export]
+    #[rustc_doc_only_macro]
     macro_rules! concat_idents {
         ($($e:ident),+) => ({ /* compiler built-in */ });
         ($($e:ident,)+) => ({ /* compiler built-in */ });
@@ -524,7 +524,7 @@ pub mod builtin {
     /// assert_eq!(s, "test10btrue");
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    #[macro_export]
+    #[rustc_doc_only_macro]
     macro_rules! concat {
         ($($e:expr),*) => ({ /* compiler built-in */ });
         ($($e:expr,)*) => ({ /* compiler built-in */ });
@@ -552,7 +552,7 @@ pub mod builtin {
     /// println!("defined on line: {}", current_line);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    #[macro_export]
+    #[rustc_doc_only_macro]
     macro_rules! line { () => ({ /* compiler built-in */ }) }
 
     /// A macro which expands to the column number on which it was invoked.
@@ -577,7 +577,7 @@ pub mod builtin {
     /// println!("defined on column: {}", current_col);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    #[macro_export]
+    #[rustc_doc_only_macro]
     macro_rules! column { () => ({ /* compiler built-in */ }) }
 
     /// A macro which expands to the file name from which it was invoked.
@@ -601,7 +601,7 @@ pub mod builtin {
     /// println!("defined in file: {}", this_file);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    #[macro_export]
+    #[rustc_doc_only_macro]
     macro_rules! file { () => ({ /* compiler built-in */ }) }
 
     /// A macro which stringifies its arguments.
@@ -620,7 +620,7 @@ pub mod builtin {
     /// assert_eq!(one_plus_one, "1 + 1");
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    #[macro_export]
+    #[rustc_doc_only_macro]
     macro_rules! stringify { ($($t:tt)*) => ({ /* compiler built-in */ }) }
 
     /// Includes a utf8-encoded file as a string.
@@ -654,7 +654,7 @@ pub mod builtin {
     ///
     /// Compiling 'main.rs' and running the resulting binary will print "adiรณs".
     #[stable(feature = "rust1", since = "1.0.0")]
-    #[macro_export]
+    #[rustc_doc_only_macro]
     macro_rules! include_str {
         ($file:expr) => ({ /* compiler built-in */ });
         ($file:expr,) => ({ /* compiler built-in */ });
@@ -691,7 +691,7 @@ pub mod builtin {
     ///
     /// Compiling 'main.rs' and running the resulting binary will print "adiรณs".
     #[stable(feature = "rust1", since = "1.0.0")]
-    #[macro_export]
+    #[rustc_doc_only_macro]
     macro_rules! include_bytes {
         ($file:expr) => ({ /* compiler built-in */ });
         ($file:expr,) => ({ /* compiler built-in */ });
@@ -715,7 +715,7 @@ pub mod builtin {
     /// test::foo();
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    #[macro_export]
+    #[rustc_doc_only_macro]
     macro_rules! module_path { () => ({ /* compiler built-in */ }) }
 
     /// Boolean evaluation of configuration flags, at compile-time.
@@ -737,7 +737,7 @@ pub mod builtin {
     /// };
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    #[macro_export]
+    #[rustc_doc_only_macro]
     macro_rules! cfg { ($($cfg:tt)*) => ({ /* compiler built-in */ }) }
 
     /// Parse a file as an expression or an item according to the context.
@@ -780,7 +780,7 @@ pub mod builtin {
     /// Compiling 'main.rs' and running the resulting binary will print
     /// "๐Ÿ™ˆ๐Ÿ™Š๐Ÿ™‰๐Ÿ™ˆ๐Ÿ™Š๐Ÿ™‰".
     #[stable(feature = "rust1", since = "1.0.0")]
-    #[macro_export]
+    #[rustc_doc_only_macro]
     macro_rules! include {
         ($file:expr) => ({ /* compiler built-in */ });
         ($file:expr,) => ({ /* compiler built-in */ });
@@ -833,7 +833,7 @@ pub mod builtin {
     /// assert!(a + b == 30, "a = {}, b = {}", a, b);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    #[macro_export]
+    #[rustc_doc_only_macro]
     macro_rules! assert {
         ($cond:expr) => ({ /* compiler built-in */ });
         ($cond:expr,) => ({ /* compiler built-in */ });
diff --git a/src/libstd/path.rs b/src/libstd/path.rs
index 2d868629278..0c60129494d 100644
--- a/src/libstd/path.rs
+++ b/src/libstd/path.rs
@@ -1836,7 +1836,7 @@ impl Path {
     /// * On Unix, a path has a root if it begins with `/`.
     ///
     /// * On Windows, a path has a root if it:
-    ///     * has no prefix and begins with a separator, e.g. `\\windows`
+    ///     * has no prefix and begins with a separator, e.g. `\windows`
     ///     * has a prefix followed by a separator, e.g. `c:\windows` but not `c:windows`
     ///     * has any non-disk prefix, e.g. `\\server\share`
     ///
diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs
index 143d0d4df71..30137439e77 100644
--- a/src/libsyntax/feature_gate.rs
+++ b/src/libsyntax/feature_gate.rs
@@ -687,7 +687,8 @@ pub fn deprecated_attributes() -> Vec<&'static (&'static str, AttributeType, Att
 }
 
 pub fn is_builtin_attr(attr: &ast::Attribute) -> bool {
-    BUILTIN_ATTRIBUTES.iter().any(|&(builtin_name, _, _)| attr.check_name(builtin_name))
+    BUILTIN_ATTRIBUTES.iter().any(|&(builtin_name, _, _)| attr.check_name(builtin_name)) ||
+    attr.name().as_str().starts_with("rustc_")
 }
 
 // Attributes that have a special meaning to rustc or rustdoc
diff --git a/src/test/codegen/swap-small-types.rs b/src/test/codegen/swap-small-types.rs
new file mode 100644
index 00000000000..46406ee5182
--- /dev/null
+++ b/src/test/codegen/swap-small-types.rs
@@ -0,0 +1,27 @@
+// Copyright 2018 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.
+
+// compile-flags: -O
+// only-x86_64
+
+#![crate_type = "lib"]
+
+use std::mem::swap;
+
+type RGB48 = [u16; 3];
+
+// CHECK-LABEL: @swap_rgb48
+#[no_mangle]
+pub fn swap_rgb48(x: &mut RGB48, y: &mut RGB48) {
+// CHECK-NOT: alloca
+// CHECK: load i48
+// CHECK: store i48
+    swap(x, y)
+}
diff --git a/src/test/ui/error-codes/E0282.stderr b/src/test/ui/error-codes/E0282.stderr
index f1319f41395..6862e2d8688 100644
--- a/src/test/ui/error-codes/E0282.stderr
+++ b/src/test/ui/error-codes/E0282.stderr
@@ -4,7 +4,7 @@ error[E0282]: type annotations needed
 LL |     let x = "hello".chars().rev().collect(); //~ ERROR E0282
    |         ^
    |         |
-   |         cannot infer type for `_`
+   |         cannot infer type
    |         consider giving `x` a type
 
 error: aborting due to previous error
diff --git a/src/test/ui/issue-12187-1.stderr b/src/test/ui/issue-12187-1.stderr
index 7d4df2901fe..94afd6aab57 100644
--- a/src/test/ui/issue-12187-1.stderr
+++ b/src/test/ui/issue-12187-1.stderr
@@ -4,7 +4,7 @@ error[E0282]: type annotations needed
 LL |     let &v = new();
    |         -^
    |         ||
-   |         |cannot infer type for `_`
+   |         |cannot infer type
    |         consider giving the pattern a type
 
 error: aborting due to previous error
diff --git a/src/test/ui/issue-12187-2.stderr b/src/test/ui/issue-12187-2.stderr
index f7ecbd44772..90b41e397c6 100644
--- a/src/test/ui/issue-12187-2.stderr
+++ b/src/test/ui/issue-12187-2.stderr
@@ -4,7 +4,7 @@ error[E0282]: type annotations needed
 LL |     let &v = new();
    |         -^
    |         ||
-   |         |cannot infer type for `_`
+   |         |cannot infer type
    |         consider giving the pattern a type
 
 error: aborting due to previous error
diff --git a/src/test/ui/issue-15965.stderr b/src/test/ui/issue-15965.stderr
index 216c6460c77..3162556986e 100644
--- a/src/test/ui/issue-15965.stderr
+++ b/src/test/ui/issue-15965.stderr
@@ -4,7 +4,7 @@ error[E0282]: type annotations needed
 LL | /         { return () }
 LL | | //~^ ERROR type annotations needed [E0282]
 LL | |     ()
-   | |______^ cannot infer type for `_`
+   | |______^ cannot infer type
    |
    = note: type must be known at this point
 
diff --git a/src/test/ui/issue-18159.stderr b/src/test/ui/issue-18159.stderr
index 894660f1ebf..084e859111b 100644
--- a/src/test/ui/issue-18159.stderr
+++ b/src/test/ui/issue-18159.stderr
@@ -4,7 +4,7 @@ error[E0282]: type annotations needed
 LL |     let x; //~ ERROR type annotations needed
    |         ^
    |         |
-   |         cannot infer type for `_`
+   |         cannot infer type
    |         consider giving `x` a type
 
 error: aborting due to previous error
diff --git a/src/test/ui/issue-20261.stderr b/src/test/ui/issue-20261.stderr
index a7a7ea7c69b..6cdddcff929 100644
--- a/src/test/ui/issue-20261.stderr
+++ b/src/test/ui/issue-20261.stderr
@@ -4,7 +4,7 @@ error[E0282]: type annotations needed
 LL |     for (ref i,) in [].iter() {
    |                     --------- the element type for this iterator is not specified
 LL |         i.clone();
-   |           ^^^^^ cannot infer type for `_`
+   |           ^^^^^ cannot infer type
    |
    = note: type must be known at this point
 
diff --git a/src/test/ui/issue-2151.stderr b/src/test/ui/issue-2151.stderr
index 592c4f424b0..516c5287b31 100644
--- a/src/test/ui/issue-2151.stderr
+++ b/src/test/ui/issue-2151.stderr
@@ -4,7 +4,7 @@ error[E0282]: type annotations needed
 LL |     let x = panic!();
    |         - consider giving `x` a type
 LL |     x.clone(); //~ ERROR type annotations needed
-   |     ^ cannot infer type for `_`
+   |     ^ cannot infer type
    |
    = note: type must be known at this point
 
diff --git a/src/test/ui/issue-23041.stderr b/src/test/ui/issue-23041.stderr
index f89bce09c7e..e97a97fec09 100644
--- a/src/test/ui/issue-23041.stderr
+++ b/src/test/ui/issue-23041.stderr
@@ -2,7 +2,7 @@ error[E0282]: type annotations needed
   --> $DIR/issue-23041.rs:16:22
    |
 LL |     b.downcast_ref::<fn(_)->_>(); //~ ERROR E0282
-   |                      ^^^^^^^^ cannot infer type for `_`
+   |                      ^^^^^^^^ cannot infer type
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/issue-24013.stderr b/src/test/ui/issue-24013.stderr
index 324e705e5a1..5729bdf2064 100644
--- a/src/test/ui/issue-24013.stderr
+++ b/src/test/ui/issue-24013.stderr
@@ -2,7 +2,7 @@ error[E0282]: type annotations needed
   --> $DIR/issue-24013.rs:15:20
    |
 LL |     unsafe {swap::<&mut _>(transmute(&a), transmute(&b))};
-   |                    ^^^^^^ cannot infer type for `_`
+   |                    ^^^^^^ cannot infer type
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/issue-51116.rs b/src/test/ui/issue-51116.rs
index 34217c6236c..c01559b1126 100644
--- a/src/test/ui/issue-51116.rs
+++ b/src/test/ui/issue-51116.rs
@@ -15,7 +15,7 @@ fn main() {
             //~^ NOTE the element type for this iterator is not specified
             *tile = 0;
             //~^ ERROR type annotations needed
-            //~| NOTE cannot infer type for `_`
+            //~| NOTE cannot infer type
             //~| NOTE type must be known at this point
         }
     }
diff --git a/src/test/ui/issue-51116.stderr b/src/test/ui/issue-51116.stderr
index 0c38688340b..fc84ee9028d 100644
--- a/src/test/ui/issue-51116.stderr
+++ b/src/test/ui/issue-51116.stderr
@@ -5,7 +5,7 @@ LL |         for tile in row {
    |                     --- the element type for this iterator is not specified
 LL |             //~^ NOTE the element type for this iterator is not specified
 LL |             *tile = 0;
-   |             ^^^^^ cannot infer type for `_`
+   |             ^^^^^ cannot infer type
    |
    = note: type must be known at this point
 
diff --git a/src/test/ui/issue-7813.stderr b/src/test/ui/issue-7813.stderr
index 34837e90e4f..3ab01982057 100644
--- a/src/test/ui/issue-7813.stderr
+++ b/src/test/ui/issue-7813.stderr
@@ -2,7 +2,7 @@ error[E0282]: type annotations needed
   --> $DIR/issue-7813.rs:12:13
    |
 LL |     let v = &[]; //~ ERROR type annotations needed
-   |         -   ^^^ cannot infer type for `_`
+   |         -   ^^^ cannot infer type
    |         |
    |         consider giving `v` a type
 
diff --git a/src/test/ui/span/issue-42234-unknown-receiver-type.stderr b/src/test/ui/span/issue-42234-unknown-receiver-type.stderr
index e1e13e9256d..d2d5a4a4b12 100644
--- a/src/test/ui/span/issue-42234-unknown-receiver-type.stderr
+++ b/src/test/ui/span/issue-42234-unknown-receiver-type.stderr
@@ -13,7 +13,7 @@ error[E0282]: type annotations needed
    |
 LL | /     data.iter() //~ ERROR 22:5: 23:20: type annotations needed
 LL | |         .sum::<_>()
-   | |___________________^ cannot infer type for `_`
+   | |___________________^ cannot infer type
    |
    = note: type must be known at this point
 
diff --git a/src/test/ui/span/method-and-field-eager-resolution.stderr b/src/test/ui/span/method-and-field-eager-resolution.stderr
index 21e19828a99..8a8c1e467b9 100644
--- a/src/test/ui/span/method-and-field-eager-resolution.stderr
+++ b/src/test/ui/span/method-and-field-eager-resolution.stderr
@@ -4,7 +4,7 @@ error[E0282]: type annotations needed
 LL |     let mut x = Default::default();
    |         ----- consider giving `x` a type
 LL |     x.0;
-   |     ^ cannot infer type for `_`
+   |     ^ cannot infer type
    |
    = note: type must be known at this point
 
@@ -14,7 +14,7 @@ error[E0282]: type annotations needed
 LL |     let mut x = Default::default();
    |         ----- consider giving `x` a type
 LL |     x[0];
-   |     ^ cannot infer type for `_`
+   |     ^ cannot infer type
    |
    = note: type must be known at this point
 
diff --git a/src/test/ui/type-check/cannot_infer_local_or_array.stderr b/src/test/ui/type-check/cannot_infer_local_or_array.stderr
index 90191ae6745..bfdd614e50d 100644
--- a/src/test/ui/type-check/cannot_infer_local_or_array.stderr
+++ b/src/test/ui/type-check/cannot_infer_local_or_array.stderr
@@ -2,7 +2,7 @@ error[E0282]: type annotations needed
   --> $DIR/cannot_infer_local_or_array.rs:12:13
    |
 LL |     let x = []; //~ ERROR type annotations needed
-   |         -   ^^ cannot infer type for `_`
+   |         -   ^^ cannot infer type
    |         |
    |         consider giving `x` a type