about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-04-19 04:04:02 +0000
committerbors <bors@rust-lang.org>2019-04-19 04:04:02 +0000
commit316a391dcb7d66dc25f1f9a4ec9d368ef7615005 (patch)
tree8701a634c23f3bd64688468562f1f57458199d61
parente928e9441157f63a776ba1f8773818838e0912ea (diff)
parent3ad9fcccbbfef027386c6f42fe6321c885b04817 (diff)
downloadrust-316a391dcb7d66dc25f1f9a4ec9d368ef7615005.tar.gz
rust-316a391dcb7d66dc25f1f9a4ec9d368ef7615005.zip
Auto merge of #60104 - Centril:rollup-7vmae1a, r=Centril
Rollup of 16 pull requests

Successful merges:

 - #59915 (Implement event filtering for self-profiler.)
 - #59933 (Make clear that format padding doesn't work for Debug)
 - #60023 (implement specialized nth_back() for Bytes, Fuse and Enumerate)
 - #60032 (Remove unwanted z-index change)
 - #60041 (Simplify the returning of a Result a bit)
 - #60045 (Suggest appropriate path when calling associated item on bare types)
 - #60052 (Correct unused parameter diagnostic)
 - #60056 (Update rustfmt to 1.2.1)
 - #60060 (whitelist RTM x86 target cpu feature)
 - #60061 (Change suggestion of field when not in self context)
 - #60064 (Point at try `?` on errors affecting the err match arm of the desugared code)
 - #60078 (Use more realistic example for thread builder)
 - #60080 (Fix small errors in docs for `rchunks_exact` and `rchunks_exact_mut`.)
 - #60082 (Update miri)
 - #60097 (Use -mergefunc-use-aliases for any LLVM >= 8)
 - #60098 (libcore: deny `elided_lifetimes_in_paths`)

Failed merges:

r? @ghost
-rw-r--r--Cargo.lock17
-rw-r--r--src/liballoc/fmt.rs7
-rw-r--r--src/libcore/alloc.rs6
-rw-r--r--src/libcore/any.rs6
-rw-r--r--src/libcore/array.rs4
-rw-r--r--src/libcore/ascii.rs2
-rw-r--r--src/libcore/cell.rs20
-rw-r--r--src/libcore/char/convert.rs5
-rw-r--r--src/libcore/char/decode.rs2
-rw-r--r--src/libcore/char/mod.rs12
-rw-r--r--src/libcore/ffi.rs10
-rw-r--r--src/libcore/fmt/builders.rs2
-rw-r--r--src/libcore/fmt/float.rs28
-rw-r--r--src/libcore/fmt/mod.rs126
-rw-r--r--src/libcore/fmt/num.rs10
-rw-r--r--src/libcore/hash/mod.rs2
-rw-r--r--src/libcore/iter/adapters/flatten.rs5
-rw-r--r--src/libcore/iter/adapters/mod.rs40
-rw-r--r--src/libcore/iter/sources.rs6
-rw-r--r--src/libcore/lib.rs1
-rw-r--r--src/libcore/mem.rs2
-rw-r--r--src/libcore/num/bignum.rs2
-rw-r--r--src/libcore/num/dec2flt/mod.rs10
-rw-r--r--src/libcore/num/dec2flt/parse.rs2
-rw-r--r--src/libcore/num/mod.rs18
-rw-r--r--src/libcore/ops/range.rs12
-rw-r--r--src/libcore/option.rs4
-rw-r--r--src/libcore/panic.rs8
-rw-r--r--src/libcore/panicking.rs4
-rw-r--r--src/libcore/pin.rs6
-rw-r--r--src/libcore/ptr.rs12
-rw-r--r--src/libcore/result.rs4
-rw-r--r--src/libcore/slice/mod.rs64
-rw-r--r--src/libcore/str/lossy.rs6
-rw-r--r--src/libcore/str/mod.rs47
-rw-r--r--src/libcore/str/pattern.rs2
-rw-r--r--src/libcore/sync/atomic.rs8
-rw-r--r--src/libcore/task/wake.rs4
-rw-r--r--src/libcore/tests/iter.rs18
-rw-r--r--src/libcore/time.rs4
-rw-r--r--src/librustc/hir/lowering.rs22
-rw-r--r--src/librustc/session/config.rs2
-rw-r--r--src/librustc/session/mod.rs7
-rw-r--r--src/librustc/traits/error_reporting.rs12
-rw-r--r--src/librustc/util/profiling.rs121
-rw-r--r--src/librustc_codegen_llvm/llvm/ffi.rs1
-rw-r--r--src/librustc_codegen_llvm/llvm_util.rs3
-rw-r--r--src/librustc_resolve/diagnostics.rs22
-rw-r--r--src/librustc_resolve/lib.rs59
-rw-r--r--src/librustc_typeck/astconv.rs57
-rw-r--r--src/librustc_typeck/check/method/suggest.rs18
-rw-r--r--src/librustc_typeck/check/wfcheck.rs13
-rw-r--r--src/librustc_typeck/collect.rs1
-rw-r--r--src/librustdoc/html/static/rustdoc.css1
-rw-r--r--src/libstd/fs.rs3
-rw-r--r--src/libstd/thread/mod.rs2
-rw-r--r--src/libsyntax/feature_gate.rs1
-rw-r--r--src/rustllvm/RustWrapper.cpp8
-rw-r--r--src/test/ui/class-missing-self.stderr2
-rw-r--r--src/test/ui/error-codes/E0392.stderr2
-rw-r--r--src/test/ui/inner-static-type-parameter.stderr2
-rw-r--r--src/test/ui/issues/issue-17904-2.stderr2
-rw-r--r--src/test/ui/issues/issue-20413.stderr2
-rw-r--r--src/test/ui/issues/issue-22933-3.stderr4
-rw-r--r--src/test/ui/issues/issue-32709.stderr6
-rw-r--r--src/test/ui/issues/issue-36299.stderr4
-rw-r--r--src/test/ui/issues/issue-36638.stderr2
-rw-r--r--src/test/ui/issues/issue-37534.stderr2
-rw-r--r--src/test/ui/issues/issue-60057.rs17
-rw-r--r--src/test/ui/issues/issue-60057.stderr20
-rw-r--r--src/test/ui/regions/region-bounds-on-objects-and-type-parameters.stderr2
-rw-r--r--src/test/ui/resolve/issue-14254.stderr8
-rw-r--r--src/test/ui/resolve/issue-2356.stderr12
-rw-r--r--src/test/ui/resolve/resolve-assoc-suggestions.stderr2
-rw-r--r--src/test/ui/resolve/resolve-speculative-adjustment.stderr2
-rw-r--r--src/test/ui/resolve/unresolved_static_type_field.stderr5
-rw-r--r--src/test/ui/self/self_type_keyword.stderr2
-rw-r--r--src/test/ui/suggestions/suggest-std-when-using-type.rs7
-rw-r--r--src/test/ui/suggestions/suggest-std-when-using-type.stderr24
-rw-r--r--src/test/ui/target-feature-gate.rs1
-rw-r--r--src/test/ui/target-feature-gate.stderr2
-rw-r--r--src/test/ui/try-block/try-block-bad-type.rs2
-rw-r--r--src/test/ui/try-block/try-block-bad-type.stderr6
-rw-r--r--src/test/ui/try-on-option.rs4
-rw-r--r--src/test/ui/try-on-option.stderr6
-rw-r--r--src/test/ui/variance/variance-regions-unused-direct.stderr4
-rw-r--r--src/test/ui/variance/variance-regions-unused-indirect.stderr4
-rw-r--r--src/test/ui/variance/variance-unused-region-param.stderr4
-rw-r--r--src/test/ui/variance/variance-unused-type-param.stderr6
m---------src/tools/miri28
m---------src/tools/rustfmt10
91 files changed, 687 insertions, 420 deletions
diff --git a/Cargo.lock b/Cargo.lock
index bc11ff2bbbc..95efd04d6f8 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -37,6 +37,14 @@ dependencies = [
 ]
 
 [[package]]
+name = "annotate-snippets"
+version = "0.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
 name = "ansi_term"
 version = "0.11.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -2246,7 +2254,7 @@ dependencies = [
  "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)",
  "rustc-workspace-hack 1.0.0",
  "rustc_tools_util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "rustfmt-nightly 1.2.0",
+ "rustfmt-nightly 1.2.1",
  "serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)",
  "serde_derive 1.0.81 (registry+https://github.com/rust-lang/crates.io-index)",
  "serde_ignored 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -3038,8 +3046,9 @@ dependencies = [
 
 [[package]]
 name = "rustfmt-nightly"
-version = "1.2.0"
+version = "1.2.1"
 dependencies = [
+ "annotate-snippets 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
  "bytecount 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "cargo_metadata 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -3049,6 +3058,7 @@ dependencies = [
  "env_logger 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
  "getopts 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)",
+ "ignore 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
  "itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -3061,7 +3071,7 @@ dependencies = [
  "serde_derive 1.0.81 (registry+https://github.com/rust-lang/crates.io-index)",
  "serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)",
  "term 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "toml 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)",
+ "toml 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "unicode-segmentation 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
  "unicode_categories 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -3987,6 +3997,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 "checksum adler32 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7e522997b529f05601e05166c07ed17789691f562762c7f3b987263d2dedee5c"
 "checksum aho-corasick 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)" = "1e9a933f4e58658d7b12defcf96dc5c720f20832deebe3e0a19efd3b6aaeeb9e"
 "checksum ammonia 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fd4c682378117e4186a492b2252b9537990e1617f44aed9788b9a1149de45477"
+"checksum annotate-snippets 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e8bcdcd5b291ce85a78f2b9d082a8de9676c12b1840d386d67bc5eea6f9d2b4e"
 "checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
 "checksum arc-swap 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "1025aeae2b664ca0ea726a89d574fe8f4e77dd712d443236ad1de00379450cf6"
 "checksum argon2rs 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "3f67b0b6a86dae6e67ff4ca2b6201396074996379fba2b92ff649126f37cb392"
diff --git a/src/liballoc/fmt.rs b/src/liballoc/fmt.rs
index d2ba9b00191..68cbc366d7b 100644
--- a/src/liballoc/fmt.rs
+++ b/src/liballoc/fmt.rs
@@ -343,9 +343,10 @@
 //! * `^` - the argument is center-aligned in `width` columns
 //! * `>` - the argument is right-aligned in `width` columns
 //!
-//! Note that alignment may not be implemented by some types. A good way
-//! to ensure padding is applied is to format your input, then use this
-//! resulting string to pad your output.
+//! Note that alignment may not be implemented by some types. In particular, it
+//! is not generally implemented for the `Debug` trait.  A good way to ensure
+//! padding is applied is to format your input, then use this resulting string
+//! to pad your output.
 //!
 //! ## Sign/`#`/`0`
 //!
diff --git a/src/libcore/alloc.rs b/src/libcore/alloc.rs
index 18354945a1e..c124457118c 100644
--- a/src/libcore/alloc.rs
+++ b/src/libcore/alloc.rs
@@ -338,7 +338,7 @@ pub struct LayoutErr {
 // (we need this for downstream impl of trait Error)
 #[stable(feature = "alloc_layout", since = "1.28.0")]
 impl fmt::Display for LayoutErr {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         f.write_str("invalid parameters to Layout::from_size_align")
     }
 }
@@ -354,7 +354,7 @@ pub struct AllocErr;
 // (we need this for downstream impl of trait Error)
 #[unstable(feature = "allocator_api", issue = "32838")]
 impl fmt::Display for AllocErr {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         f.write_str("memory allocation failed")
     }
 }
@@ -376,7 +376,7 @@ impl CannotReallocInPlace {
 // (we need this for downstream impl of trait Error)
 #[unstable(feature = "allocator_api", issue = "32838")]
 impl fmt::Display for CannotReallocInPlace {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         write!(f, "{}", self.description())
     }
 }
diff --git a/src/libcore/any.rs b/src/libcore/any.rs
index a4827aa36ed..d043ce34eff 100644
--- a/src/libcore/any.rs
+++ b/src/libcore/any.rs
@@ -107,7 +107,7 @@ impl<T: 'static + ?Sized > Any for T {
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl fmt::Debug for dyn Any {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         f.pad("Any")
     }
 }
@@ -117,14 +117,14 @@ impl fmt::Debug for dyn Any {
 // dispatch works with upcasting.
 #[stable(feature = "rust1", since = "1.0.0")]
 impl fmt::Debug for dyn Any + Send {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         f.pad("Any")
     }
 }
 
 #[stable(feature = "any_send_sync_methods", since = "1.28.0")]
 impl fmt::Debug for dyn Any + Send + Sync {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         f.pad("Any")
     }
 }
diff --git a/src/libcore/array.rs b/src/libcore/array.rs
index 3c445db69bb..fb9c99f667d 100644
--- a/src/libcore/array.rs
+++ b/src/libcore/array.rs
@@ -55,7 +55,7 @@ pub struct TryFromSliceError(());
 
 impl fmt::Display for TryFromSliceError {
     #[inline]
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         fmt::Display::fmt(self.__description(), f)
     }
 }
@@ -184,7 +184,7 @@ macro_rules! array_impls {
 
             #[stable(feature = "rust1", since = "1.0.0")]
             impl<T: fmt::Debug> fmt::Debug for [T; $N] {
-                fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+                fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
                     fmt::Debug::fmt(&&self[..], f)
                 }
             }
diff --git a/src/libcore/ascii.rs b/src/libcore/ascii.rs
index 953fe9ca2b9..c0ab364380f 100644
--- a/src/libcore/ascii.rs
+++ b/src/libcore/ascii.rs
@@ -131,7 +131,7 @@ impl FusedIterator for EscapeDefault {}
 
 #[stable(feature = "std_debug", since = "1.16.0")]
 impl fmt::Debug for EscapeDefault {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         f.pad("EscapeDefault { .. }")
     }
 }
diff --git a/src/libcore/cell.rs b/src/libcore/cell.rs
index 1c55e62539a..fcfd80d9266 100644
--- a/src/libcore/cell.rs
+++ b/src/libcore/cell.rs
@@ -577,14 +577,14 @@ pub struct BorrowError {
 
 #[stable(feature = "try_borrow", since = "1.13.0")]
 impl Debug for BorrowError {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         f.debug_struct("BorrowError").finish()
     }
 }
 
 #[stable(feature = "try_borrow", since = "1.13.0")]
 impl Display for BorrowError {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         Display::fmt("already mutably borrowed", f)
     }
 }
@@ -597,14 +597,14 @@ pub struct BorrowMutError {
 
 #[stable(feature = "try_borrow", since = "1.13.0")]
 impl Debug for BorrowMutError {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         f.debug_struct("BorrowMutError").finish()
     }
 }
 
 #[stable(feature = "try_borrow", since = "1.13.0")]
 impl Display for BorrowMutError {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         Display::fmt("already borrowed", f)
     }
 }
@@ -788,7 +788,7 @@ impl<T: ?Sized> RefCell<T> {
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
-    pub fn borrow(&self) -> Ref<T> {
+    pub fn borrow(&self) -> Ref<'_, T> {
         self.try_borrow().expect("already mutably borrowed")
     }
 
@@ -819,7 +819,7 @@ impl<T: ?Sized> RefCell<T> {
     /// ```
     #[stable(feature = "try_borrow", since = "1.13.0")]
     #[inline]
-    pub fn try_borrow(&self) -> Result<Ref<T>, BorrowError> {
+    pub fn try_borrow(&self) -> Result<Ref<'_, T>, BorrowError> {
         match BorrowRef::new(&self.borrow) {
             Some(b) => Ok(Ref {
                 value: unsafe { &*self.value.get() },
@@ -869,7 +869,7 @@ impl<T: ?Sized> RefCell<T> {
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
-    pub fn borrow_mut(&self) -> RefMut<T> {
+    pub fn borrow_mut(&self) -> RefMut<'_, T> {
         self.try_borrow_mut().expect("already borrowed")
     }
 
@@ -897,7 +897,7 @@ impl<T: ?Sized> RefCell<T> {
     /// ```
     #[stable(feature = "try_borrow", since = "1.13.0")]
     #[inline]
-    pub fn try_borrow_mut(&self) -> Result<RefMut<T>, BorrowMutError> {
+    pub fn try_borrow_mut(&self) -> Result<RefMut<'_, T>, BorrowMutError> {
         match BorrowRefMut::new(&self.borrow) {
             Some(b) => Ok(RefMut {
                 value: unsafe { &mut *self.value.get() },
@@ -1245,7 +1245,7 @@ impl<'b, T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<Ref<'b, U>> for Ref<'b,
 
 #[stable(feature = "std_guard_impls", since = "1.20.0")]
 impl<T: ?Sized + fmt::Display> fmt::Display for Ref<'_, T> {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         self.value.fmt(f)
     }
 }
@@ -1402,7 +1402,7 @@ impl<'b, T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<RefMut<'b, U>> for RefM
 
 #[stable(feature = "std_guard_impls", since = "1.20.0")]
 impl<T: ?Sized + fmt::Display> fmt::Display for RefMut<'_, T> {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         self.value.fmt(f)
     }
 }
diff --git a/src/libcore/char/convert.rs b/src/libcore/char/convert.rs
index ec273746111..ec9ac7ce8b1 100644
--- a/src/libcore/char/convert.rs
+++ b/src/libcore/char/convert.rs
@@ -193,7 +193,7 @@ enum CharErrorKind {
 
 #[stable(feature = "char_from_str", since = "1.20.0")]
 impl fmt::Display for ParseCharError {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         self.__description().fmt(f)
     }
 }
@@ -240,7 +240,7 @@ pub struct CharTryFromError(());
 
 #[stable(feature = "try_from", since = "1.34.0")]
 impl fmt::Display for CharTryFromError {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         "converted integer out of range for `char`".fmt(f)
     }
 }
@@ -316,4 +316,3 @@ pub fn from_digit(num: u32, radix: u32) -> Option<char> {
         None
     }
 }
-
diff --git a/src/libcore/char/decode.rs b/src/libcore/char/decode.rs
index ed92eca08bf..23059243c61 100644
--- a/src/libcore/char/decode.rs
+++ b/src/libcore/char/decode.rs
@@ -128,7 +128,7 @@ impl DecodeUtf16Error {
 
 #[stable(feature = "decode_utf16", since = "1.9.0")]
 impl fmt::Display for DecodeUtf16Error {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         write!(f, "unpaired surrogate found: {:x}", self.code)
     }
 }
diff --git a/src/libcore/char/mod.rs b/src/libcore/char/mod.rs
index 39186273d62..dedd2f758b6 100644
--- a/src/libcore/char/mod.rs
+++ b/src/libcore/char/mod.rs
@@ -220,7 +220,7 @@ impl FusedIterator for EscapeUnicode {}
 
 #[stable(feature = "char_struct_display", since = "1.16.0")]
 impl fmt::Display for EscapeUnicode {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         for c in self.clone() {
             f.write_char(c)?;
         }
@@ -333,7 +333,7 @@ impl FusedIterator for EscapeDefault {}
 
 #[stable(feature = "char_struct_display", since = "1.16.0")]
 impl fmt::Display for EscapeDefault {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         for c in self.clone() {
             f.write_char(c)?;
         }
@@ -367,7 +367,7 @@ impl FusedIterator for EscapeDebug {}
 
 #[stable(feature = "char_escape_debug", since = "1.20.0")]
 impl fmt::Display for EscapeDebug {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         fmt::Display::fmt(&self.0, f)
     }
 }
@@ -482,7 +482,7 @@ impl Iterator for CaseMappingIter {
 }
 
 impl fmt::Display for CaseMappingIter {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         match *self {
             CaseMappingIter::Three(a, b, c) => {
                 f.write_char(a)?;
@@ -503,14 +503,14 @@ impl fmt::Display for CaseMappingIter {
 
 #[stable(feature = "char_struct_display", since = "1.16.0")]
 impl fmt::Display for ToLowercase {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         fmt::Display::fmt(&self.0, f)
     }
 }
 
 #[stable(feature = "char_struct_display", since = "1.16.0")]
 impl fmt::Display for ToUppercase {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         fmt::Display::fmt(&self.0, f)
     }
 }
diff --git a/src/libcore/ffi.rs b/src/libcore/ffi.rs
index 004fafc5a0b..2906e5824ae 100644
--- a/src/libcore/ffi.rs
+++ b/src/libcore/ffi.rs
@@ -39,7 +39,7 @@ pub enum c_void {
 
 #[stable(feature = "std_debug", since = "1.16.0")]
 impl fmt::Debug for c_void {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         f.pad("c_void")
     }
 }
@@ -62,7 +62,7 @@ extern {
           all(target_arch = "aarch64", target_os = "ios"),
           windows))]
 impl fmt::Debug for VaListImpl {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         write!(f, "va_list* {:p}", self)
     }
 }
@@ -212,7 +212,7 @@ impl<'a> VaList<'a> {
 extern "rust-intrinsic" {
     /// Destroy the arglist `ap` after initialization with `va_start` or
     /// `va_copy`.
-    fn va_end(ap: &mut VaList);
+    fn va_end(ap: &mut VaList<'_>);
 
     /// Copies the current location of arglist `src` to the arglist `dst`.
     #[cfg(any(all(not(target_arch = "aarch64"), not(target_arch = "powerpc"),
@@ -222,9 +222,9 @@ extern "rust-intrinsic" {
     fn va_copy<'a>(src: &VaList<'a>) -> VaList<'a>;
     #[cfg(all(any(target_arch = "aarch64", target_arch = "powerpc", target_arch = "x86_64"),
               not(windows), not(all(target_arch = "aarch64", target_os = "ios"))))]
-    fn va_copy(src: &VaList) -> VaListImpl;
+    fn va_copy(src: &VaList<'_>) -> VaListImpl;
 
     /// Loads an argument of type `T` from the `va_list` `ap` and increment the
     /// argument `ap` points to.
-    fn va_arg<T: sealed_trait::VaArgSafe>(ap: &mut VaList) -> T;
+    fn va_arg<T: sealed_trait::VaArgSafe>(ap: &mut VaList<'_>) -> T;
 }
diff --git a/src/libcore/fmt/builders.rs b/src/libcore/fmt/builders.rs
index e78381ba0c4..df86da5fc39 100644
--- a/src/libcore/fmt/builders.rs
+++ b/src/libcore/fmt/builders.rs
@@ -6,7 +6,7 @@ struct PadAdapter<'a> {
 }
 
 impl<'a> PadAdapter<'a> {
-    fn wrap<'b, 'c: 'a+'b>(fmt: &'c mut fmt::Formatter, slot: &'b mut Option<Self>)
+    fn wrap<'b, 'c: 'a+'b>(fmt: &'c mut fmt::Formatter<'_>, slot: &'b mut Option<Self>)
                         -> fmt::Formatter<'b> {
         fmt.wrap_buf(move |buf| {
             *slot = Some(PadAdapter {
diff --git a/src/libcore/fmt/float.rs b/src/libcore/fmt/float.rs
index 5fc2cd4b8d0..4bd7d3b4b22 100644
--- a/src/libcore/fmt/float.rs
+++ b/src/libcore/fmt/float.rs
@@ -5,13 +5,13 @@ use crate::num::flt2dec;
 // Don't inline this so callers don't use the stack space this function
 // requires unless they have to.
 #[inline(never)]
-fn float_to_decimal_common_exact<T>(fmt: &mut Formatter, num: &T,
+fn float_to_decimal_common_exact<T>(fmt: &mut Formatter<'_>, num: &T,
                                     sign: flt2dec::Sign, precision: usize) -> Result
     where T: flt2dec::DecodableFloat
 {
     unsafe {
         let mut buf = MaybeUninit::<[u8; 1024]>::uninit(); // enough for f32 and f64
-        let mut parts = MaybeUninit::<[flt2dec::Part; 4]>::uninit();
+        let mut parts = MaybeUninit::<[flt2dec::Part<'_>; 4]>::uninit();
         // FIXME(#53491): Technically, this is calling `get_mut` on an uninitialized
         // `MaybeUninit` (here and elsewhere in this file).  Revisit this once
         // we decided whether that is valid or not.
@@ -26,14 +26,14 @@ fn float_to_decimal_common_exact<T>(fmt: &mut Formatter, num: &T,
 // Don't inline this so callers that call both this and the above won't wind
 // up using the combined stack space of both functions in some cases.
 #[inline(never)]
-fn float_to_decimal_common_shortest<T>(fmt: &mut Formatter, num: &T,
+fn float_to_decimal_common_shortest<T>(fmt: &mut Formatter<'_>, num: &T,
                                        sign: flt2dec::Sign, precision: usize) -> Result
     where T: flt2dec::DecodableFloat
 {
     unsafe {
         // enough for f32 and f64
         let mut buf = MaybeUninit::<[u8; flt2dec::MAX_SIG_DIGITS]>::uninit();
-        let mut parts = MaybeUninit::<[flt2dec::Part; 4]>::uninit();
+        let mut parts = MaybeUninit::<[flt2dec::Part<'_>; 4]>::uninit();
         // FIXME(#53491)
         let formatted = flt2dec::to_shortest_str(flt2dec::strategy::grisu::format_shortest, *num,
                                                  sign, precision, false, buf.get_mut(),
@@ -43,7 +43,7 @@ fn float_to_decimal_common_shortest<T>(fmt: &mut Formatter, num: &T,
 }
 
 // Common code of floating point Debug and Display.
-fn float_to_decimal_common<T>(fmt: &mut Formatter, num: &T,
+fn float_to_decimal_common<T>(fmt: &mut Formatter<'_>, num: &T,
                               negative_zero: bool, min_precision: usize) -> Result
     where T: flt2dec::DecodableFloat
 {
@@ -65,14 +65,14 @@ fn float_to_decimal_common<T>(fmt: &mut Formatter, num: &T,
 // Don't inline this so callers don't use the stack space this function
 // requires unless they have to.
 #[inline(never)]
-fn float_to_exponential_common_exact<T>(fmt: &mut Formatter, num: &T,
+fn float_to_exponential_common_exact<T>(fmt: &mut Formatter<'_>, num: &T,
                                         sign: flt2dec::Sign, precision: usize,
                                         upper: bool) -> Result
     where T: flt2dec::DecodableFloat
 {
     unsafe {
         let mut buf = MaybeUninit::<[u8; 1024]>::uninit(); // enough for f32 and f64
-        let mut parts = MaybeUninit::<[flt2dec::Part; 6]>::uninit();
+        let mut parts = MaybeUninit::<[flt2dec::Part<'_>; 6]>::uninit();
         // FIXME(#53491)
         let formatted = flt2dec::to_exact_exp_str(flt2dec::strategy::grisu::format_exact,
                                                   *num, sign, precision,
@@ -84,7 +84,7 @@ fn float_to_exponential_common_exact<T>(fmt: &mut Formatter, num: &T,
 // Don't inline this so callers that call both this and the above won't wind
 // up using the combined stack space of both functions in some cases.
 #[inline(never)]
-fn float_to_exponential_common_shortest<T>(fmt: &mut Formatter,
+fn float_to_exponential_common_shortest<T>(fmt: &mut Formatter<'_>,
                                            num: &T, sign: flt2dec::Sign,
                                            upper: bool) -> Result
     where T: flt2dec::DecodableFloat
@@ -92,7 +92,7 @@ fn float_to_exponential_common_shortest<T>(fmt: &mut Formatter,
     unsafe {
         // enough for f32 and f64
         let mut buf = MaybeUninit::<[u8; flt2dec::MAX_SIG_DIGITS]>::uninit();
-        let mut parts = MaybeUninit::<[flt2dec::Part; 6]>::uninit();
+        let mut parts = MaybeUninit::<[flt2dec::Part<'_>; 6]>::uninit();
         // FIXME(#53491)
         let formatted = flt2dec::to_shortest_exp_str(flt2dec::strategy::grisu::format_shortest,
                                                      *num, sign, (0, 0), upper,
@@ -102,7 +102,7 @@ fn float_to_exponential_common_shortest<T>(fmt: &mut Formatter,
 }
 
 // Common code of floating point LowerExp and UpperExp.
-fn float_to_exponential_common<T>(fmt: &mut Formatter, num: &T, upper: bool) -> Result
+fn float_to_exponential_common<T>(fmt: &mut Formatter<'_>, num: &T, upper: bool) -> Result
     where T: flt2dec::DecodableFloat
 {
     let force_sign = fmt.sign_plus();
@@ -123,28 +123,28 @@ macro_rules! floating {
     ($ty:ident) => (
         #[stable(feature = "rust1", since = "1.0.0")]
         impl Debug for $ty {
-            fn fmt(&self, fmt: &mut Formatter) -> Result {
+            fn fmt(&self, fmt: &mut Formatter<'_>) -> Result {
                 float_to_decimal_common(fmt, self, true, 1)
             }
         }
 
         #[stable(feature = "rust1", since = "1.0.0")]
         impl Display for $ty {
-            fn fmt(&self, fmt: &mut Formatter) -> Result {
+            fn fmt(&self, fmt: &mut Formatter<'_>) -> Result {
                 float_to_decimal_common(fmt, self, false, 0)
             }
         }
 
         #[stable(feature = "rust1", since = "1.0.0")]
         impl LowerExp for $ty {
-            fn fmt(&self, fmt: &mut Formatter) -> Result {
+            fn fmt(&self, fmt: &mut Formatter<'_>) -> Result {
                 float_to_exponential_common(fmt, self, false)
             }
         }
 
         #[stable(feature = "rust1", since = "1.0.0")]
         impl UpperExp for $ty {
-            fn fmt(&self, fmt: &mut Formatter) -> Result {
+            fn fmt(&self, fmt: &mut Formatter<'_>) -> Result {
                 float_to_exponential_common(fmt, self, true)
             }
         }
diff --git a/src/libcore/fmt/mod.rs b/src/libcore/fmt/mod.rs
index 1ccd6ec898f..43c1a3b7767 100644
--- a/src/libcore/fmt/mod.rs
+++ b/src/libcore/fmt/mod.rs
@@ -55,7 +55,7 @@ pub mod rt {
 /// }
 ///
 /// impl fmt::Display for Triangle {
-///     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+///     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
 ///         write!(f, "({}, {}, {})", self.a, self.b, self.c)
 ///     }
 /// }
@@ -191,7 +191,7 @@ pub trait Write {
     /// assert_eq!(&buf, "world");
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    fn write_fmt(mut self: &mut Self, args: Arguments) -> Result {
+    fn write_fmt(mut self: &mut Self, args: Arguments<'_>) -> Result {
         write(&mut self, args)
     }
 }
@@ -206,7 +206,7 @@ impl<W: Write + ?Sized> Write for &mut W {
         (**self).write_char(c)
     }
 
-    fn write_fmt(&mut self, args: Arguments) -> Result {
+    fn write_fmt(&mut self, args: Arguments<'_>) -> Result {
         (**self).write_fmt(args)
     }
 }
@@ -238,7 +238,7 @@ pub struct Formatter<'a> {
 }
 
 // NB. Argument is essentially an optimized partially applied formatting function,
-// equivalent to `exists T.(&T, fn(&T, &mut Formatter) -> Result`.
+// equivalent to `exists T.(&T, fn(&T, &mut Formatter<'_>) -> Result`.
 
 struct Void {
     _priv: (),
@@ -263,12 +263,12 @@ struct Void {
 #[doc(hidden)]
 pub struct ArgumentV1<'a> {
     value: &'a Void,
-    formatter: fn(&Void, &mut Formatter) -> Result,
+    formatter: fn(&Void, &mut Formatter<'_>) -> Result,
 }
 
 impl<'a> ArgumentV1<'a> {
     #[inline(never)]
-    fn show_usize(x: &usize, f: &mut Formatter) -> Result {
+    fn show_usize(x: &usize, f: &mut Formatter<'_>) -> Result {
         Display::fmt(x, f)
     }
 
@@ -276,7 +276,7 @@ impl<'a> ArgumentV1<'a> {
     #[unstable(feature = "fmt_internals", reason = "internal to format_args!",
                issue = "0")]
     pub fn new<'b, T>(x: &'b T,
-                      f: fn(&T, &mut Formatter) -> Result) -> ArgumentV1<'b> {
+                      f: fn(&T, &mut Formatter<'_>) -> Result) -> ArgumentV1<'b> {
         unsafe {
             ArgumentV1 {
                 formatter: mem::transmute(f),
@@ -288,7 +288,7 @@ impl<'a> ArgumentV1<'a> {
     #[doc(hidden)]
     #[unstable(feature = "fmt_internals", reason = "internal to format_args!",
                issue = "0")]
-    pub fn from_usize(x: &usize) -> ArgumentV1 {
+    pub fn from_usize(x: &usize) -> ArgumentV1<'_> {
         ArgumentV1::new(x, ArgumentV1::show_usize)
     }
 
@@ -406,14 +406,14 @@ pub struct Arguments<'a> {
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl Debug for Arguments<'_> {
-    fn fmt(&self, fmt: &mut Formatter) -> Result {
+    fn fmt(&self, fmt: &mut Formatter<'_>) -> Result {
         Display::fmt(self, fmt)
     }
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl Display for Arguments<'_> {
-    fn fmt(&self, fmt: &mut Formatter) -> Result {
+    fn fmt(&self, fmt: &mut Formatter<'_>) -> Result {
         write(fmt.buf, *self)
     }
 }
@@ -463,7 +463,7 @@ impl Display for Arguments<'_> {
 /// }
 ///
 /// impl fmt::Debug for Point {
-///     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+///     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
 ///         write!(f, "Point {{ x: {}, y: {} }}", self.x, self.y)
 ///     }
 /// }
@@ -533,7 +533,7 @@ pub trait Debug {
     /// }
     ///
     /// impl fmt::Debug for Position {
-    ///     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    ///     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
     ///         write!(f, "({:?}, {:?})", self.longitude, self.latitude)
     ///     }
     /// }
@@ -542,7 +542,7 @@ pub trait Debug {
     ///            format!("{:?}", Position { longitude: 1.987, latitude: 2.983, }));
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    fn fmt(&self, f: &mut Formatter) -> Result;
+    fn fmt(&self, f: &mut Formatter<'_>) -> Result;
 }
 
 /// Format trait for an empty format, `{}`.
@@ -569,7 +569,7 @@ pub trait Debug {
 /// }
 ///
 /// impl fmt::Display for Point {
-///     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+///     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
 ///         write!(f, "({}, {})", self.x, self.y)
 ///     }
 /// }
@@ -605,7 +605,7 @@ pub trait Display {
     /// }
     ///
     /// impl fmt::Display for Position {
-    ///     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    ///     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
     ///         write!(f, "({}, {})", self.longitude, self.latitude)
     ///     }
     /// }
@@ -614,7 +614,7 @@ pub trait Display {
     ///            format!("{}", Position { longitude: 1.987, latitude: 2.983, }));
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    fn fmt(&self, f: &mut Formatter) -> Result;
+    fn fmt(&self, f: &mut Formatter<'_>) -> Result;
 }
 
 /// `o` formatting.
@@ -651,7 +651,7 @@ pub trait Display {
 /// struct Length(i32);
 ///
 /// impl fmt::Octal for Length {
-///     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+///     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
 ///         let val = self.0;
 ///
 ///         write!(f, "{:o}", val) // delegate to i32's implementation
@@ -666,7 +666,7 @@ pub trait Display {
 pub trait Octal {
     /// Formats the value using the given formatter.
     #[stable(feature = "rust1", since = "1.0.0")]
-    fn fmt(&self, f: &mut Formatter) -> Result;
+    fn fmt(&self, f: &mut Formatter<'_>) -> Result;
 }
 
 /// `b` formatting.
@@ -701,7 +701,7 @@ pub trait Octal {
 /// struct Length(i32);
 ///
 /// impl fmt::Binary for Length {
-///     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+///     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
 ///         let val = self.0;
 ///
 ///         write!(f, "{:b}", val) // delegate to i32's implementation
@@ -722,7 +722,7 @@ pub trait Octal {
 pub trait Binary {
     /// Formats the value using the given formatter.
     #[stable(feature = "rust1", since = "1.0.0")]
-    fn fmt(&self, f: &mut Formatter) -> Result;
+    fn fmt(&self, f: &mut Formatter<'_>) -> Result;
 }
 
 /// `x` formatting.
@@ -760,7 +760,7 @@ pub trait Binary {
 /// struct Length(i32);
 ///
 /// impl fmt::LowerHex for Length {
-///     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+///     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
 ///         let val = self.0;
 ///
 ///         write!(f, "{:x}", val) // delegate to i32's implementation
@@ -775,7 +775,7 @@ pub trait Binary {
 pub trait LowerHex {
     /// Formats the value using the given formatter.
     #[stable(feature = "rust1", since = "1.0.0")]
-    fn fmt(&self, f: &mut Formatter) -> Result;
+    fn fmt(&self, f: &mut Formatter<'_>) -> Result;
 }
 
 /// `X` formatting.
@@ -813,7 +813,7 @@ pub trait LowerHex {
 /// struct Length(i32);
 ///
 /// impl fmt::UpperHex for Length {
-///     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+///     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
 ///         let val = self.0;
 ///
 ///         write!(f, "{:X}", val) // delegate to i32's implementation
@@ -828,7 +828,7 @@ pub trait LowerHex {
 pub trait UpperHex {
     /// Formats the value using the given formatter.
     #[stable(feature = "rust1", since = "1.0.0")]
-    fn fmt(&self, f: &mut Formatter) -> Result;
+    fn fmt(&self, f: &mut Formatter<'_>) -> Result;
 }
 
 /// `p` formatting.
@@ -858,7 +858,7 @@ pub trait UpperHex {
 /// struct Length(i32);
 ///
 /// impl fmt::Pointer for Length {
-///     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+///     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
 ///         // use `as` to convert to a `*const T`, which implements Pointer, which we can use
 ///
 ///         write!(f, "{:p}", self as *const Length)
@@ -873,7 +873,7 @@ pub trait UpperHex {
 pub trait Pointer {
     /// Formats the value using the given formatter.
     #[stable(feature = "rust1", since = "1.0.0")]
-    fn fmt(&self, f: &mut Formatter) -> Result;
+    fn fmt(&self, f: &mut Formatter<'_>) -> Result;
 }
 
 /// `e` formatting.
@@ -902,7 +902,7 @@ pub trait Pointer {
 /// struct Length(i32);
 ///
 /// impl fmt::LowerExp for Length {
-///     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+///     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
 ///         let val = self.0;
 ///         write!(f, "{}e1", val / 10)
 ///     }
@@ -916,7 +916,7 @@ pub trait Pointer {
 pub trait LowerExp {
     /// Formats the value using the given formatter.
     #[stable(feature = "rust1", since = "1.0.0")]
-    fn fmt(&self, f: &mut Formatter) -> Result;
+    fn fmt(&self, f: &mut Formatter<'_>) -> Result;
 }
 
 /// `E` formatting.
@@ -945,7 +945,7 @@ pub trait LowerExp {
 /// struct Length(i32);
 ///
 /// impl fmt::UpperExp for Length {
-///     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+///     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
 ///         let val = self.0;
 ///         write!(f, "{}E1", val / 10)
 ///     }
@@ -959,7 +959,7 @@ pub trait LowerExp {
 pub trait UpperExp {
     /// Formats the value using the given formatter.
     #[stable(feature = "rust1", since = "1.0.0")]
-    fn fmt(&self, f: &mut Formatter) -> Result;
+    fn fmt(&self, f: &mut Formatter<'_>) -> Result;
 }
 
 /// The `write` function takes an output stream, and an `Arguments` struct
@@ -994,7 +994,7 @@ pub trait UpperExp {
 ///
 /// [`write!`]: ../../std/macro.write.html
 #[stable(feature = "rust1", since = "1.0.0")]
-pub fn write(output: &mut dyn Write, args: Arguments) -> Result {
+pub fn write(output: &mut dyn Write, args: Arguments<'_>) -> Result {
     let mut formatter = Formatter {
         flags: 0,
         width: None,
@@ -1183,7 +1183,7 @@ impl<'a> Formatter<'a> {
 
         // Writes the sign if it exists, and then the prefix if it was requested
         #[inline(never)]
-        fn write_prefix(f: &mut Formatter, sign: Option<char>, prefix: Option<&str>) -> Result {
+        fn write_prefix(f: &mut Formatter<'_>, sign: Option<char>, prefix: Option<&str>) -> Result {
             if let Some(c) = sign {
                 f.buf.write_char(c)?;
             }
@@ -1331,7 +1331,7 @@ impl<'a> Formatter<'a> {
     /// Takes the formatted parts and applies the padding.
     /// Assumes that the caller already has rendered the parts with required precision,
     /// so that `self.precision` can be ignored.
-    fn pad_formatted_parts(&mut self, formatted: &flt2dec::Formatted) -> Result {
+    fn pad_formatted_parts(&mut self, formatted: &flt2dec::Formatted<'_>) -> Result {
         if let Some(mut width) = self.width {
             // for the sign-aware zero padding, we render the sign first and
             // behave as if we had no sign from the beginning.
@@ -1370,7 +1370,7 @@ impl<'a> Formatter<'a> {
         }
     }
 
-    fn write_formatted_parts(&mut self, formatted: &flt2dec::Formatted) -> Result {
+    fn write_formatted_parts(&mut self, formatted: &flt2dec::Formatted<'_>) -> Result {
         fn write_bytes(buf: &mut dyn Write, s: &[u8]) -> Result {
             buf.write_str(unsafe { str::from_utf8_unchecked(s) })
         }
@@ -1453,7 +1453,7 @@ impl<'a> Formatter<'a> {
     /// assert_eq!(&format!("{:0>8}", Foo(2)), "Foo 2");
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn write_fmt(&mut self, fmt: Arguments) -> Result {
+    pub fn write_fmt(&mut self, fmt: Arguments<'_>) -> Result {
         write(self.buf, fmt)
     }
 
@@ -1892,14 +1892,14 @@ impl Write for Formatter<'_> {
         self.buf.write_char(c)
     }
 
-    fn write_fmt(&mut self, args: Arguments) -> Result {
+    fn write_fmt(&mut self, args: Arguments<'_>) -> Result {
         write(self.buf, args)
     }
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl Display for Error {
-    fn fmt(&self, f: &mut Formatter) -> Result {
+    fn fmt(&self, f: &mut Formatter<'_>) -> Result {
         Display::fmt("an error occurred when formatting an argument", f)
     }
 }
@@ -1911,11 +1911,11 @@ macro_rules! fmt_refs {
         $(
         #[stable(feature = "rust1", since = "1.0.0")]
         impl<T: ?Sized + $tr> $tr for &T {
-            fn fmt(&self, f: &mut Formatter) -> Result { $tr::fmt(&**self, f) }
+            fn fmt(&self, f: &mut Formatter<'_>) -> Result { $tr::fmt(&**self, f) }
         }
         #[stable(feature = "rust1", since = "1.0.0")]
         impl<T: ?Sized + $tr> $tr for &mut T {
-            fn fmt(&self, f: &mut Formatter) -> Result { $tr::fmt(&**self, f) }
+            fn fmt(&self, f: &mut Formatter<'_>) -> Result { $tr::fmt(&**self, f) }
         }
         )*
     }
@@ -1925,14 +1925,14 @@ fmt_refs! { Debug, Display, Octal, Binary, LowerHex, UpperHex, LowerExp, UpperEx
 
 #[unstable(feature = "never_type", issue = "35121")]
 impl Debug for ! {
-    fn fmt(&self, _: &mut Formatter) -> Result {
+    fn fmt(&self, _: &mut Formatter<'_>) -> Result {
         *self
     }
 }
 
 #[unstable(feature = "never_type", issue = "35121")]
 impl Display for ! {
-    fn fmt(&self, _: &mut Formatter) -> Result {
+    fn fmt(&self, _: &mut Formatter<'_>) -> Result {
         *self
     }
 }
@@ -1940,21 +1940,21 @@ impl Display for ! {
 #[stable(feature = "rust1", since = "1.0.0")]
 impl Debug for bool {
     #[inline]
-    fn fmt(&self, f: &mut Formatter) -> Result {
+    fn fmt(&self, f: &mut Formatter<'_>) -> Result {
         Display::fmt(self, f)
     }
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl Display for bool {
-    fn fmt(&self, f: &mut Formatter) -> Result {
+    fn fmt(&self, f: &mut Formatter<'_>) -> Result {
         Display::fmt(if *self { "true" } else { "false" }, f)
     }
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl Debug for str {
-    fn fmt(&self, f: &mut Formatter) -> Result {
+    fn fmt(&self, f: &mut Formatter<'_>) -> Result {
         f.write_char('"')?;
         let mut from = 0;
         for (i, c) in self.char_indices() {
@@ -1975,14 +1975,14 @@ impl Debug for str {
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl Display for str {
-    fn fmt(&self, f: &mut Formatter) -> Result {
+    fn fmt(&self, f: &mut Formatter<'_>) -> Result {
         f.pad(self)
     }
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl Debug for char {
-    fn fmt(&self, f: &mut Formatter) -> Result {
+    fn fmt(&self, f: &mut Formatter<'_>) -> Result {
         f.write_char('\'')?;
         for c in self.escape_debug() {
             f.write_char(c)?
@@ -1993,7 +1993,7 @@ impl Debug for char {
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl Display for char {
-    fn fmt(&self, f: &mut Formatter) -> Result {
+    fn fmt(&self, f: &mut Formatter<'_>) -> Result {
         if f.width.is_none() && f.precision.is_none() {
             f.write_char(*self)
         } else {
@@ -2004,7 +2004,7 @@ impl Display for char {
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<T: ?Sized> Pointer for *const T {
-    fn fmt(&self, f: &mut Formatter) -> Result {
+    fn fmt(&self, f: &mut Formatter<'_>) -> Result {
         let old_width = f.width;
         let old_flags = f.flags;
 
@@ -2032,21 +2032,21 @@ impl<T: ?Sized> Pointer for *const T {
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<T: ?Sized> Pointer for *mut T {
-    fn fmt(&self, f: &mut Formatter) -> Result {
+    fn fmt(&self, f: &mut Formatter<'_>) -> Result {
         Pointer::fmt(&(*self as *const T), f)
     }
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<T: ?Sized> Pointer for &T {
-    fn fmt(&self, f: &mut Formatter) -> Result {
+    fn fmt(&self, f: &mut Formatter<'_>) -> Result {
         Pointer::fmt(&(*self as *const T), f)
     }
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<T: ?Sized> Pointer for &mut T {
-    fn fmt(&self, f: &mut Formatter) -> Result {
+    fn fmt(&self, f: &mut Formatter<'_>) -> Result {
         Pointer::fmt(&(&**self as *const T), f)
     }
 }
@@ -2055,11 +2055,11 @@ impl<T: ?Sized> Pointer for &mut T {
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<T: ?Sized> Debug for *const T {
-    fn fmt(&self, f: &mut Formatter) -> Result { Pointer::fmt(self, f) }
+    fn fmt(&self, f: &mut Formatter<'_>) -> Result { Pointer::fmt(self, f) }
 }
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<T: ?Sized> Debug for *mut T {
-    fn fmt(&self, f: &mut Formatter) -> Result { Pointer::fmt(self, f) }
+    fn fmt(&self, f: &mut Formatter<'_>) -> Result { Pointer::fmt(self, f) }
 }
 
 macro_rules! peel {
@@ -2072,7 +2072,7 @@ macro_rules! tuple {
         #[stable(feature = "rust1", since = "1.0.0")]
         impl<$($name:Debug),*> Debug for ($($name,)*) where last_type!($($name,)+): ?Sized {
             #[allow(non_snake_case, unused_assignments)]
-            fn fmt(&self, f: &mut Formatter) -> Result {
+            fn fmt(&self, f: &mut Formatter<'_>) -> Result {
                 let mut builder = f.debug_tuple("");
                 let ($(ref $name,)*) = *self;
                 $(
@@ -2095,7 +2095,7 @@ tuple! { T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, }
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<T: Debug> Debug for [T] {
-    fn fmt(&self, f: &mut Formatter) -> Result {
+    fn fmt(&self, f: &mut Formatter<'_>) -> Result {
         f.debug_list().entries(self.iter()).finish()
     }
 }
@@ -2103,20 +2103,20 @@ impl<T: Debug> Debug for [T] {
 #[stable(feature = "rust1", since = "1.0.0")]
 impl Debug for () {
     #[inline]
-    fn fmt(&self, f: &mut Formatter) -> Result {
+    fn fmt(&self, f: &mut Formatter<'_>) -> Result {
         f.pad("()")
     }
 }
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<T: ?Sized> Debug for PhantomData<T> {
-    fn fmt(&self, f: &mut Formatter) -> Result {
+    fn fmt(&self, f: &mut Formatter<'_>) -> Result {
         f.pad("PhantomData")
     }
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<T: Copy + Debug> Debug for Cell<T> {
-    fn fmt(&self, f: &mut Formatter) -> Result {
+    fn fmt(&self, f: &mut Formatter<'_>) -> Result {
         f.debug_struct("Cell")
             .field("value", &self.get())
             .finish()
@@ -2125,7 +2125,7 @@ impl<T: Copy + Debug> Debug for Cell<T> {
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<T: ?Sized + Debug> Debug for RefCell<T> {
-    fn fmt(&self, f: &mut Formatter) -> Result {
+    fn fmt(&self, f: &mut Formatter<'_>) -> Result {
         match self.try_borrow() {
             Ok(borrow) => {
                 f.debug_struct("RefCell")
@@ -2138,7 +2138,7 @@ impl<T: ?Sized + Debug> Debug for RefCell<T> {
                 struct BorrowedPlaceholder;
 
                 impl Debug for BorrowedPlaceholder {
-                    fn fmt(&self, f: &mut Formatter) -> Result {
+                    fn fmt(&self, f: &mut Formatter<'_>) -> Result {
                         f.write_str("<borrowed>")
                     }
                 }
@@ -2153,21 +2153,21 @@ impl<T: ?Sized + Debug> Debug for RefCell<T> {
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<T: ?Sized + Debug> Debug for Ref<'_, T> {
-    fn fmt(&self, f: &mut Formatter) -> Result {
+    fn fmt(&self, f: &mut Formatter<'_>) -> Result {
         Debug::fmt(&**self, f)
     }
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<T: ?Sized + Debug> Debug for RefMut<'_, T> {
-    fn fmt(&self, f: &mut Formatter) -> Result {
+    fn fmt(&self, f: &mut Formatter<'_>) -> Result {
         Debug::fmt(&*(self.deref()), f)
     }
 }
 
 #[stable(feature = "core_impl_debug", since = "1.9.0")]
 impl<T: ?Sized + Debug> Debug for UnsafeCell<T> {
-    fn fmt(&self, f: &mut Formatter) -> Result {
+    fn fmt(&self, f: &mut Formatter<'_>) -> Result {
         f.pad("UnsafeCell")
     }
 }
diff --git a/src/libcore/fmt/num.rs b/src/libcore/fmt/num.rs
index 6ad9cc62239..f9b4c26496c 100644
--- a/src/libcore/fmt/num.rs
+++ b/src/libcore/fmt/num.rs
@@ -46,7 +46,7 @@ trait GenericRadix {
     fn digit(x: u8) -> u8;
 
     /// Format an integer using the radix using a formatter.
-    fn fmt_int<T: Int>(&self, mut x: T, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt_int<T: Int>(&self, mut x: T, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         // The radix can be as low as 2, so we need a buffer of at least 128
         // characters for a base 2 number.
         let zero = T::zero();
@@ -131,7 +131,7 @@ macro_rules! int_base {
     ($Trait:ident for $T:ident as $U:ident -> $Radix:ident) => {
         #[stable(feature = "rust1", since = "1.0.0")]
         impl fmt::$Trait for $T {
-            fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+            fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
                 $Radix.fmt_int(*self as $U, f)
             }
         }
@@ -143,7 +143,7 @@ macro_rules! debug {
         #[stable(feature = "rust1", since = "1.0.0")]
         impl fmt::Debug for $T {
             #[inline]
-            fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+            fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
                 if f.debug_lower_hex() {
                     fmt::LowerHex::fmt(self, f)
                 } else if f.debug_upper_hex() {
@@ -188,7 +188,7 @@ static DEC_DIGITS_LUT: &[u8; 200] =
 
 macro_rules! impl_Display {
     ($($t:ident),* as $u:ident via $conv_fn:ident named $name:ident) => {
-        fn $name(mut n: $u, is_nonnegative: bool, f: &mut fmt::Formatter) -> fmt::Result {
+        fn $name(mut n: $u, is_nonnegative: bool, f: &mut fmt::Formatter<'_>) -> fmt::Result {
             let mut buf = uninitialized_array![u8; 39];
             let mut curr = buf.len() as isize;
             let buf_ptr = MaybeUninit::first_ptr_mut(&mut buf);
@@ -243,7 +243,7 @@ macro_rules! impl_Display {
             #[stable(feature = "rust1", since = "1.0.0")]
             impl fmt::Display for $t {
                 #[allow(unused_comparisons)]
-                fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+                fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
                     let is_nonnegative = *self >= 0;
                     let n = if is_nonnegative {
                         self.$conv_fn()
diff --git a/src/libcore/hash/mod.rs b/src/libcore/hash/mod.rs
index 46f7f90e464..98150fd9f82 100644
--- a/src/libcore/hash/mod.rs
+++ b/src/libcore/hash/mod.rs
@@ -500,7 +500,7 @@ pub struct BuildHasherDefault<H>(marker::PhantomData<H>);
 
 #[stable(since = "1.9.0", feature = "core_impl_debug")]
 impl<H> fmt::Debug for BuildHasherDefault<H> {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         f.pad("BuildHasherDefault")
     }
 }
diff --git a/src/libcore/iter/adapters/flatten.rs b/src/libcore/iter/adapters/flatten.rs
index 8eb81fbb2c6..8c2aae477bf 100644
--- a/src/libcore/iter/adapters/flatten.rs
+++ b/src/libcore/iter/adapters/flatten.rs
@@ -34,7 +34,7 @@ impl<I: Clone, U: Clone + IntoIterator, F: Clone> Clone for FlatMap<I, U, F>
 impl<I: fmt::Debug, U: IntoIterator, F> fmt::Debug for FlatMap<I, U, F>
     where U::IntoIter: fmt::Debug
 {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         f.debug_struct("FlatMap").field("inner", &self.inner).finish()
     }
 }
@@ -120,7 +120,7 @@ impl<I, U> fmt::Debug for Flatten<I>
     where I: Iterator + fmt::Debug, U: Iterator + fmt::Debug,
           I::Item: IntoIterator<IntoIter = U, Item = U::Item>,
 {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         f.debug_struct("Flatten").field("inner", &self.inner).finish()
     }
 }
@@ -328,4 +328,3 @@ impl<I, U> DoubleEndedIterator for FlattenCompat<I, U>
             .rfold(init, |acc, iter| iter.rfold(acc, &mut fold))
     }
 }
-
diff --git a/src/libcore/iter/adapters/mod.rs b/src/libcore/iter/adapters/mod.rs
index ce18b4b97ad..3ab404a48d3 100644
--- a/src/libcore/iter/adapters/mod.rs
+++ b/src/libcore/iter/adapters/mod.rs
@@ -553,7 +553,7 @@ impl<I, F> Map<I, F> {
 
 #[stable(feature = "core_impl_debug", since = "1.9.0")]
 impl<I: fmt::Debug, F> fmt::Debug for Map<I, F> {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         f.debug_struct("Map")
             .field("iter", &self.iter)
             .finish()
@@ -669,7 +669,7 @@ impl<I, P> Filter<I, P> {
 
 #[stable(feature = "core_impl_debug", since = "1.9.0")]
 impl<I: fmt::Debug, P> fmt::Debug for Filter<I, P> {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         f.debug_struct("Filter")
             .field("iter", &self.iter)
             .finish()
@@ -793,7 +793,7 @@ impl<I, F> FilterMap<I, F> {
 
 #[stable(feature = "core_impl_debug", since = "1.9.0")]
 impl<I: fmt::Debug, F> fmt::Debug for FilterMap<I, F> {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         f.debug_struct("FilterMap")
             .field("iter", &self.iter)
             .finish()
@@ -982,6 +982,16 @@ impl<I> DoubleEndedIterator for Enumerate<I> where
     }
 
     #[inline]
+    fn nth_back(&mut self, n: usize) -> Option<(usize, <I as Iterator>::Item)> {
+        self.iter.nth_back(n).map(|a| {
+            let len = self.iter.len();
+            // Can safely add, `ExactSizeIterator` promises that the number of
+            // elements fits into a `usize`.
+            (self.count + len, a)
+        })
+    }
+
+    #[inline]
     fn try_rfold<Acc, Fold, R>(&mut self, init: Acc, mut fold: Fold) -> R where
         Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try<Ok=Acc>
     {
@@ -1222,7 +1232,7 @@ impl<I, P> SkipWhile<I, P> {
 
 #[stable(feature = "core_impl_debug", since = "1.9.0")]
 impl<I: fmt::Debug, P> fmt::Debug for SkipWhile<I, P> {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         f.debug_struct("SkipWhile")
             .field("iter", &self.iter)
             .field("flag", &self.flag)
@@ -1310,7 +1320,7 @@ impl<I, P> TakeWhile<I, P> {
 
 #[stable(feature = "core_impl_debug", since = "1.9.0")]
 impl<I: fmt::Debug, P> fmt::Debug for TakeWhile<I, P> {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         f.debug_struct("TakeWhile")
             .field("iter", &self.iter)
             .field("flag", &self.flag)
@@ -1634,7 +1644,7 @@ impl<I, St, F> Scan<I, St, F> {
 
 #[stable(feature = "core_impl_debug", since = "1.9.0")]
 impl<I: fmt::Debug, St: fmt::Debug, F> fmt::Debug for Scan<I, St, F> {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         f.debug_struct("Scan")
             .field("iter", &self.iter)
             .field("state", &self.state)
@@ -1791,6 +1801,17 @@ impl<I> DoubleEndedIterator for Fuse<I> where I: DoubleEndedIterator {
     }
 
     #[inline]
+    default fn nth_back(&mut self, n: usize) -> Option<<I as Iterator>::Item> {
+        if self.done {
+            None
+        } else {
+            let nth = self.iter.nth_back(n);
+            self.done = nth.is_none();
+            nth
+        }
+    }
+
+    #[inline]
     default fn try_rfold<Acc, Fold, R>(&mut self, init: Acc, fold: Fold) -> R where
         Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try<Ok=Acc>
     {
@@ -1879,6 +1900,11 @@ impl<I> DoubleEndedIterator for Fuse<I>
     }
 
     #[inline]
+    fn nth_back(&mut self, n: usize) -> Option<<I as Iterator>::Item> {
+        self.iter.nth_back(n)
+    }
+
+    #[inline]
     fn try_rfold<Acc, Fold, R>(&mut self, init: Acc, fold: Fold) -> R where
         Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try<Ok=Acc>
     {
@@ -1928,7 +1954,7 @@ impl<I, F> Inspect<I, F> {
 
 #[stable(feature = "core_impl_debug", since = "1.9.0")]
 impl<I: fmt::Debug, F> fmt::Debug for Inspect<I, F> {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         f.debug_struct("Inspect")
             .field("iter", &self.iter)
             .finish()
diff --git a/src/libcore/iter/sources.rs b/src/libcore/iter/sources.rs
index c4f6fbf0ff2..70a3b70c180 100644
--- a/src/libcore/iter/sources.rs
+++ b/src/libcore/iter/sources.rs
@@ -200,7 +200,7 @@ pub struct Empty<T>(marker::PhantomData<T>);
 
 #[stable(feature = "core_impl_debug", since = "1.9.0")]
 impl<T> fmt::Debug for Empty<T> {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         f.pad("Empty")
     }
 }
@@ -558,7 +558,7 @@ impl<T, F> Iterator for FromFn<F>
 
 #[stable(feature = "iter_from_fn", since = "1.34.0")]
 impl<F> fmt::Debug for FromFn<F> {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         f.debug_struct("FromFn").finish()
     }
 }
@@ -631,7 +631,7 @@ impl<T, F> FusedIterator for Successors<T, F>
 
 #[stable(feature = "iter_successors", since = "1.34.0")]
 impl<T: fmt::Debug, F> fmt::Debug for Successors<T, F> {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         f.debug_struct("Successors")
             .field("next", &self.next)
             .finish()
diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs
index 0d660b002da..28db55578c3 100644
--- a/src/libcore/lib.rs
+++ b/src/libcore/lib.rs
@@ -65,7 +65,6 @@
 
 #![deny(rust_2018_idioms)]
 #![allow(explicit_outlives_requirements)]
-#![allow(elided_lifetimes_in_paths)]
 
 #![feature(allow_internal_unstable)]
 #![feature(arbitrary_self_types)]
diff --git a/src/libcore/mem.rs b/src/libcore/mem.rs
index e2bd4b4a39a..95480c6bf04 100644
--- a/src/libcore/mem.rs
+++ b/src/libcore/mem.rs
@@ -862,7 +862,7 @@ impl<T> hash::Hash for Discriminant<T> {
 
 #[stable(feature = "discriminant_value", since = "1.21.0")]
 impl<T> fmt::Debug for Discriminant<T> {
-    fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
         fmt.debug_tuple("Discriminant")
            .field(&self.0)
            .finish()
diff --git a/src/libcore/num/bignum.rs b/src/libcore/num/bignum.rs
index 64699e85d0c..342ac69748d 100644
--- a/src/libcore/num/bignum.rs
+++ b/src/libcore/num/bignum.rs
@@ -459,7 +459,7 @@ macro_rules! define_bignum {
         }
 
         impl crate::fmt::Debug for $name {
-            fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result {
+            fn fmt(&self, f: &mut crate::fmt::Formatter<'_>) -> crate::fmt::Result {
                 use crate::mem;
 
                 let sz = if self.size < 1 {1} else {self.size};
diff --git a/src/libcore/num/dec2flt/mod.rs b/src/libcore/num/dec2flt/mod.rs
index dcfa2d352a8..4536bbc94ad 100644
--- a/src/libcore/num/dec2flt/mod.rs
+++ b/src/libcore/num/dec2flt/mod.rs
@@ -196,7 +196,7 @@ impl ParseFloatError {
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl fmt::Display for ParseFloatError {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         self.__description().fmt(f)
     }
 }
@@ -244,7 +244,7 @@ fn dec2flt<T: RawFloat>(s: &str) -> Result<T, ParseFloatError> {
 
 /// The main workhorse for the decimal-to-float conversion: Orchestrate all the preprocessing
 /// and figure out which algorithm should do the actual conversion.
-fn convert<T: RawFloat>(mut decimal: Decimal) -> Result<T, ParseFloatError> {
+fn convert<T: RawFloat>(mut decimal: Decimal<'_>) -> Result<T, ParseFloatError> {
     simplify(&mut decimal);
     if let Some(x) = trivial_cases(&decimal) {
         return Ok(x);
@@ -281,7 +281,7 @@ fn convert<T: RawFloat>(mut decimal: Decimal) -> Result<T, ParseFloatError> {
 
 /// Strip zeros where possible, even when this requires changing the exponent
 #[inline(always)]
-fn simplify(decimal: &mut Decimal) {
+fn simplify(decimal: &mut Decimal<'_>) {
     let is_zero = &|&&d: &&u8| -> bool { d == b'0' };
     // Trimming these zeros does not change anything but may enable the fast path (< 15 digits).
     let leading_zeros = decimal.integral.iter().take_while(is_zero).count();
@@ -306,7 +306,7 @@ fn simplify(decimal: &mut Decimal) {
 
 /// Returns a quick-an-dirty upper bound on the size (log10) of the largest value that Algorithm R
 /// and Algorithm M will compute while working on the given decimal.
-fn bound_intermediate_digits(decimal: &Decimal, e: i64) -> u64 {
+fn bound_intermediate_digits(decimal: &Decimal<'_>, e: i64) -> u64 {
     // We don't need to worry too much about overflow here thanks to trivial_cases() and the
     // parser, which filter out the most extreme inputs for us.
     let f_len: u64 = decimal.integral.len() as u64 + decimal.fractional.len() as u64;
@@ -325,7 +325,7 @@ fn bound_intermediate_digits(decimal: &Decimal, e: i64) -> u64 {
 }
 
 /// Detects obvious overflows and underflows without even looking at the decimal digits.
-fn trivial_cases<T: RawFloat>(decimal: &Decimal) -> Option<T> {
+fn trivial_cases<T: RawFloat>(decimal: &Decimal<'_>) -> Option<T> {
     // There were zeros but they were stripped by simplify()
     if decimal.integral.is_empty() && decimal.fractional.is_empty() {
         return Some(T::ZERO);
diff --git a/src/libcore/num/dec2flt/parse.rs b/src/libcore/num/dec2flt/parse.rs
index f970595452e..cf3664a8748 100644
--- a/src/libcore/num/dec2flt/parse.rs
+++ b/src/libcore/num/dec2flt/parse.rs
@@ -44,7 +44,7 @@ pub enum ParseResult<'a> {
 
 /// Checks if the input string is a valid floating point number and if so, locate the integral
 /// part, the fractional part, and the exponent in it. Does not handle signs.
-pub fn parse_decimal(s: &str) -> ParseResult {
+pub fn parse_decimal(s: &str) -> ParseResult<'_> {
     if s.is_empty() {
         return Invalid;
     }
diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs
index 24afc945e93..c8a4ff7ca61 100644
--- a/src/libcore/num/mod.rs
+++ b/src/libcore/num/mod.rs
@@ -15,7 +15,7 @@ macro_rules! impl_nonzero_fmt {
             #[$stability]
             impl fmt::$Trait for $Ty {
                 #[inline]
-                fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+                fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
                     self.get().fmt(f)
                 }
             }
@@ -164,42 +164,42 @@ pub struct Wrapping<T>(#[stable(feature = "rust1", since = "1.0.0")]
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<T: fmt::Debug> fmt::Debug for Wrapping<T> {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         self.0.fmt(f)
     }
 }
 
 #[stable(feature = "wrapping_display", since = "1.10.0")]
 impl<T: fmt::Display> fmt::Display for Wrapping<T> {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         self.0.fmt(f)
     }
 }
 
 #[stable(feature = "wrapping_fmt", since = "1.11.0")]
 impl<T: fmt::Binary> fmt::Binary for Wrapping<T> {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         self.0.fmt(f)
     }
 }
 
 #[stable(feature = "wrapping_fmt", since = "1.11.0")]
 impl<T: fmt::Octal> fmt::Octal for Wrapping<T> {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         self.0.fmt(f)
     }
 }
 
 #[stable(feature = "wrapping_fmt", since = "1.11.0")]
 impl<T: fmt::LowerHex> fmt::LowerHex for Wrapping<T> {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         self.0.fmt(f)
     }
 }
 
 #[stable(feature = "wrapping_fmt", since = "1.11.0")]
 impl<T: fmt::UpperHex> fmt::UpperHex for Wrapping<T> {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         self.0.fmt(f)
     }
 }
@@ -4423,7 +4423,7 @@ impl TryFromIntError {
 
 #[stable(feature = "try_from", since = "1.34.0")]
 impl fmt::Display for TryFromIntError {
-    fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
         self.__description().fmt(fmt)
     }
 }
@@ -4820,7 +4820,7 @@ impl ParseIntError {
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl fmt::Display for ParseIntError {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         self.__description().fmt(f)
     }
 }
diff --git a/src/libcore/ops/range.rs b/src/libcore/ops/range.rs
index e13df04c2ce..a707f0cc062 100644
--- a/src/libcore/ops/range.rs
+++ b/src/libcore/ops/range.rs
@@ -45,7 +45,7 @@ pub struct RangeFull;
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl fmt::Debug for RangeFull {
-    fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
         write!(fmt, "..")
     }
 }
@@ -84,7 +84,7 @@ pub struct Range<Idx> {
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<Idx: fmt::Debug> fmt::Debug for Range<Idx> {
-    fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
         self.start.fmt(fmt)?;
         write!(fmt, "..")?;
         self.end.fmt(fmt)?;
@@ -186,7 +186,7 @@ pub struct RangeFrom<Idx> {
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<Idx: fmt::Debug> fmt::Debug for RangeFrom<Idx> {
-    fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
         self.start.fmt(fmt)?;
         write!(fmt, "..")?;
         Ok(())
@@ -270,7 +270,7 @@ pub struct RangeTo<Idx> {
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<Idx: fmt::Debug> fmt::Debug for RangeTo<Idx> {
-    fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
         write!(fmt, "..")?;
         self.end.fmt(fmt)?;
         Ok(())
@@ -473,7 +473,7 @@ impl<Idx> RangeInclusive<Idx> {
 
 #[stable(feature = "inclusive_range", since = "1.26.0")]
 impl<Idx: fmt::Debug> fmt::Debug for RangeInclusive<Idx> {
-    fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
         self.start.fmt(fmt)?;
         write!(fmt, "..=")?;
         self.end.fmt(fmt)?;
@@ -611,7 +611,7 @@ pub struct RangeToInclusive<Idx> {
 
 #[stable(feature = "inclusive_range", since = "1.26.0")]
 impl<Idx: fmt::Debug> fmt::Debug for RangeToInclusive<Idx> {
-    fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
         write!(fmt, "..=")?;
         self.end.fmt(fmt)?;
         Ok(())
diff --git a/src/libcore/option.rs b/src/libcore/option.rs
index 7ce9a73a782..9599491462e 100644
--- a/src/libcore/option.rs
+++ b/src/libcore/option.rs
@@ -538,7 +538,7 @@ impl<T> Option<T> {
     /// ```
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn iter(&self) -> Iter<T> {
+    pub fn iter(&self) -> Iter<'_, T> {
         Iter { inner: Item { opt: self.as_ref() } }
     }
 
@@ -559,7 +559,7 @@ impl<T> Option<T> {
     /// ```
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn iter_mut(&mut self) -> IterMut<T> {
+    pub fn iter_mut(&mut self) -> IterMut<'_, T> {
         IterMut { inner: Item { opt: self.as_mut() } }
     }
 
diff --git a/src/libcore/panic.rs b/src/libcore/panic.rs
index bcb87bdd098..989fc96732a 100644
--- a/src/libcore/panic.rs
+++ b/src/libcore/panic.rs
@@ -86,7 +86,7 @@ impl<'a> PanicInfo<'a> {
     ///
     /// [`fmt::write`]: ../fmt/fn.write.html
     #[unstable(feature = "panic_info_message", issue = "44489")]
-    pub fn message(&self) -> Option<&fmt::Arguments> {
+    pub fn message(&self) -> Option<&fmt::Arguments<'_>> {
         self.message
     }
 
@@ -115,7 +115,7 @@ impl<'a> PanicInfo<'a> {
     /// panic!("Normal panic");
     /// ```
     #[stable(feature = "panic_hooks", since = "1.10.0")]
-    pub fn location(&self) -> Option<&Location> {
+    pub fn location(&self) -> Option<&Location<'_>> {
         // NOTE: If this is changed to sometimes return None,
         // deal with that case in std::panicking::default_hook and std::panicking::begin_panic_fmt.
         Some(&self.location)
@@ -124,7 +124,7 @@ impl<'a> PanicInfo<'a> {
 
 #[stable(feature = "panic_hook_display", since = "1.26.0")]
 impl fmt::Display for PanicInfo<'_> {
-    fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
         formatter.write_str("panicked at ")?;
         if let Some(message) = self.message {
             write!(formatter, "'{}', ", message)?
@@ -249,7 +249,7 @@ impl<'a> Location<'a> {
 
 #[stable(feature = "panic_hook_display", since = "1.26.0")]
 impl fmt::Display for Location<'_> {
-    fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
         write!(formatter, "{}:{}:{}", self.file, self.line, self.col)
     }
 }
diff --git a/src/libcore/panicking.rs b/src/libcore/panicking.rs
index 4b991b87925..15b7d69c58d 100644
--- a/src/libcore/panicking.rs
+++ b/src/libcore/panicking.rs
@@ -65,7 +65,7 @@ fn panic_bounds_check(file_line_col: &(&'static str, u32, u32),
 #[cold]
 #[cfg_attr(not(feature="panic_immediate_abort"),inline(never))]
 #[cfg_attr(    feature="panic_immediate_abort" ,inline)]
-pub fn panic_fmt(fmt: fmt::Arguments, file_line_col: &(&'static str, u32, u32)) -> ! {
+pub fn panic_fmt(fmt: fmt::Arguments<'_>, file_line_col: &(&'static str, u32, u32)) -> ! {
     if cfg!(feature = "panic_immediate_abort") {
         unsafe { super::intrinsics::abort() }
     }
@@ -74,7 +74,7 @@ pub fn panic_fmt(fmt: fmt::Arguments, file_line_col: &(&'static str, u32, u32))
     #[allow(improper_ctypes)] // PanicInfo contains a trait object which is not FFI safe
     extern "Rust" {
         #[lang = "panic_impl"]
-        fn panic_impl(pi: &PanicInfo) -> !;
+        fn panic_impl(pi: &PanicInfo<'_>) -> !;
     }
 
     let (file, line, col) = *file_line_col;
diff --git a/src/libcore/pin.rs b/src/libcore/pin.rs
index 538e1aa481c..dbf3dcf03a3 100644
--- a/src/libcore/pin.rs
+++ b/src/libcore/pin.rs
@@ -602,21 +602,21 @@ impl<P: Receiver> Receiver for Pin<P> {}
 
 #[stable(feature = "pin", since = "1.33.0")]
 impl<P: fmt::Debug> fmt::Debug for Pin<P> {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         fmt::Debug::fmt(&self.pointer, f)
     }
 }
 
 #[stable(feature = "pin", since = "1.33.0")]
 impl<P: fmt::Display> fmt::Display for Pin<P> {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         fmt::Display::fmt(&self.pointer, f)
     }
 }
 
 #[stable(feature = "pin", since = "1.33.0")]
 impl<P: fmt::Pointer> fmt::Pointer for Pin<P> {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         fmt::Pointer::fmt(&self.pointer, f)
     }
 }
diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs
index 32dcb5bff36..f05700a1db2 100644
--- a/src/libcore/ptr.rs
+++ b/src/libcore/ptr.rs
@@ -2623,14 +2623,14 @@ macro_rules! fnptr_impls_safety_abi {
 
         #[stable(feature = "fnptr_impls", since = "1.4.0")]
         impl<Ret, $($Arg),*> fmt::Pointer for $FnTy {
-            fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+            fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
                 fmt::Pointer::fmt(&(*self as *const ()), f)
             }
         }
 
         #[stable(feature = "fnptr_impls", since = "1.4.0")]
         impl<Ret, $($Arg),*> fmt::Debug for $FnTy {
-            fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+            fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
                 fmt::Pointer::fmt(&(*self as *const ()), f)
             }
         }
@@ -2776,7 +2776,7 @@ pub struct Unique<T: ?Sized> {
 
 #[unstable(feature = "ptr_internals", issue = "0")]
 impl<T: ?Sized> fmt::Debug for Unique<T> {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         fmt::Pointer::fmt(&self.as_ptr(), f)
     }
 }
@@ -2876,7 +2876,7 @@ impl<T: ?Sized, U: ?Sized> DispatchFromDyn<Unique<U>> for Unique<T> where T: Uns
 
 #[unstable(feature = "ptr_internals", issue = "0")]
 impl<T: ?Sized> fmt::Pointer for Unique<T> {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         fmt::Pointer::fmt(&self.as_ptr(), f)
     }
 }
@@ -3049,14 +3049,14 @@ impl<T: ?Sized, U: ?Sized> DispatchFromDyn<NonNull<U>> for NonNull<T> where T: U
 
 #[stable(feature = "nonnull", since = "1.25.0")]
 impl<T: ?Sized> fmt::Debug for NonNull<T> {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         fmt::Pointer::fmt(&self.as_ptr(), f)
     }
 }
 
 #[stable(feature = "nonnull", since = "1.25.0")]
 impl<T: ?Sized> fmt::Pointer for NonNull<T> {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         fmt::Pointer::fmt(&self.as_ptr(), f)
     }
 }
diff --git a/src/libcore/result.rs b/src/libcore/result.rs
index 0277e52a9a6..bf8fd63b644 100644
--- a/src/libcore/result.rs
+++ b/src/libcore/result.rs
@@ -544,7 +544,7 @@ impl<T, E> Result<T, E> {
     /// ```
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn iter(&self) -> Iter<T> {
+    pub fn iter(&self) -> Iter<'_, T> {
         Iter { inner: self.as_ref().ok() }
     }
 
@@ -569,7 +569,7 @@ impl<T, E> Result<T, E> {
     /// ```
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn iter_mut(&mut self) -> IterMut<T> {
+    pub fn iter_mut(&mut self) -> IterMut<'_, T> {
         IterMut { inner: self.as_mut().ok() }
     }
 
diff --git a/src/libcore/slice/mod.rs b/src/libcore/slice/mod.rs
index 44d56c60b78..bf3dda48dc7 100644
--- a/src/libcore/slice/mod.rs
+++ b/src/libcore/slice/mod.rs
@@ -524,7 +524,7 @@ impl<T> [T] {
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
-    pub fn iter(&self) -> Iter<T> {
+    pub fn iter(&self) -> Iter<'_, T> {
         unsafe {
             let ptr = self.as_ptr();
             assume(!ptr.is_null());
@@ -556,7 +556,7 @@ impl<T> [T] {
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
-    pub fn iter_mut(&mut self) -> IterMut<T> {
+    pub fn iter_mut(&mut self) -> IterMut<'_, T> {
         unsafe {
             let ptr = self.as_mut_ptr();
             assume(!ptr.is_null());
@@ -603,7 +603,7 @@ impl<T> [T] {
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
-    pub fn windows(&self, size: usize) -> Windows<T> {
+    pub fn windows(&self, size: usize) -> Windows<'_, T> {
         assert!(size != 0);
         Windows { v: self, size }
     }
@@ -637,7 +637,7 @@ impl<T> [T] {
     /// [`rchunks`]: #method.rchunks
     #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
-    pub fn chunks(&self, chunk_size: usize) -> Chunks<T> {
+    pub fn chunks(&self, chunk_size: usize) -> Chunks<'_, T> {
         assert!(chunk_size != 0);
         Chunks { v: self, chunk_size }
     }
@@ -675,7 +675,7 @@ impl<T> [T] {
     /// [`rchunks_mut`]: #method.rchunks_mut
     #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
-    pub fn chunks_mut(&mut self, chunk_size: usize) -> ChunksMut<T> {
+    pub fn chunks_mut(&mut self, chunk_size: usize) -> ChunksMut<'_, T> {
         assert!(chunk_size != 0);
         ChunksMut { v: self, chunk_size }
     }
@@ -712,7 +712,7 @@ impl<T> [T] {
     /// [`rchunks_exact`]: #method.rchunks_exact
     #[stable(feature = "chunks_exact", since = "1.31.0")]
     #[inline]
-    pub fn chunks_exact(&self, chunk_size: usize) -> ChunksExact<T> {
+    pub fn chunks_exact(&self, chunk_size: usize) -> ChunksExact<'_, T> {
         assert!(chunk_size != 0);
         let rem = self.len() % chunk_size;
         let len = self.len() - rem;
@@ -757,7 +757,7 @@ impl<T> [T] {
     /// [`rchunks_exact_mut`]: #method.rchunks_exact_mut
     #[stable(feature = "chunks_exact", since = "1.31.0")]
     #[inline]
-    pub fn chunks_exact_mut(&mut self, chunk_size: usize) -> ChunksExactMut<T> {
+    pub fn chunks_exact_mut(&mut self, chunk_size: usize) -> ChunksExactMut<'_, T> {
         assert!(chunk_size != 0);
         let rem = self.len() % chunk_size;
         let len = self.len() - rem;
@@ -794,7 +794,7 @@ impl<T> [T] {
     /// [`chunks`]: #method.chunks
     #[stable(feature = "rchunks", since = "1.31.0")]
     #[inline]
-    pub fn rchunks(&self, chunk_size: usize) -> RChunks<T> {
+    pub fn rchunks(&self, chunk_size: usize) -> RChunks<'_, T> {
         assert!(chunk_size != 0);
         RChunks { v: self, chunk_size }
     }
@@ -832,13 +832,13 @@ impl<T> [T] {
     /// [`chunks_mut`]: #method.chunks_mut
     #[stable(feature = "rchunks", since = "1.31.0")]
     #[inline]
-    pub fn rchunks_mut(&mut self, chunk_size: usize) -> RChunksMut<T> {
+    pub fn rchunks_mut(&mut self, chunk_size: usize) -> RChunksMut<'_, T> {
         assert!(chunk_size != 0);
         RChunksMut { v: self, chunk_size }
     }
 
     /// Returns an iterator over `chunk_size` elements of the slice at a time, starting at the
-    /// beginning of the slice.
+    /// end of the slice.
     ///
     /// The chunks are slices and do not overlap. If `chunk_size` does not divide the length of the
     /// slice, then the last up to `chunk_size-1` elements will be omitted and can be retrieved
@@ -849,7 +849,7 @@ impl<T> [T] {
     ///
     /// See [`rchunks`] for a variant of this iterator that also returns the remainder as a smaller
     /// chunk, and [`chunks_exact`] for the same iterator but starting at the beginning of the
-    /// slice of the slice.
+    /// slice.
     ///
     /// # Panics
     ///
@@ -871,7 +871,7 @@ impl<T> [T] {
     /// [`chunks_exact`]: #method.chunks_exact
     #[stable(feature = "rchunks", since = "1.31.0")]
     #[inline]
-    pub fn rchunks_exact(&self, chunk_size: usize) -> RChunksExact<T> {
+    pub fn rchunks_exact(&self, chunk_size: usize) -> RChunksExact<'_, T> {
         assert!(chunk_size != 0);
         let rem = self.len() % chunk_size;
         let (fst, snd) = self.split_at(rem);
@@ -890,7 +890,7 @@ impl<T> [T] {
     ///
     /// See [`rchunks_mut`] for a variant of this iterator that also returns the remainder as a
     /// smaller chunk, and [`chunks_exact_mut`] for the same iterator but starting at the beginning
-    /// of the slice of the slice.
+    /// of the slice.
     ///
     /// # Panics
     ///
@@ -916,7 +916,7 @@ impl<T> [T] {
     /// [`chunks_exact_mut`]: #method.chunks_exact_mut
     #[stable(feature = "rchunks", since = "1.31.0")]
     #[inline]
-    pub fn rchunks_exact_mut(&mut self, chunk_size: usize) -> RChunksExactMut<T> {
+    pub fn rchunks_exact_mut(&mut self, chunk_size: usize) -> RChunksExactMut<'_, T> {
         assert!(chunk_size != 0);
         let rem = self.len() % chunk_size;
         let (fst, snd) = self.split_at_mut(rem);
@@ -1042,7 +1042,7 @@ impl<T> [T] {
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
-    pub fn split<F>(&self, pred: F) -> Split<T, F>
+    pub fn split<F>(&self, pred: F) -> Split<'_, T, F>
         where F: FnMut(&T) -> bool
     {
         Split {
@@ -1067,7 +1067,7 @@ impl<T> [T] {
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
-    pub fn split_mut<F>(&mut self, pred: F) -> SplitMut<T, F>
+    pub fn split_mut<F>(&mut self, pred: F) -> SplitMut<'_, T, F>
         where F: FnMut(&T) -> bool
     {
         SplitMut { v: self, pred, finished: false }
@@ -1102,7 +1102,7 @@ impl<T> [T] {
     /// ```
     #[stable(feature = "slice_rsplit", since = "1.27.0")]
     #[inline]
-    pub fn rsplit<F>(&self, pred: F) -> RSplit<T, F>
+    pub fn rsplit<F>(&self, pred: F) -> RSplit<'_, T, F>
         where F: FnMut(&T) -> bool
     {
         RSplit { inner: self.split(pred) }
@@ -1127,7 +1127,7 @@ impl<T> [T] {
     ///
     #[stable(feature = "slice_rsplit", since = "1.27.0")]
     #[inline]
-    pub fn rsplit_mut<F>(&mut self, pred: F) -> RSplitMut<T, F>
+    pub fn rsplit_mut<F>(&mut self, pred: F) -> RSplitMut<'_, T, F>
         where F: FnMut(&T) -> bool
     {
         RSplitMut { inner: self.split_mut(pred) }
@@ -1154,7 +1154,7 @@ impl<T> [T] {
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
-    pub fn splitn<F>(&self, n: usize, pred: F) -> SplitN<T, F>
+    pub fn splitn<F>(&self, n: usize, pred: F) -> SplitN<'_, T, F>
         where F: FnMut(&T) -> bool
     {
         SplitN {
@@ -1184,7 +1184,7 @@ impl<T> [T] {
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
-    pub fn splitn_mut<F>(&mut self, n: usize, pred: F) -> SplitNMut<T, F>
+    pub fn splitn_mut<F>(&mut self, n: usize, pred: F) -> SplitNMut<'_, T, F>
         where F: FnMut(&T) -> bool
     {
         SplitNMut {
@@ -1217,7 +1217,7 @@ impl<T> [T] {
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
-    pub fn rsplitn<F>(&self, n: usize, pred: F) -> RSplitN<T, F>
+    pub fn rsplitn<F>(&self, n: usize, pred: F) -> RSplitN<'_, T, F>
         where F: FnMut(&T) -> bool
     {
         RSplitN {
@@ -1248,7 +1248,7 @@ impl<T> [T] {
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
-    pub fn rsplitn_mut<F>(&mut self, n: usize, pred: F) -> RSplitNMut<T, F>
+    pub fn rsplitn_mut<F>(&mut self, n: usize, pred: F) -> RSplitNMut<'_, T, F>
         where F: FnMut(&T) -> bool
     {
         RSplitNMut {
@@ -3284,7 +3284,7 @@ pub struct Iter<'a, T: 'a> {
 
 #[stable(feature = "core_impl_debug", since = "1.9.0")]
 impl<T: fmt::Debug> fmt::Debug for Iter<'_, T> {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         f.debug_tuple("Iter")
             .field(&self.as_slice())
             .finish()
@@ -3386,7 +3386,7 @@ pub struct IterMut<'a, T: 'a> {
 
 #[stable(feature = "core_impl_debug", since = "1.9.0")]
 impl<T: fmt::Debug> fmt::Debug for IterMut<'_, T> {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         f.debug_tuple("IterMut")
             .field(&self.make_slice())
             .finish()
@@ -3493,7 +3493,7 @@ pub struct Split<'a, T:'a, P> where P: FnMut(&T) -> bool {
 
 #[stable(feature = "core_impl_debug", since = "1.9.0")]
 impl<T: fmt::Debug, P> fmt::Debug for Split<'_, T, P> where P: FnMut(&T) -> bool {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         f.debug_struct("Split")
             .field("v", &self.v)
             .field("finished", &self.finished)
@@ -3584,7 +3584,7 @@ pub struct SplitMut<'a, T:'a, P> where P: FnMut(&T) -> bool {
 
 #[stable(feature = "core_impl_debug", since = "1.9.0")]
 impl<T: fmt::Debug, P> fmt::Debug for SplitMut<'_, T, P> where P: FnMut(&T) -> bool {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         f.debug_struct("SplitMut")
             .field("v", &self.v)
             .field("finished", &self.finished)
@@ -3681,7 +3681,7 @@ pub struct RSplit<'a, T:'a, P> where P: FnMut(&T) -> bool {
 
 #[stable(feature = "slice_rsplit", since = "1.27.0")]
 impl<T: fmt::Debug, P> fmt::Debug for RSplit<'_, T, P> where P: FnMut(&T) -> bool {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         f.debug_struct("RSplit")
             .field("v", &self.inner.v)
             .field("finished", &self.inner.finished)
@@ -3737,7 +3737,7 @@ pub struct RSplitMut<'a, T:'a, P> where P: FnMut(&T) -> bool {
 
 #[stable(feature = "slice_rsplit", since = "1.27.0")]
 impl<T: fmt::Debug, P> fmt::Debug for RSplitMut<'_, T, P> where P: FnMut(&T) -> bool {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         f.debug_struct("RSplitMut")
             .field("v", &self.inner.v)
             .field("finished", &self.inner.finished)
@@ -3823,7 +3823,7 @@ pub struct SplitN<'a, T: 'a, P> where P: FnMut(&T) -> bool {
 
 #[stable(feature = "core_impl_debug", since = "1.9.0")]
 impl<T: fmt::Debug, P> fmt::Debug for SplitN<'_, T, P> where P: FnMut(&T) -> bool {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         f.debug_struct("SplitN")
             .field("inner", &self.inner)
             .finish()
@@ -3845,7 +3845,7 @@ pub struct RSplitN<'a, T: 'a, P> where P: FnMut(&T) -> bool {
 
 #[stable(feature = "core_impl_debug", since = "1.9.0")]
 impl<T: fmt::Debug, P> fmt::Debug for RSplitN<'_, T, P> where P: FnMut(&T) -> bool {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         f.debug_struct("RSplitN")
             .field("inner", &self.inner)
             .finish()
@@ -3866,7 +3866,7 @@ pub struct SplitNMut<'a, T: 'a, P> where P: FnMut(&T) -> bool {
 
 #[stable(feature = "core_impl_debug", since = "1.9.0")]
 impl<T: fmt::Debug, P> fmt::Debug for SplitNMut<'_, T, P> where P: FnMut(&T) -> bool {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         f.debug_struct("SplitNMut")
             .field("inner", &self.inner)
             .finish()
@@ -3888,7 +3888,7 @@ pub struct RSplitNMut<'a, T: 'a, P> where P: FnMut(&T) -> bool {
 
 #[stable(feature = "core_impl_debug", since = "1.9.0")]
 impl<T: fmt::Debug, P> fmt::Debug for RSplitNMut<'_, T, P> where P: FnMut(&T) -> bool {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         f.debug_struct("RSplitNMut")
             .field("inner", &self.inner)
             .finish()
diff --git a/src/libcore/str/lossy.rs b/src/libcore/str/lossy.rs
index 16dd4fe6135..b291579553a 100644
--- a/src/libcore/str/lossy.rs
+++ b/src/libcore/str/lossy.rs
@@ -18,7 +18,7 @@ impl Utf8Lossy {
         unsafe { mem::transmute(bytes) }
     }
 
-    pub fn chunks(&self) -> Utf8LossyChunksIter {
+    pub fn chunks(&self) -> Utf8LossyChunksIter<'_> {
         Utf8LossyChunksIter { source: &self.bytes }
     }
 }
@@ -138,7 +138,7 @@ impl<'a> Iterator for Utf8LossyChunksIter<'a> {
 
 
 impl fmt::Display for Utf8Lossy {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         // If we're the empty string then our iterator won't actually yield
         // anything, so perform the formatting manually
         if self.bytes.len() == 0 {
@@ -164,7 +164,7 @@ impl fmt::Display for Utf8Lossy {
 }
 
 impl fmt::Debug for Utf8Lossy {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         f.write_char('"')?;
 
         for Utf8LossyChunk { valid, broken } in self.chunks() {
diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs
index f4bb887dd29..379c263c04c 100644
--- a/src/libcore/str/mod.rs
+++ b/src/libcore/str/mod.rs
@@ -146,7 +146,7 @@ pub struct ParseBoolError { _priv: () }
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl fmt::Display for ParseBoolError {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         "provided string was not `true` or `false`".fmt(f)
     }
 }
@@ -439,7 +439,7 @@ pub unsafe fn from_utf8_unchecked_mut(v: &mut [u8]) -> &mut str {
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl fmt::Display for Utf8Error {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         if let Some(error_len) = self.error_len {
             write!(f, "invalid utf-8 sequence of {} bytes from index {}",
                    error_len, self.valid_up_to)
@@ -796,6 +796,11 @@ impl DoubleEndedIterator for Bytes<'_> {
     }
 
     #[inline]
+    fn nth_back(&mut self, n: usize) -> Option<Self::Item> {
+        self.0.nth_back(n)
+    }
+
+    #[inline]
     fn rfind<P>(&mut self, predicate: P) -> Option<Self::Item> where
         P: FnMut(&Self::Item) -> bool
     {
@@ -914,7 +919,7 @@ macro_rules! generate_pattern_iterators {
         impl<'a, P: Pattern<'a>> fmt::Debug for $forward_iterator<'a, P>
             where P::Searcher: fmt::Debug
         {
-            fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+            fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
                 f.debug_tuple(stringify!($forward_iterator))
                     .field(&self.0)
                     .finish()
@@ -948,7 +953,7 @@ macro_rules! generate_pattern_iterators {
         impl<'a, P: Pattern<'a>> fmt::Debug for $reverse_iterator<'a, P>
             where P::Searcher: fmt::Debug
         {
-            fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+            fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
                 f.debug_tuple(stringify!($reverse_iterator))
                     .field(&self.0)
                     .finish()
@@ -1033,7 +1038,7 @@ struct SplitInternal<'a, P: Pattern<'a>> {
 }
 
 impl<'a, P: Pattern<'a>> fmt::Debug for SplitInternal<'a, P> where P::Searcher: fmt::Debug {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         f.debug_struct("SplitInternal")
             .field("start", &self.start)
             .field("end", &self.end)
@@ -1150,7 +1155,7 @@ struct SplitNInternal<'a, P: Pattern<'a>> {
 }
 
 impl<'a, P: Pattern<'a>> fmt::Debug for SplitNInternal<'a, P> where P::Searcher: fmt::Debug {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         f.debug_struct("SplitNInternal")
             .field("iter", &self.iter)
             .field("count", &self.count)
@@ -1206,7 +1211,7 @@ derive_pattern_clone!{
 struct MatchIndicesInternal<'a, P: Pattern<'a>>(P::Searcher);
 
 impl<'a, P: Pattern<'a>> fmt::Debug for MatchIndicesInternal<'a, P> where P::Searcher: fmt::Debug {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         f.debug_tuple("MatchIndicesInternal")
             .field(&self.0)
             .finish()
@@ -1257,7 +1262,7 @@ derive_pattern_clone!{
 struct MatchesInternal<'a, P: Pattern<'a>>(P::Searcher);
 
 impl<'a, P: Pattern<'a>> fmt::Debug for MatchesInternal<'a, P> where P::Searcher: fmt::Debug {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         f.debug_tuple("MatchesInternal")
             .field(&self.0)
             .finish()
@@ -2559,7 +2564,7 @@ impl str {
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
-    pub fn chars(&self) -> Chars {
+    pub fn chars(&self) -> Chars<'_> {
         Chars{iter: self.as_bytes().iter()}
     }
 
@@ -2614,7 +2619,7 @@ impl str {
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
-    pub fn char_indices(&self) -> CharIndices {
+    pub fn char_indices(&self) -> CharIndices<'_> {
         CharIndices { front_offset: 0, iter: self.chars() }
     }
 
@@ -2639,7 +2644,7 @@ impl str {
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
-    pub fn bytes(&self) -> Bytes {
+    pub fn bytes(&self) -> Bytes<'_> {
         Bytes(self.as_bytes().iter().cloned())
     }
 
@@ -2682,7 +2687,7 @@ impl str {
     /// ```
     #[stable(feature = "split_whitespace", since = "1.1.0")]
     #[inline]
-    pub fn split_whitespace(&self) -> SplitWhitespace {
+    pub fn split_whitespace(&self) -> SplitWhitespace<'_> {
         SplitWhitespace { inner: self.split(IsWhitespace).filter(IsNotEmpty) }
     }
 
@@ -2723,7 +2728,7 @@ impl str {
     /// ```
     #[stable(feature = "split_ascii_whitespace", since = "1.34.0")]
     #[inline]
-    pub fn split_ascii_whitespace(&self) -> SplitAsciiWhitespace {
+    pub fn split_ascii_whitespace(&self) -> SplitAsciiWhitespace<'_> {
         let inner = self
             .as_bytes()
             .split(IsAsciiWhitespace)
@@ -2770,7 +2775,7 @@ impl str {
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
-    pub fn lines(&self) -> Lines {
+    pub fn lines(&self) -> Lines<'_> {
         Lines(self.split_terminator('\n').map(LinesAnyMap))
     }
 
@@ -2779,7 +2784,7 @@ impl str {
     #[rustc_deprecated(since = "1.4.0", reason = "use lines() instead now")]
     #[inline]
     #[allow(deprecated)]
-    pub fn lines_any(&self) -> LinesAny {
+    pub fn lines_any(&self) -> LinesAny<'_> {
         LinesAny(self.lines())
     }
 
@@ -2798,7 +2803,7 @@ impl str {
     /// assert!(utf16_len <= utf8_len);
     /// ```
     #[stable(feature = "encode_utf16", since = "1.8.0")]
-    pub fn encode_utf16(&self) -> EncodeUtf16 {
+    pub fn encode_utf16(&self) -> EncodeUtf16<'_> {
         EncodeUtf16 { chars: self.chars(), extra: 0 }
     }
 
@@ -4018,7 +4023,7 @@ impl str {
     /// assert_eq!("❤\n!".escape_debug().to_string(), "❤\\n!");
     /// ```
     #[stable(feature = "str_escape", since = "1.34.0")]
-    pub fn escape_debug(&self) -> EscapeDebug {
+    pub fn escape_debug(&self) -> EscapeDebug<'_> {
         let mut chars = self.chars();
         EscapeDebug {
             inner: chars.next()
@@ -4063,7 +4068,7 @@ impl str {
     /// assert_eq!("❤\n!".escape_default().to_string(), "\\u{2764}\\n!");
     /// ```
     #[stable(feature = "str_escape", since = "1.34.0")]
-    pub fn escape_default(&self) -> EscapeDefault {
+    pub fn escape_default(&self) -> EscapeDefault<'_> {
         EscapeDefault { inner: self.chars().flat_map(CharEscapeDefault) }
     }
 
@@ -4101,7 +4106,7 @@ impl str {
     /// assert_eq!("❤\n!".escape_unicode().to_string(), "\\u{2764}\\u{a}\\u{21}");
     /// ```
     #[stable(feature = "str_escape", since = "1.34.0")]
-    pub fn escape_unicode(&self) -> EscapeUnicode {
+    pub fn escape_unicode(&self) -> EscapeUnicode<'_> {
         EscapeUnicode { inner: self.chars().flat_map(CharEscapeUnicode) }
     }
 }
@@ -4267,7 +4272,7 @@ pub struct EncodeUtf16<'a> {
 
 #[stable(feature = "collection_debug", since = "1.17.0")]
 impl fmt::Debug for EncodeUtf16<'_> {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         f.pad("EncodeUtf16 { .. }")
     }
 }
@@ -4341,7 +4346,7 @@ macro_rules! escape_types_impls {
     ($( $Name: ident ),+) => {$(
         #[stable(feature = "str_escape", since = "1.34.0")]
         impl<'a> fmt::Display for $Name<'a> {
-            fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+            fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
                 self.clone().try_for_each(|c| f.write_char(c))
             }
         }
diff --git a/src/libcore/str/pattern.rs b/src/libcore/str/pattern.rs
index 5dd4aec5e5a..ad9d956fda1 100644
--- a/src/libcore/str/pattern.rs
+++ b/src/libcore/str/pattern.rs
@@ -658,7 +658,7 @@ pub struct CharPredicateSearcher<'a, F>(<MultiCharEqPattern<F> as Pattern<'a>>::
 impl<F> fmt::Debug for CharPredicateSearcher<'_, F>
     where F: FnMut(char) -> bool
 {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         f.debug_struct("CharPredicateSearcher")
             .field("haystack", &self.0.haystack)
             .field("char_indices", &self.0.char_indices)
diff --git a/src/libcore/sync/atomic.rs b/src/libcore/sync/atomic.rs
index 7ae91b30498..12414980d76 100644
--- a/src/libcore/sync/atomic.rs
+++ b/src/libcore/sync/atomic.rs
@@ -1193,7 +1193,7 @@ macro_rules! atomic_int {
 
         #[$stable_debug]
         impl fmt::Debug for $atomic_type {
-            fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+            fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
                 fmt::Debug::fmt(&self.load(Ordering::SeqCst), f)
             }
         }
@@ -2506,7 +2506,7 @@ pub fn compiler_fence(order: Ordering) {
 #[cfg(target_has_atomic = "8")]
 #[stable(feature = "atomic_debug", since = "1.3.0")]
 impl fmt::Debug for AtomicBool {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         fmt::Debug::fmt(&self.load(Ordering::SeqCst), f)
     }
 }
@@ -2514,7 +2514,7 @@ impl fmt::Debug for AtomicBool {
 #[cfg(target_has_atomic = "ptr")]
 #[stable(feature = "atomic_debug", since = "1.3.0")]
 impl<T> fmt::Debug for AtomicPtr<T> {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         fmt::Debug::fmt(&self.load(Ordering::SeqCst), f)
     }
 }
@@ -2522,7 +2522,7 @@ impl<T> fmt::Debug for AtomicPtr<T> {
 #[cfg(target_has_atomic = "ptr")]
 #[stable(feature = "atomic_pointer", since = "1.24.0")]
 impl<T> fmt::Pointer for AtomicPtr<T> {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         fmt::Pointer::fmt(&self.load(Ordering::SeqCst), f)
     }
 }
diff --git a/src/libcore/task/wake.rs b/src/libcore/task/wake.rs
index 1d3140070f3..94e31054a58 100644
--- a/src/libcore/task/wake.rs
+++ b/src/libcore/task/wake.rs
@@ -180,7 +180,7 @@ impl<'a> Context<'a> {
 }
 
 impl fmt::Debug for Context<'_> {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         f.debug_struct("Context")
             .field("waker", &self.waker)
             .finish()
@@ -283,7 +283,7 @@ impl Drop for Waker {
 }
 
 impl fmt::Debug for Waker {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         let vtable_ptr = self.waker.vtable as *const RawWakerVTable;
         f.debug_struct("Waker")
             .field("data", &self.waker.data)
diff --git a/src/libcore/tests/iter.rs b/src/libcore/tests/iter.rs
index d5b581d336d..5247331fba2 100644
--- a/src/libcore/tests/iter.rs
+++ b/src/libcore/tests/iter.rs
@@ -390,6 +390,24 @@ fn test_iterator_enumerate_nth() {
 }
 
 #[test]
+fn test_iterator_enumerate_nth_back() {
+    let xs = [0, 1, 2, 3, 4, 5];
+    let mut it = xs.iter().enumerate();
+    while let Some((i, &x)) = it.nth_back(0) {
+        assert_eq!(i, x);
+    }
+
+    let mut it = xs.iter().enumerate();
+    while let Some((i, &x)) = it.nth_back(1) {
+        assert_eq!(i, x);
+    }
+
+    let (i, &x) = xs.iter().enumerate().nth_back(3).unwrap();
+    assert_eq!(i, x);
+    assert_eq!(i, 2);
+}
+
+#[test]
 fn test_iterator_enumerate_count() {
     let xs = [0, 1, 2, 3, 4, 5];
     assert_eq!(xs.iter().enumerate().count(), 6);
diff --git a/src/libcore/time.rs b/src/libcore/time.rs
index 9bb187e7de9..0f5f91f41a8 100644
--- a/src/libcore/time.rs
+++ b/src/libcore/time.rs
@@ -847,7 +847,7 @@ impl<'a> Sum<&'a Duration> for Duration {
 
 #[stable(feature = "duration_debug_impl", since = "1.27.0")]
 impl fmt::Debug for Duration {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         /// Formats a floating point number in decimal notation.
         ///
         /// The number is given as the `integer_part` and a fractional part.
@@ -859,7 +859,7 @@ impl fmt::Debug for Duration {
         /// of 10, everything else doesn't make sense. `fractional_part` has
         /// to be less than `10 * divisor`!
         fn fmt_decimal(
-            f: &mut fmt::Formatter,
+            f: &mut fmt::Formatter<'_>,
             mut integer_part: u64,
             mut fractional_part: u32,
             mut divisor: u32,
diff --git a/src/librustc/hir/lowering.rs b/src/librustc/hir/lowering.rs
index a8269bb1395..42ad571cf28 100644
--- a/src/librustc/hir/lowering.rs
+++ b/src/librustc/hir/lowering.rs
@@ -4685,6 +4685,14 @@ impl<'a> LoweringContext<'a> {
                         Symbol::intern("try_trait")
                     ].into()),
                 );
+                let try_span = self.sess.source_map().end_point(e.span);
+                let try_span = self.mark_span_with_reason(
+                    CompilerDesugaringKind::QuestionMark,
+                    try_span,
+                    Some(vec![
+                        Symbol::intern("try_trait")
+                    ].into()),
+                );
 
                 // `Try::into_result(<expr>)`
                 let discr = {
@@ -4729,14 +4737,14 @@ impl<'a> LoweringContext<'a> {
                 //              return Try::from_error(From::from(err)),`
                 let err_arm = {
                     let err_ident = self.str_to_ident("err");
-                    let (err_local, err_local_nid) = self.pat_ident(e.span, err_ident);
+                    let (err_local, err_local_nid) = self.pat_ident(try_span, err_ident);
                     let from_expr = {
                         let path = &["convert", "From", "from"];
                         let from = P(self.expr_std_path(
-                                e.span, path, None, ThinVec::new()));
-                        let err_expr = self.expr_ident(e.span, err_ident, err_local_nid);
+                                try_span, path, None, ThinVec::new()));
+                        let err_expr = self.expr_ident(try_span, err_ident, err_local_nid);
 
-                        self.expr_call(e.span, from, hir_vec![err_expr])
+                        self.expr_call(try_span, from, hir_vec![err_expr])
                     };
                     let from_err_expr =
                         self.wrap_in_try_constructor("from_error", from_expr, unstable_span);
@@ -4745,7 +4753,7 @@ impl<'a> LoweringContext<'a> {
                     let ret_expr = if let Some(catch_node) = catch_scope {
                         let target_id = Ok(self.lower_node_id(catch_node).hir_id);
                         P(self.expr(
-                            e.span,
+                            try_span,
                             hir::ExprKind::Break(
                                 hir::Destination {
                                     label: None,
@@ -4756,10 +4764,10 @@ impl<'a> LoweringContext<'a> {
                             thin_attrs,
                         ))
                     } else {
-                        P(self.expr(e.span, hir::ExprKind::Ret(Some(from_err_expr)), thin_attrs))
+                        P(self.expr(try_span, hir::ExprKind::Ret(Some(from_err_expr)), thin_attrs))
                     };
 
-                    let err_pat = self.pat_err(e.span, err_local);
+                    let err_pat = self.pat_err(try_span, err_local);
                     self.arm(hir_vec![err_pat], ret_expr)
                 };
 
diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs
index dc1ceaf69f0..97a1c83dbff 100644
--- a/src/librustc/session/config.rs
+++ b/src/librustc/session/config.rs
@@ -1467,6 +1467,8 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
         "inject the given attribute in the crate"),
     self_profile: bool = (false, parse_bool, [UNTRACKED],
         "run the self profiler and output the raw event data"),
+    self_profile_events: Option<Vec<String>> = (None, parse_opt_comma_list, [UNTRACKED],
+        "specifies which kinds of events get recorded by the self profiler"),
     emit_stack_sizes: bool = (false, parse_bool, [UNTRACKED],
         "emits a section containing stack size metadata"),
     plt: Option<bool> = (None, parse_opt_bool, [TRACKED],
diff --git a/src/librustc/session/mod.rs b/src/librustc/session/mod.rs
index eed516a4381..54eb1d815d3 100644
--- a/src/librustc/session/mod.rs
+++ b/src/librustc/session/mod.rs
@@ -165,6 +165,10 @@ pub struct Session {
 
     /// `Span`s of trait methods that weren't found to avoid emitting object safety errors
     pub trait_methods_not_found: Lock<FxHashSet<Span>>,
+
+    /// Mapping from ident span to path span for paths that don't exist as written, but that
+    /// exist under `std`. For example, wrote `str::from_utf8` instead of `std::str::from_utf8`.
+    pub confused_type_with_std_module: Lock<FxHashMap<Span, Span>>,
 }
 
 pub struct PerfStats {
@@ -1138,7 +1142,7 @@ fn build_session_(
 ) -> Session {
     let self_profiler =
         if sopts.debugging_opts.self_profile {
-            let profiler = SelfProfiler::new();
+            let profiler = SelfProfiler::new(&sopts.debugging_opts.self_profile_events);
             match profiler {
                 Ok(profiler) => {
                     crate::ty::query::QueryName::register_with_profiler(&profiler);
@@ -1248,6 +1252,7 @@ fn build_session_(
         has_panic_handler: Once::new(),
         driver_lint_caps,
         trait_methods_not_found: Lock::new(Default::default()),
+        confused_type_with_std_module: Lock::new(Default::default()),
     };
 
     validate_commandline_args_with_session_available(&sess);
diff --git a/src/librustc/traits/error_reporting.rs b/src/librustc/traits/error_reporting.rs
index 5b5a7cc9ed8..14c81a806c2 100644
--- a/src/librustc/traits/error_reporting.rs
+++ b/src/librustc/traits/error_reporting.rs
@@ -638,6 +638,18 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
                         let OnUnimplementedNote { message, label, note }
                             = self.on_unimplemented_note(trait_ref, obligation);
                         let have_alt_message = message.is_some() || label.is_some();
+                        let is_try = self.tcx.sess.source_map().span_to_snippet(span)
+                            .map(|s| &s == "?")
+                            .unwrap_or(false);
+                        let is_from = format!("{}", trait_ref).starts_with("std::convert::From<");
+                        let message = if is_try && is_from {
+                            Some(format!(
+                                "`?` couldn't convert the error to `{}`",
+                                trait_ref.self_ty(),
+                            ))
+                        } else {
+                            message
+                        };
 
                         let mut err = struct_span_err!(
                             self.tcx.sess,
diff --git a/src/librustc/util/profiling.rs b/src/librustc/util/profiling.rs
index aabf9a401c6..585970e64df 100644
--- a/src/librustc/util/profiling.rs
+++ b/src/librustc/util/profiling.rs
@@ -27,26 +27,42 @@ pub enum ProfileCategory {
     Other,
 }
 
-#[derive(Clone, Debug, Eq, PartialEq)]
-pub enum ProfilerEvent {
-    QueryStart { query_name: &'static str, category: ProfileCategory, time: u64 },
-    QueryEnd { query_name: &'static str, category: ProfileCategory, time: u64 },
-    GenericActivityStart { category: ProfileCategory, label: Cow<'static, str>, time: u64 },
-    GenericActivityEnd { category: ProfileCategory, label: Cow<'static, str>, time: u64 },
-    IncrementalLoadResultStart { query_name: &'static str, time: u64 },
-    IncrementalLoadResultEnd { query_name: &'static str, time: u64 },
-    QueryCacheHit { query_name: &'static str, category: ProfileCategory, time: u64 },
-    QueryCount { query_name: &'static str, category: ProfileCategory, count: usize, time: u64 },
-    QueryBlockedStart { query_name: &'static str, category: ProfileCategory, time: u64 },
-    QueryBlockedEnd { query_name: &'static str, category: ProfileCategory, time: u64 },
+bitflags! {
+    struct EventFilter: u32 {
+        const GENERIC_ACTIVITIES = 1 << 0;
+        const QUERY_PROVIDERS    = 1 << 1;
+        const QUERY_CACHE_HITS   = 1 << 2;
+        const QUERY_BLOCKED      = 1 << 3;
+        const INCR_CACHE_LOADS   = 1 << 4;
+
+        const DEFAULT = Self::GENERIC_ACTIVITIES.bits |
+                        Self::QUERY_PROVIDERS.bits |
+                        Self::QUERY_BLOCKED.bits |
+                        Self::INCR_CACHE_LOADS.bits;
+
+        // empty() and none() aren't const-fns unfortunately
+        const NONE = 0;
+        const ALL  = !Self::NONE.bits;
+    }
 }
 
+const EVENT_FILTERS_BY_NAME: &[(&str, EventFilter)] = &[
+    ("none", EventFilter::NONE),
+    ("all", EventFilter::ALL),
+    ("generic-activity", EventFilter::GENERIC_ACTIVITIES),
+    ("query-provider", EventFilter::QUERY_PROVIDERS),
+    ("query-cache-hit", EventFilter::QUERY_CACHE_HITS),
+    ("query-blocked" , EventFilter::QUERY_BLOCKED),
+    ("incr-cache-load", EventFilter::INCR_CACHE_LOADS),
+];
+
 fn thread_id_to_u64(tid: ThreadId) -> u64 {
     unsafe { mem::transmute::<ThreadId, u64>(tid) }
 }
 
 pub struct SelfProfiler {
     profiler: Profiler,
+    event_filter_mask: EventFilter,
     query_event_kind: StringId,
     generic_activity_event_kind: StringId,
     incremental_load_result_event_kind: StringId,
@@ -55,7 +71,7 @@ pub struct SelfProfiler {
 }
 
 impl SelfProfiler {
-    pub fn new() -> Result<SelfProfiler, Box<dyn Error>> {
+    pub fn new(event_filters: &Option<Vec<String>>) -> Result<SelfProfiler, Box<dyn Error>> {
         let filename = format!("pid-{}.rustc_profile", process::id());
         let path = std::path::Path::new(&filename);
         let profiler = Profiler::new(path)?;
@@ -66,8 +82,38 @@ impl SelfProfiler {
         let query_blocked_event_kind = profiler.alloc_string("QueryBlocked");
         let query_cache_hit_event_kind = profiler.alloc_string("QueryCacheHit");
 
+        let mut event_filter_mask = EventFilter::empty();
+
+        if let Some(ref event_filters) = *event_filters {
+            let mut unknown_events = vec![];
+            for item in event_filters {
+                if let Some(&(_, mask)) = EVENT_FILTERS_BY_NAME.iter()
+                                                               .find(|&(name, _)| name == item) {
+                    event_filter_mask |= mask;
+                } else {
+                    unknown_events.push(item.clone());
+                }
+            }
+
+            // Warn about any unknown event names
+            if unknown_events.len() > 0 {
+                unknown_events.sort();
+                unknown_events.dedup();
+
+                warn!("Unknown self-profiler events specified: {}. Available options are: {}.",
+                    unknown_events.join(", "),
+                    EVENT_FILTERS_BY_NAME.iter()
+                                         .map(|&(name, _)| name.to_string())
+                                         .collect::<Vec<_>>()
+                                         .join(", "));
+            }
+        } else {
+            event_filter_mask = EventFilter::DEFAULT;
+        }
+
         Ok(SelfProfiler {
             profiler,
+            event_filter_mask,
             query_event_kind,
             generic_activity_event_kind,
             incremental_load_result_event_kind,
@@ -86,7 +132,6 @@ impl SelfProfiler {
 
     pub fn register_query_name(&self, query_name: QueryName) {
         let id = SelfProfiler::get_query_name_string_id(query_name);
-
         self.profiler.alloc_string_with_reserved_id(id, query_name.as_str());
     }
 
@@ -95,7 +140,9 @@ impl SelfProfiler {
         &self,
         label: impl Into<Cow<'static, str>>,
     ) {
-        self.record(&label.into(), self.generic_activity_event_kind, TimestampKind::Start);
+        if self.event_filter_mask.contains(EventFilter::GENERIC_ACTIVITIES) {
+            self.record(&label.into(), self.generic_activity_event_kind, TimestampKind::Start);
+        }
     }
 
     #[inline]
@@ -103,46 +150,66 @@ impl SelfProfiler {
         &self,
         label: impl Into<Cow<'static, str>>,
     ) {
-        self.record(&label.into(), self.generic_activity_event_kind, TimestampKind::End);
+        if self.event_filter_mask.contains(EventFilter::GENERIC_ACTIVITIES) {
+            self.record(&label.into(), self.generic_activity_event_kind, TimestampKind::End);
+        }
     }
 
     #[inline]
     pub fn record_query_hit(&self, query_name: QueryName) {
-        self.record_query(query_name, self.query_cache_hit_event_kind, TimestampKind::Instant);
+        if self.event_filter_mask.contains(EventFilter::QUERY_CACHE_HITS) {
+            self.record_query(query_name, self.query_cache_hit_event_kind, TimestampKind::Instant);
+        }
     }
 
     #[inline]
     pub fn start_query(&self, query_name: QueryName) {
-        self.record_query(query_name, self.query_event_kind, TimestampKind::Start);
+        if self.event_filter_mask.contains(EventFilter::QUERY_PROVIDERS) {
+            self.record_query(query_name, self.query_event_kind, TimestampKind::Start);
+        }
     }
 
     #[inline]
     pub fn end_query(&self, query_name: QueryName) {
-        self.record_query(query_name, self.query_event_kind, TimestampKind::End);
+        if self.event_filter_mask.contains(EventFilter::QUERY_PROVIDERS) {
+            self.record_query(query_name, self.query_event_kind, TimestampKind::End);
+        }
     }
 
     #[inline]
     pub fn incremental_load_result_start(&self, query_name: QueryName) {
-        self.record_query(
-            query_name,
-            self.incremental_load_result_event_kind,
-            TimestampKind::Start
-        );
+        if self.event_filter_mask.contains(EventFilter::INCR_CACHE_LOADS) {
+            self.record_query(
+                query_name,
+                self.incremental_load_result_event_kind,
+                TimestampKind::Start
+            );
+        }
     }
 
     #[inline]
     pub fn incremental_load_result_end(&self, query_name: QueryName) {
-        self.record_query(query_name, self.incremental_load_result_event_kind, TimestampKind::End);
+        if self.event_filter_mask.contains(EventFilter::INCR_CACHE_LOADS) {
+            self.record_query(
+                query_name,
+                self.incremental_load_result_event_kind,
+                TimestampKind::End
+            );
+        }
     }
 
     #[inline]
     pub fn query_blocked_start(&self, query_name: QueryName) {
-        self.record_query(query_name, self.query_blocked_event_kind, TimestampKind::Start);
+        if self.event_filter_mask.contains(EventFilter::QUERY_BLOCKED) {
+            self.record_query(query_name, self.query_blocked_event_kind, TimestampKind::Start);
+        }
     }
 
     #[inline]
     pub fn query_blocked_end(&self, query_name: QueryName) {
-        self.record_query(query_name, self.query_blocked_event_kind, TimestampKind::End);
+        if self.event_filter_mask.contains(EventFilter::QUERY_BLOCKED) {
+            self.record_query(query_name, self.query_blocked_event_kind, TimestampKind::End);
+        }
     }
 
     #[inline]
diff --git a/src/librustc_codegen_llvm/llvm/ffi.rs b/src/librustc_codegen_llvm/llvm/ffi.rs
index f6ee8bec16a..f88923fc9f1 100644
--- a/src/librustc_codegen_llvm/llvm/ffi.rs
+++ b/src/librustc_codegen_llvm/llvm/ffi.rs
@@ -1382,7 +1382,6 @@ extern "C" {
     pub fn LLVMRustDebugMetadataVersion() -> u32;
     pub fn LLVMRustVersionMajor() -> u32;
     pub fn LLVMRustVersionMinor() -> u32;
-    pub fn LLVMRustIsRustLLVM() -> bool;
 
     pub fn LLVMRustAddModuleFlag(M: &Module, name: *const c_char, value: u32);
 
diff --git a/src/librustc_codegen_llvm/llvm_util.rs b/src/librustc_codegen_llvm/llvm_util.rs
index 5fea9c8747e..fe21b19b52a 100644
--- a/src/librustc_codegen_llvm/llvm_util.rs
+++ b/src/librustc_codegen_llvm/llvm_util.rs
@@ -61,7 +61,7 @@ unsafe fn configure_llvm(sess: &Session) {
         if sess.opts.debugging_opts.disable_instrumentation_preinliner {
             add("-disable-preinline");
         }
-        if llvm::LLVMRustIsRustLLVM() {
+        if get_major_version() >= 8 {
             match sess.opts.debugging_opts.merge_functions
                   .unwrap_or(sess.target.target.options.merge_functions) {
                 MergeFunctions::Disabled |
@@ -154,6 +154,7 @@ const X86_WHITELIST: &[(&str, Option<&str>)] = &[
     ("popcnt", None),
     ("rdrand", None),
     ("rdseed", None),
+    ("rtm", Some("rtm_target_feature")),
     ("sha", None),
     ("sse", None),
     ("sse2", None),
diff --git a/src/librustc_resolve/diagnostics.rs b/src/librustc_resolve/diagnostics.rs
index 9e3894dab0d..9b02f98164f 100644
--- a/src/librustc_resolve/diagnostics.rs
+++ b/src/librustc_resolve/diagnostics.rs
@@ -166,16 +166,18 @@ impl<'a> Resolver<'a> {
                 let self_is_available = self.self_value_is_available(path[0].ident.span, span);
                 match candidate {
                     AssocSuggestion::Field => {
-                        err.span_suggestion(
-                            span,
-                            "try",
-                            format!("self.{}", path_str),
-                            Applicability::MachineApplicable,
-                        );
-                        if !self_is_available {
-                            err.span_label(span, format!("`self` value is a keyword \
-                                                         only available in \
-                                                         methods with `self` parameter"));
+                        if self_is_available {
+                            err.span_suggestion(
+                                span,
+                                "you might have meant to use the available field",
+                                format!("self.{}", path_str),
+                                Applicability::MachineApplicable,
+                            );
+                        } else {
+                            err.span_label(
+                                span,
+                                "a field by this name exists in `Self`",
+                            );
                         }
                     }
                     AssocSuggestion::MethodWithSelf if self_is_available => {
diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs
index 08b2f1a0f16..8df83120738 100644
--- a/src/librustc_resolve/lib.rs
+++ b/src/librustc_resolve/lib.rs
@@ -3273,6 +3273,25 @@ impl<'a> Resolver<'a> {
                     let traits = self.get_traits_containing_item(item_name, ns);
                     self.trait_map.insert(id, traits);
                 }
+
+                let mut std_path = vec![Segment::from_ident(Ident::from_str("std"))];
+                std_path.extend(path);
+                if self.primitive_type_table.primitive_types.contains_key(&path[0].ident.name) {
+                    let cl = CrateLint::No;
+                    let ns = Some(ns);
+                    if let PathResult::Module(_) | PathResult::NonModule(_) =
+                        self.resolve_path_without_parent_scope(&std_path, ns, false, span, cl)
+                    {
+                        // check if we wrote `str::from_utf8` instead of `std::str::from_utf8`
+                        let item_span = path.iter().last().map(|segment| segment.ident.span)
+                            .unwrap_or(span);
+                        debug!("accessed item from `std` submodule as a bare type {:?}", std_path);
+                        let mut hm = self.session.confused_type_with_std_module.borrow_mut();
+                        hm.insert(item_span, span);
+                        // In some places (E0223) we only have access to the full path
+                        hm.insert(span, span);
+                    }
+                }
                 resolution
             }
             _ => report_errors(self, None)
@@ -3387,16 +3406,17 @@ impl<'a> Resolver<'a> {
     }
 
     // Resolve in alternative namespaces if resolution in the primary namespace fails.
-    fn resolve_qpath_anywhere(&mut self,
-                              id: NodeId,
-                              qself: Option<&QSelf>,
-                              path: &[Segment],
-                              primary_ns: Namespace,
-                              span: Span,
-                              defer_to_typeck: bool,
-                              global_by_default: bool,
-                              crate_lint: CrateLint)
-                              -> Option<PathResolution> {
+    fn resolve_qpath_anywhere(
+        &mut self,
+        id: NodeId,
+        qself: Option<&QSelf>,
+        path: &[Segment],
+        primary_ns: Namespace,
+        span: Span,
+        defer_to_typeck: bool,
+        global_by_default: bool,
+        crate_lint: CrateLint,
+    ) -> Option<PathResolution> {
         let mut fin_res = None;
         // FIXME: can't resolve paths in macro namespace yet, macros are
         // processed by the little special hack below.
@@ -3426,15 +3446,16 @@ impl<'a> Resolver<'a> {
     }
 
     /// Handles paths that may refer to associated items.
-    fn resolve_qpath(&mut self,
-                     id: NodeId,
-                     qself: Option<&QSelf>,
-                     path: &[Segment],
-                     ns: Namespace,
-                     span: Span,
-                     global_by_default: bool,
-                     crate_lint: CrateLint)
-                     -> Option<PathResolution> {
+    fn resolve_qpath(
+        &mut self,
+        id: NodeId,
+        qself: Option<&QSelf>,
+        path: &[Segment],
+        ns: Namespace,
+        span: Span,
+        global_by_default: bool,
+        crate_lint: CrateLint,
+    ) -> Option<PathResolution> {
         debug!(
             "resolve_qpath(id={:?}, qself={:?}, path={:?}, \
              ns={:?}, span={:?}, global_by_default={:?})",
diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs
index 0c206b27f80..be8e5dae1d9 100644
--- a/src/librustc_typeck/astconv.rs
+++ b/src/librustc_typeck/astconv.rs
@@ -1187,18 +1187,33 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o {
         ty
     }
 
-    fn report_ambiguous_associated_type(&self,
-                                        span: Span,
-                                        type_str: &str,
-                                        trait_str: &str,
-                                        name: &str) {
-        struct_span_err!(self.tcx().sess, span, E0223, "ambiguous associated type")
-            .span_suggestion(
+    fn report_ambiguous_associated_type(
+        &self,
+        span: Span,
+        type_str: &str,
+        trait_str: &str,
+        name: &str,
+    ) {
+        let mut err = struct_span_err!(self.tcx().sess, span, E0223, "ambiguous associated type");
+        if let (Some(_), Ok(snippet)) = (
+            self.tcx().sess.confused_type_with_std_module.borrow().get(&span),
+            self.tcx().sess.source_map().span_to_snippet(span),
+         ) {
+            err.span_suggestion(
                 span,
-                "use fully-qualified syntax",
-                format!("<{} as {}>::{}", type_str, trait_str, name),
-                Applicability::HasPlaceholders
-            ).emit();
+                "you are looking for the module in `std`, not the primitive type",
+                format!("std::{}", snippet),
+                Applicability::MachineApplicable,
+            );
+        } else {
+            err.span_suggestion(
+                    span,
+                    "use fully-qualified syntax",
+                    format!("<{} as {}>::{}", type_str, trait_str, name),
+                    Applicability::HasPlaceholders
+            );
+        }
+        err.emit();
     }
 
     // Search for a bound on a type parameter which includes the associated item
@@ -1391,10 +1406,12 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o {
                     err.emit();
                 } else if !qself_ty.references_error() {
                     // Don't print `TyErr` to the user.
-                    self.report_ambiguous_associated_type(span,
-                                                          &qself_ty.to_string(),
-                                                          "Trait",
-                                                          &assoc_ident.as_str());
+                    self.report_ambiguous_associated_type(
+                        span,
+                        &qself_ty.to_string(),
+                        "Trait",
+                        &assoc_ident.as_str(),
+                    );
                 }
                 return (tcx.types.err, Def::Err);
             }
@@ -1461,10 +1478,12 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o {
             ty
         } else {
             let path_str = tcx.def_path_str(trait_def_id);
-            self.report_ambiguous_associated_type(span,
-                                                  "Type",
-                                                  &path_str,
-                                                  &item_segment.ident.as_str());
+            self.report_ambiguous_associated_type(
+                span,
+                "Type",
+                &path_str,
+                &item_segment.ident.as_str(),
+            );
             return tcx.types.err;
         };
 
diff --git a/src/librustc_typeck/check/method/suggest.rs b/src/librustc_typeck/check/method/suggest.rs
index ff889c89770..7121b06e27a 100644
--- a/src/librustc_typeck/check/method/suggest.rs
+++ b/src/librustc_typeck/check/method/suggest.rs
@@ -292,7 +292,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
                         return;
                     } else {
                         span = item_name.span;
-                        struct_span_err!(
+                        let mut err = struct_span_err!(
                             tcx.sess,
                             span,
                             E0599,
@@ -300,7 +300,21 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
                             item_kind,
                             item_name,
                             ty_str
-                        )
+                        );
+                        if let Some(span) = tcx.sess.confused_type_with_std_module.borrow()
+                            .get(&span)
+                        {
+                            if let Ok(snippet) = tcx.sess.source_map().span_to_snippet(*span) {
+                                err.span_suggestion(
+                                    *span,
+                                    "you are looking for the module in `std`, \
+                                     not the primitive type",
+                                    format!("std::{}", snippet),
+                                    Applicability::MachineApplicable,
+                                );
+                            }
+                        }
+                        err
                     }
                 } else {
                     tcx.sess.diagnostic().struct_dummy()
diff --git a/src/librustc_typeck/check/wfcheck.rs b/src/librustc_typeck/check/wfcheck.rs
index d108e7c3107..37be1c3b5b7 100644
--- a/src/librustc_typeck/check/wfcheck.rs
+++ b/src/librustc_typeck/check/wfcheck.rs
@@ -938,10 +938,12 @@ fn check_variances_for_type_defn<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
                         .map(|(index, _)| Parameter(index as u32))
                         .collect();
 
-    identify_constrained_generic_params(tcx,
-                                     &ty_predicates,
-                                     None,
-                                     &mut constrained_parameters);
+    identify_constrained_generic_params(
+        tcx,
+        &ty_predicates,
+        None,
+        &mut constrained_parameters,
+    );
 
     for (index, _) in variances.iter().enumerate() {
         if constrained_parameters.contains(&Parameter(index as u32)) {
@@ -949,6 +951,7 @@ fn check_variances_for_type_defn<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
         }
 
         let param = &hir_generics.params[index];
+
         match param.name {
             hir::ParamName::Error => { }
             _ => report_bivariance(tcx, param.span, param.name.ident().name),
@@ -1123,7 +1126,7 @@ fn error_392<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, span: Span, param_name: ast:
                        -> DiagnosticBuilder<'tcx> {
     let mut err = struct_span_err!(tcx.sess, span, E0392,
                   "parameter `{}` is never used", param_name);
-    err.span_label(span, "unused type parameter");
+    err.span_label(span, "unused parameter");
     err
 }
 
diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs
index 0cd7fe91594..d601c962fc6 100644
--- a/src/librustc_typeck/collect.rs
+++ b/src/librustc_typeck/collect.rs
@@ -2432,6 +2432,7 @@ fn from_target_feature(
                 Some("cmpxchg16b_target_feature") => rust_features.cmpxchg16b_target_feature,
                 Some("adx_target_feature") => rust_features.adx_target_feature,
                 Some("movbe_target_feature") => rust_features.movbe_target_feature,
+                Some("rtm_target_feature") => rust_features.rtm_target_feature,
                 Some(name) => bug!("unknown target feature gate {}", name),
                 None => true,
             };
diff --git a/src/librustdoc/html/static/rustdoc.css b/src/librustdoc/html/static/rustdoc.css
index 8cf70b9a995..53b08cf5697 100644
--- a/src/librustdoc/html/static/rustdoc.css
+++ b/src/librustdoc/html/static/rustdoc.css
@@ -166,7 +166,6 @@ nav.sub {
 	top: 0;
 	height: 100vh;
 	overflow: auto;
-	z-index: 1;
 }
 
 .sidebar .block > ul > li {
diff --git a/src/libstd/fs.rs b/src/libstd/fs.rs
index dea198d8c91..1772879d013 100644
--- a/src/libstd/fs.rs
+++ b/src/libstd/fs.rs
@@ -901,8 +901,7 @@ impl OpenOptions {
     }
 
     fn _open(&self, path: &Path) -> io::Result<File> {
-        let inner = fs_imp::File::open(path, &self.0)?;
-        Ok(File { inner })
+        fs_imp::File::open(path, &self.0).map(|inner| File { inner })
     }
 }
 
diff --git a/src/libstd/thread/mod.rs b/src/libstd/thread/mod.rs
index c59226e0c0b..fce28ffd9c3 100644
--- a/src/libstd/thread/mod.rs
+++ b/src/libstd/thread/mod.rs
@@ -269,7 +269,7 @@ impl Builder {
     ///
     /// let builder = thread::Builder::new()
     ///                               .name("foo".into())
-    ///                               .stack_size(10);
+    ///                               .stack_size(32 * 1024);
     ///
     /// let handler = builder.spawn(|| {
     ///     // thread code
diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs
index c8b020d8c0b..7bae5ba7571 100644
--- a/src/libsyntax/feature_gate.rs
+++ b/src/libsyntax/feature_gate.rs
@@ -402,6 +402,7 @@ declare_features! (
     (active, adx_target_feature, "1.32.0", Some(44839), None),
     (active, cmpxchg16b_target_feature, "1.32.0", Some(44839), None),
     (active, movbe_target_feature, "1.34.0", Some(44839), None),
+    (active, rtm_target_feature, "1.35.0", Some(44839), None),
 
     // Allows macro invocations on modules expressions and statements and
     // procedural macros to expand to non-items.
diff --git a/src/rustllvm/RustWrapper.cpp b/src/rustllvm/RustWrapper.cpp
index 437e2d482ef..66453c08a66 100644
--- a/src/rustllvm/RustWrapper.cpp
+++ b/src/rustllvm/RustWrapper.cpp
@@ -613,14 +613,6 @@ extern "C" uint32_t LLVMRustVersionMinor() { return LLVM_VERSION_MINOR; }
 
 extern "C" uint32_t LLVMRustVersionMajor() { return LLVM_VERSION_MAJOR; }
 
-extern "C" bool LLVMRustIsRustLLVM() {
-#ifdef LLVM_RUSTLLVM
-  return 1;
-#else
-  return 0;
-#endif
-}
-
 extern "C" void LLVMRustAddModuleFlag(LLVMModuleRef M, const char *Name,
                                       uint32_t Value) {
   unwrap(M)->addModuleFlag(Module::Warning, Name, Value);
diff --git a/src/test/ui/class-missing-self.stderr b/src/test/ui/class-missing-self.stderr
index ec11f125399..25cb85dadb9 100644
--- a/src/test/ui/class-missing-self.stderr
+++ b/src/test/ui/class-missing-self.stderr
@@ -2,7 +2,7 @@ error[E0425]: cannot find value `meows` in this scope
   --> $DIR/class-missing-self.rs:9:7
    |
 LL |       meows += 1;
-   |       ^^^^^ help: try: `self.meows`
+   |       ^^^^^ help: you might have meant to use the available field: `self.meows`
 
 error[E0425]: cannot find function `sleep` in this scope
   --> $DIR/class-missing-self.rs:10:7
diff --git a/src/test/ui/error-codes/E0392.stderr b/src/test/ui/error-codes/E0392.stderr
index 18419572233..d0b808df184 100644
--- a/src/test/ui/error-codes/E0392.stderr
+++ b/src/test/ui/error-codes/E0392.stderr
@@ -2,7 +2,7 @@ error[E0392]: parameter `T` is never used
   --> $DIR/E0392.rs:1:10
    |
 LL | enum Foo<T> { Bar }
-   |          ^ unused type parameter
+   |          ^ unused parameter
    |
    = help: consider removing `T` or using a marker such as `std::marker::PhantomData`
 
diff --git a/src/test/ui/inner-static-type-parameter.stderr b/src/test/ui/inner-static-type-parameter.stderr
index fc086a2a164..083b4b67eb4 100644
--- a/src/test/ui/inner-static-type-parameter.stderr
+++ b/src/test/ui/inner-static-type-parameter.stderr
@@ -12,7 +12,7 @@ error[E0392]: parameter `T` is never used
   --> $DIR/inner-static-type-parameter.rs:3:10
    |
 LL | enum Bar<T> { What }
-   |          ^ unused type parameter
+   |          ^ unused parameter
    |
    = help: consider removing `T` or using a marker such as `std::marker::PhantomData`
 
diff --git a/src/test/ui/issues/issue-17904-2.stderr b/src/test/ui/issues/issue-17904-2.stderr
index b8fabd3b13f..930409cc637 100644
--- a/src/test/ui/issues/issue-17904-2.stderr
+++ b/src/test/ui/issues/issue-17904-2.stderr
@@ -2,7 +2,7 @@ error[E0392]: parameter `T` is never used
   --> $DIR/issue-17904-2.rs:4:12
    |
 LL | struct Foo<T> where T: Copy;
-   |            ^ unused type parameter
+   |            ^ unused parameter
    |
    = help: consider removing `T` or using a marker such as `std::marker::PhantomData`
 
diff --git a/src/test/ui/issues/issue-20413.stderr b/src/test/ui/issues/issue-20413.stderr
index 2b3b38317af..6ef806cd668 100644
--- a/src/test/ui/issues/issue-20413.stderr
+++ b/src/test/ui/issues/issue-20413.stderr
@@ -2,7 +2,7 @@ error[E0392]: parameter `T` is never used
   --> $DIR/issue-20413.rs:5:15
    |
 LL | struct NoData<T>;
-   |               ^ unused type parameter
+   |               ^ unused parameter
    |
    = help: consider removing `T` or using a marker such as `std::marker::PhantomData`
 
diff --git a/src/test/ui/issues/issue-22933-3.stderr b/src/test/ui/issues/issue-22933-3.stderr
index b1afda6d151..e0e8b5e18a4 100644
--- a/src/test/ui/issues/issue-22933-3.stderr
+++ b/src/test/ui/issues/issue-22933-3.stderr
@@ -3,6 +3,10 @@ error[E0599]: no associated item named `MIN` found for type `u8` in the current
    |
 LL | const FOO: [u32; u8::MIN as usize] = [];
    |                      ^^^ associated item not found in `u8`
+help: you are looking for the module in `std`, not the primitive type
+   |
+LL | const FOO: [u32; std::u8::MIN as usize] = [];
+   |                  ^^^^^^^^^^^^
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/issues/issue-32709.stderr b/src/test/ui/issues/issue-32709.stderr
index 9127c754658..84cca5b20af 100644
--- a/src/test/ui/issues/issue-32709.stderr
+++ b/src/test/ui/issues/issue-32709.stderr
@@ -1,8 +1,8 @@
-error[E0277]: the trait bound `(): std::convert::From<{integer}>` is not satisfied
-  --> $DIR/issue-32709.rs:4:5
+error[E0277]: `?` couldn't convert the error to `()`
+  --> $DIR/issue-32709.rs:4:11
    |
 LL |     Err(5)?;
-   |     ^^^^^^^ the trait `std::convert::From<{integer}>` is not implemented for `()`
+   |           ^ the trait `std::convert::From<{integer}>` is not implemented for `()`
    |
    = note: required by `std::convert::From::from`
 
diff --git a/src/test/ui/issues/issue-36299.stderr b/src/test/ui/issues/issue-36299.stderr
index dce4bd31ca3..edbe790a0c9 100644
--- a/src/test/ui/issues/issue-36299.stderr
+++ b/src/test/ui/issues/issue-36299.stderr
@@ -2,7 +2,7 @@ error[E0392]: parameter `'a` is never used
   --> $DIR/issue-36299.rs:1:12
    |
 LL | struct Foo<'a, A> {}
-   |            ^^ unused type parameter
+   |            ^^ unused parameter
    |
    = help: consider removing `'a` or using a marker such as `std::marker::PhantomData`
 
@@ -10,7 +10,7 @@ error[E0392]: parameter `A` is never used
   --> $DIR/issue-36299.rs:1:16
    |
 LL | struct Foo<'a, A> {}
-   |                ^ unused type parameter
+   |                ^ unused parameter
    |
    = help: consider removing `A` or using a marker such as `std::marker::PhantomData`
 
diff --git a/src/test/ui/issues/issue-36638.stderr b/src/test/ui/issues/issue-36638.stderr
index 17134309014..2e440861611 100644
--- a/src/test/ui/issues/issue-36638.stderr
+++ b/src/test/ui/issues/issue-36638.stderr
@@ -14,7 +14,7 @@ error[E0392]: parameter `Self` is never used
   --> $DIR/issue-36638.rs:3:12
    |
 LL | struct Foo<Self>(Self);
-   |            ^^^^ unused type parameter
+   |            ^^^^ unused parameter
    |
    = help: consider removing `Self` or using a marker such as `std::marker::PhantomData`
 
diff --git a/src/test/ui/issues/issue-37534.stderr b/src/test/ui/issues/issue-37534.stderr
index 30f5755bea8..741e93561bc 100644
--- a/src/test/ui/issues/issue-37534.stderr
+++ b/src/test/ui/issues/issue-37534.stderr
@@ -18,7 +18,7 @@ error[E0392]: parameter `T` is never used
   --> $DIR/issue-37534.rs:1:12
    |
 LL | struct Foo<T: ?Hash> { }
-   |            ^ unused type parameter
+   |            ^ unused parameter
    |
    = help: consider removing `T` or using a marker such as `std::marker::PhantomData`
 
diff --git a/src/test/ui/issues/issue-60057.rs b/src/test/ui/issues/issue-60057.rs
new file mode 100644
index 00000000000..3027d01c532
--- /dev/null
+++ b/src/test/ui/issues/issue-60057.rs
@@ -0,0 +1,17 @@
+struct A {
+    banana: u8,
+}
+
+impl A {
+    fn new(peach: u8) -> A {
+        A {
+            banana: banana //~ ERROR cannot find value `banana` in this scope
+        }
+    }
+
+    fn foo(&self, peach: u8) -> A {
+        A {
+            banana: banana //~ ERROR cannot find value `banana` in this scope
+        }
+    }
+}
diff --git a/src/test/ui/issues/issue-60057.stderr b/src/test/ui/issues/issue-60057.stderr
new file mode 100644
index 00000000000..6b967204ce6
--- /dev/null
+++ b/src/test/ui/issues/issue-60057.stderr
@@ -0,0 +1,20 @@
+error[E0425]: cannot find value `banana` in this scope
+  --> $DIR/issue-60057.rs:8:21
+   |
+LL |             banana: banana
+   |                     ^^^^^^ a field by this name exists in `Self`
+
+error[E0425]: cannot find value `banana` in this scope
+  --> $DIR/issue-60057.rs:14:21
+   |
+LL |             banana: banana
+   |                     ^^^^^^ help: you might have meant to use the available field: `self.banana`
+
+error[E0601]: `main` function not found in crate `issue_60057`
+   |
+   = note: consider adding a `main` function to `$DIR/issue-60057.rs`
+
+error: aborting due to 3 previous errors
+
+Some errors have detailed explanations: E0425, E0601.
+For more information about an error, try `rustc --explain E0425`.
diff --git a/src/test/ui/regions/region-bounds-on-objects-and-type-parameters.stderr b/src/test/ui/regions/region-bounds-on-objects-and-type-parameters.stderr
index 1111117369f..8bcb2da4577 100644
--- a/src/test/ui/regions/region-bounds-on-objects-and-type-parameters.stderr
+++ b/src/test/ui/regions/region-bounds-on-objects-and-type-parameters.stderr
@@ -25,7 +25,7 @@ error[E0392]: parameter `'c` is never used
   --> $DIR/region-bounds-on-objects-and-type-parameters.rs:11:18
    |
 LL | struct Foo<'a,'b,'c> {
-   |                  ^^ unused type parameter
+   |                  ^^ unused parameter
    |
    = help: consider removing `'c` or using a marker such as `std::marker::PhantomData`
 
diff --git a/src/test/ui/resolve/issue-14254.stderr b/src/test/ui/resolve/issue-14254.stderr
index 783b3addfc2..97d42aa8ef4 100644
--- a/src/test/ui/resolve/issue-14254.stderr
+++ b/src/test/ui/resolve/issue-14254.stderr
@@ -20,13 +20,13 @@ error[E0425]: cannot find value `x` in this scope
   --> $DIR/issue-14254.rs:30:9
    |
 LL |         x;
-   |         ^ help: try: `self.x`
+   |         ^ help: you might have meant to use the available field: `self.x`
 
 error[E0425]: cannot find value `y` in this scope
   --> $DIR/issue-14254.rs:32:9
    |
 LL |         y;
-   |         ^ help: try: `self.y`
+   |         ^ help: you might have meant to use the available field: `self.y`
 
 error[E0425]: cannot find value `a` in this scope
   --> $DIR/issue-14254.rs:34:9
@@ -56,13 +56,13 @@ error[E0425]: cannot find value `x` in this scope
   --> $DIR/issue-14254.rs:47:9
    |
 LL |         x;
-   |         ^ help: try: `self.x`
+   |         ^ help: you might have meant to use the available field: `self.x`
 
 error[E0425]: cannot find value `y` in this scope
   --> $DIR/issue-14254.rs:49:9
    |
 LL |         y;
-   |         ^ help: try: `self.y`
+   |         ^ help: you might have meant to use the available field: `self.y`
 
 error[E0425]: cannot find value `a` in this scope
   --> $DIR/issue-14254.rs:51:9
diff --git a/src/test/ui/resolve/issue-2356.stderr b/src/test/ui/resolve/issue-2356.stderr
index 01dff5dd82f..7790383843e 100644
--- a/src/test/ui/resolve/issue-2356.stderr
+++ b/src/test/ui/resolve/issue-2356.stderr
@@ -20,10 +20,7 @@ error[E0425]: cannot find value `whiskers` in this scope
   --> $DIR/issue-2356.rs:39:5
    |
 LL |     whiskers -= other;
-   |     ^^^^^^^^
-   |     |
-   |     `self` value is a keyword only available in methods with `self` parameter
-   |     help: try: `self.whiskers`
+   |     ^^^^^^^^ a field by this name exists in `Self`
 
 error[E0425]: cannot find function `shave` in this scope
   --> $DIR/issue-2356.rs:41:5
@@ -83,16 +80,13 @@ error[E0425]: cannot find value `whiskers` in this scope
   --> $DIR/issue-2356.rs:79:5
    |
 LL |     whiskers = 0;
-   |     ^^^^^^^^ help: try: `self.whiskers`
+   |     ^^^^^^^^ help: you might have meant to use the available field: `self.whiskers`
 
 error[E0425]: cannot find value `whiskers` in this scope
   --> $DIR/issue-2356.rs:84:5
    |
 LL |     whiskers = 4;
-   |     ^^^^^^^^
-   |     |
-   |     `self` value is a keyword only available in methods with `self` parameter
-   |     help: try: `self.whiskers`
+   |     ^^^^^^^^ a field by this name exists in `Self`
 
 error[E0425]: cannot find function `purr_louder` in this scope
   --> $DIR/issue-2356.rs:86:5
diff --git a/src/test/ui/resolve/resolve-assoc-suggestions.stderr b/src/test/ui/resolve/resolve-assoc-suggestions.stderr
index fd97ce09d4a..87040015b8d 100644
--- a/src/test/ui/resolve/resolve-assoc-suggestions.stderr
+++ b/src/test/ui/resolve/resolve-assoc-suggestions.stderr
@@ -14,7 +14,7 @@ error[E0425]: cannot find value `field` in this scope
   --> $DIR/resolve-assoc-suggestions.rs:20:9
    |
 LL |         field;
-   |         ^^^^^ help: try: `self.field`
+   |         ^^^^^ help: you might have meant to use the available field: `self.field`
 
 error[E0412]: cannot find type `Type` in this scope
   --> $DIR/resolve-assoc-suggestions.rs:23:16
diff --git a/src/test/ui/resolve/resolve-speculative-adjustment.stderr b/src/test/ui/resolve/resolve-speculative-adjustment.stderr
index c4a6ced1ca4..892b50309a9 100644
--- a/src/test/ui/resolve/resolve-speculative-adjustment.stderr
+++ b/src/test/ui/resolve/resolve-speculative-adjustment.stderr
@@ -14,7 +14,7 @@ error[E0425]: cannot find value `field` in this scope
   --> $DIR/resolve-speculative-adjustment.rs:23:9
    |
 LL |         field;
-   |         ^^^^^ help: try: `self.field`
+   |         ^^^^^ help: you might have meant to use the available field: `self.field`
 
 error[E0425]: cannot find function `method` in this scope
   --> $DIR/resolve-speculative-adjustment.rs:25:9
diff --git a/src/test/ui/resolve/unresolved_static_type_field.stderr b/src/test/ui/resolve/unresolved_static_type_field.stderr
index a5173243787..06926b53ddd 100644
--- a/src/test/ui/resolve/unresolved_static_type_field.stderr
+++ b/src/test/ui/resolve/unresolved_static_type_field.stderr
@@ -2,10 +2,7 @@ error[E0425]: cannot find value `cx` in this scope
   --> $DIR/unresolved_static_type_field.rs:9:11
    |
 LL |         f(cx);
-   |           ^^
-   |           |
-   |           `self` value is a keyword only available in methods with `self` parameter
-   |           help: try: `self.cx`
+   |           ^^ a field by this name exists in `Self`
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/self/self_type_keyword.stderr b/src/test/ui/self/self_type_keyword.stderr
index f75377a220b..e0df00ffa92 100644
--- a/src/test/ui/self/self_type_keyword.stderr
+++ b/src/test/ui/self/self_type_keyword.stderr
@@ -62,7 +62,7 @@ error[E0392]: parameter `'Self` is never used
   --> $DIR/self_type_keyword.rs:8:12
    |
 LL | struct Bar<'Self>;
-   |            ^^^^^ unused type parameter
+   |            ^^^^^ unused parameter
    |
    = help: consider removing `'Self` or using a marker such as `std::marker::PhantomData`
 
diff --git a/src/test/ui/suggestions/suggest-std-when-using-type.rs b/src/test/ui/suggestions/suggest-std-when-using-type.rs
new file mode 100644
index 00000000000..9ca68a635da
--- /dev/null
+++ b/src/test/ui/suggestions/suggest-std-when-using-type.rs
@@ -0,0 +1,7 @@
+fn main() {
+    let pi = f32::consts::PI; //~ ERROR ambiguous associated type
+    let bytes = "hello world".as_bytes();
+    let string = unsafe {
+        str::from_utf8(bytes) //~ ERROR no function or associated item named `from_utf8` found
+    };
+}
diff --git a/src/test/ui/suggestions/suggest-std-when-using-type.stderr b/src/test/ui/suggestions/suggest-std-when-using-type.stderr
new file mode 100644
index 00000000000..eecb4e60f9d
--- /dev/null
+++ b/src/test/ui/suggestions/suggest-std-when-using-type.stderr
@@ -0,0 +1,24 @@
+error[E0223]: ambiguous associated type
+  --> $DIR/suggest-std-when-using-type.rs:2:14
+   |
+LL |     let pi = f32::consts::PI;
+   |              ^^^^^^^^^^^^^^^
+help: you are looking for the module in `std`, not the primitive type
+   |
+LL |     let pi = std::f32::consts::PI;
+   |              ^^^^^^^^^^^^^^^^^^^^
+
+error[E0599]: no function or associated item named `from_utf8` found for type `str` in the current scope
+  --> $DIR/suggest-std-when-using-type.rs:5:14
+   |
+LL |         str::from_utf8(bytes)
+   |              ^^^^^^^^^ function or associated item not found in `str`
+help: you are looking for the module in `std`, not the primitive type
+   |
+LL |         std::str::from_utf8(bytes)
+   |         ^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
+Some errors have detailed explanations: E0223, E0599.
+For more information about an error, try `rustc --explain E0223`.
diff --git a/src/test/ui/target-feature-gate.rs b/src/test/ui/target-feature-gate.rs
index 84300301b76..8f3a52ba5d6 100644
--- a/src/test/ui/target-feature-gate.rs
+++ b/src/test/ui/target-feature-gate.rs
@@ -23,6 +23,7 @@
 // gate-test-adx_target_feature
 // gate-test-cmpxchg16b_target_feature
 // gate-test-movbe_target_feature
+// gate-test-rtm_target_feature
 // min-llvm-version 6.0
 
 #[target_feature(enable = "avx512bw")]
diff --git a/src/test/ui/target-feature-gate.stderr b/src/test/ui/target-feature-gate.stderr
index 155298e5062..e142125225f 100644
--- a/src/test/ui/target-feature-gate.stderr
+++ b/src/test/ui/target-feature-gate.stderr
@@ -1,5 +1,5 @@
 error[E0658]: the target feature `avx512bw` is currently unstable
-  --> $DIR/target-feature-gate.rs:28:18
+  --> $DIR/target-feature-gate.rs:29:18
    |
 LL | #[target_feature(enable = "avx512bw")]
    |                  ^^^^^^^^^^^^^^^^^^^
diff --git a/src/test/ui/try-block/try-block-bad-type.rs b/src/test/ui/try-block/try-block-bad-type.rs
index 0e297dd8ff1..4dfc8e6a2fc 100644
--- a/src/test/ui/try-block/try-block-bad-type.rs
+++ b/src/test/ui/try-block/try-block-bad-type.rs
@@ -4,7 +4,7 @@
 
 pub fn main() {
     let res: Result<u32, i32> = try {
-        Err("")?; //~ ERROR the trait bound `i32: std::convert::From<&str>` is not satisfied
+        Err("")?; //~ ERROR `?` couldn't convert the error
         5
     };
 
diff --git a/src/test/ui/try-block/try-block-bad-type.stderr b/src/test/ui/try-block/try-block-bad-type.stderr
index bb3306c12a4..7c7366df1dc 100644
--- a/src/test/ui/try-block/try-block-bad-type.stderr
+++ b/src/test/ui/try-block/try-block-bad-type.stderr
@@ -1,8 +1,8 @@
-error[E0277]: the trait bound `i32: std::convert::From<&str>` is not satisfied
-  --> $DIR/try-block-bad-type.rs:7:9
+error[E0277]: `?` couldn't convert the error to `i32`
+  --> $DIR/try-block-bad-type.rs:7:16
    |
 LL |         Err("")?;
-   |         ^^^^^^^^ the trait `std::convert::From<&str>` is not implemented for `i32`
+   |                ^ the trait `std::convert::From<&str>` is not implemented for `i32`
    |
    = help: the following implementations were found:
              <i32 as std::convert::From<bool>>
diff --git a/src/test/ui/try-on-option.rs b/src/test/ui/try-on-option.rs
index 9c8e8b33ad6..5d94cee8e37 100644
--- a/src/test/ui/try-on-option.rs
+++ b/src/test/ui/try-on-option.rs
@@ -4,12 +4,12 @@ fn main() {}
 
 fn foo() -> Result<u32, ()> {
     let x: Option<u32> = None;
-    x?; //~ the trait bound
+    x?; //~ ERROR `?` couldn't convert the error
     Ok(22)
 }
 
 fn bar() -> u32 {
     let x: Option<u32> = None;
-    x?; //~ the `?` operator
+    x?; //~ ERROR the `?` operator
     22
 }
diff --git a/src/test/ui/try-on-option.stderr b/src/test/ui/try-on-option.stderr
index 7dfa1a7d3a0..4465fbe14b7 100644
--- a/src/test/ui/try-on-option.stderr
+++ b/src/test/ui/try-on-option.stderr
@@ -1,8 +1,8 @@
-error[E0277]: the trait bound `(): std::convert::From<std::option::NoneError>` is not satisfied
-  --> $DIR/try-on-option.rs:7:5
+error[E0277]: `?` couldn't convert the error to `()`
+  --> $DIR/try-on-option.rs:7:6
    |
 LL |     x?;
-   |     ^^ the trait `std::convert::From<std::option::NoneError>` is not implemented for `()`
+   |      ^ the trait `std::convert::From<std::option::NoneError>` is not implemented for `()`
    |
    = note: required by `std::convert::From::from`
 
diff --git a/src/test/ui/variance/variance-regions-unused-direct.stderr b/src/test/ui/variance/variance-regions-unused-direct.stderr
index ab5dce03fa0..21ff475663c 100644
--- a/src/test/ui/variance/variance-regions-unused-direct.stderr
+++ b/src/test/ui/variance/variance-regions-unused-direct.stderr
@@ -2,7 +2,7 @@ error[E0392]: parameter `'a` is never used
   --> $DIR/variance-regions-unused-direct.rs:5:18
    |
 LL | struct Bivariant<'a>;
-   |                  ^^ unused type parameter
+   |                  ^^ unused parameter
    |
    = help: consider removing `'a` or using a marker such as `std::marker::PhantomData`
 
@@ -10,7 +10,7 @@ error[E0392]: parameter `'d` is never used
   --> $DIR/variance-regions-unused-direct.rs:7:19
    |
 LL | struct Struct<'a, 'd> {
-   |                   ^^ unused type parameter
+   |                   ^^ unused parameter
    |
    = help: consider removing `'d` or using a marker such as `std::marker::PhantomData`
 
diff --git a/src/test/ui/variance/variance-regions-unused-indirect.stderr b/src/test/ui/variance/variance-regions-unused-indirect.stderr
index 69631b4a504..fd66217f692 100644
--- a/src/test/ui/variance/variance-regions-unused-indirect.stderr
+++ b/src/test/ui/variance/variance-regions-unused-indirect.stderr
@@ -2,7 +2,7 @@ error[E0392]: parameter `'a` is never used
   --> $DIR/variance-regions-unused-indirect.rs:3:10
    |
 LL | enum Foo<'a> {
-   |          ^^ unused type parameter
+   |          ^^ unused parameter
    |
    = help: consider removing `'a` or using a marker such as `std::marker::PhantomData`
 
@@ -10,7 +10,7 @@ error[E0392]: parameter `'a` is never used
   --> $DIR/variance-regions-unused-indirect.rs:7:10
    |
 LL | enum Bar<'a> {
-   |          ^^ unused type parameter
+   |          ^^ unused parameter
    |
    = help: consider removing `'a` or using a marker such as `std::marker::PhantomData`
 
diff --git a/src/test/ui/variance/variance-unused-region-param.stderr b/src/test/ui/variance/variance-unused-region-param.stderr
index 6c103f168f4..a96b2338bf4 100644
--- a/src/test/ui/variance/variance-unused-region-param.stderr
+++ b/src/test/ui/variance/variance-unused-region-param.stderr
@@ -2,7 +2,7 @@ error[E0392]: parameter `'a` is never used
   --> $DIR/variance-unused-region-param.rs:3:19
    |
 LL | struct SomeStruct<'a> { x: u32 }
-   |                   ^^ unused type parameter
+   |                   ^^ unused parameter
    |
    = help: consider removing `'a` or using a marker such as `std::marker::PhantomData`
 
@@ -10,7 +10,7 @@ error[E0392]: parameter `'a` is never used
   --> $DIR/variance-unused-region-param.rs:4:15
    |
 LL | enum SomeEnum<'a> { Nothing }
-   |               ^^ unused type parameter
+   |               ^^ unused parameter
    |
    = help: consider removing `'a` or using a marker such as `std::marker::PhantomData`
 
diff --git a/src/test/ui/variance/variance-unused-type-param.stderr b/src/test/ui/variance/variance-unused-type-param.stderr
index 34c430f5498..883db462986 100644
--- a/src/test/ui/variance/variance-unused-type-param.stderr
+++ b/src/test/ui/variance/variance-unused-type-param.stderr
@@ -2,7 +2,7 @@ error[E0392]: parameter `A` is never used
   --> $DIR/variance-unused-type-param.rs:6:19
    |
 LL | struct SomeStruct<A> { x: u32 }
-   |                   ^ unused type parameter
+   |                   ^ unused parameter
    |
    = help: consider removing `A` or using a marker such as `std::marker::PhantomData`
 
@@ -10,7 +10,7 @@ error[E0392]: parameter `A` is never used
   --> $DIR/variance-unused-type-param.rs:9:15
    |
 LL | enum SomeEnum<A> { Nothing }
-   |               ^ unused type parameter
+   |               ^ unused parameter
    |
    = help: consider removing `A` or using a marker such as `std::marker::PhantomData`
 
@@ -18,7 +18,7 @@ error[E0392]: parameter `T` is never used
   --> $DIR/variance-unused-type-param.rs:13:15
    |
 LL | enum ListCell<T> {
-   |               ^ unused type parameter
+   |               ^ unused parameter
    |
    = help: consider removing `T` or using a marker such as `std::marker::PhantomData`
 
diff --git a/src/tools/miri b/src/tools/miri
-Subproject ae9e9cb47c7b79d8bb29fab90929bd9b3606348
+Subproject 7d7cf4d42e41437f5a5b04a6b8dd567f330ae6e
diff --git a/src/tools/rustfmt b/src/tools/rustfmt
-Subproject 09940a70d0a9fabfb4985426aa7d66ca1875c65
+Subproject b860feaffccb81199c045e9b1511c2e25825dc0