From f817d1960a4d495a20689bc7ed22847561afd216 Mon Sep 17 00:00:00 2001
From: Daiki Mizukami <mizukami1113@gmail.com>
Date: Tue, 10 Apr 2018 17:13:32 +0900
Subject: [PATCH 01/21] std: Mark `ptr::Unique` with `#[doc(hidden)]`

---
 src/libcore/ptr.rs | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs
index 5a54de06b5ef2..a1307a6d5996e 100644
--- a/src/libcore/ptr.rs
+++ b/src/libcore/ptr.rs
@@ -2511,6 +2511,7 @@ impl<T: ?Sized> PartialOrd for *mut T {
            reason = "use NonNull instead and consider PhantomData<T> \
                      (if you also use #[may_dangle]), Send, and/or Sync")]
 #[allow(deprecated)]
+#[doc(hidden)]
 pub struct Unique<T: ?Sized> {
     pointer: NonZero<*const T>,
     // NOTE: this marker has no consequences for variance, but is necessary

From 54d6bcbf70112ceb0efa4579ab9f6d5673588889 Mon Sep 17 00:00:00 2001
From: Daiki Mizukami <mizukami1113@gmail.com>
Date: Wed, 11 Apr 2018 18:24:47 +0900
Subject: [PATCH 02/21] alloc: Mark `Box::into_unique` with `#[doc(hidden)]`

---
 src/liballoc/boxed.rs | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs
index 71b53cc88e54d..bf7921ea1a2b5 100644
--- a/src/liballoc/boxed.rs
+++ b/src/liballoc/boxed.rs
@@ -184,6 +184,7 @@ impl<T: ?Sized> Box<T> {
 
     #[unstable(feature = "ptr_internals", issue = "0", reason = "use into_raw_non_null instead")]
     #[inline]
+    #[doc(hidden)]
     pub fn into_unique(b: Box<T>) -> Unique<T> {
         let unique = b.0;
         mem::forget(b);

From d2dc21df02a6f24b0c5629d3c3ebc7c9b85d20da Mon Sep 17 00:00:00 2001
From: bobtwinkles <srkoser+GitHub@gmail.com>
Date: Sat, 21 Apr 2018 18:00:09 -0400
Subject: [PATCH 03/21] Add documentation for SyntaxContext::remove_mark

---
 src/libsyntax_pos/hygiene.rs | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/src/libsyntax_pos/hygiene.rs b/src/libsyntax_pos/hygiene.rs
index 5e96b5ce6733c..6eb662744c302 100644
--- a/src/libsyntax_pos/hygiene.rs
+++ b/src/libsyntax_pos/hygiene.rs
@@ -238,6 +238,22 @@ impl SyntaxContext {
         })
     }
 
+    /// Pulls a single mark off of the syntax context. This effectively moves the
+    /// context up one macro definition level. That is, if we have a nested macro
+    /// definition as follows:
+    ///
+    /// ```rust
+    /// macro_rules! f {
+    ///    macro_rules! g {
+    ///        ...
+    ///    }
+    /// }
+    /// ```
+    ///
+    /// and we have a SyntaxContext that is referring to something declared by an invocation
+    /// of g (call it g1), calling remove_mark will result in the SyntaxContext for the
+    /// invocation of f that created g1.
+    /// Returns the mark that was removed.
     pub fn remove_mark(&mut self) -> Mark {
         HygieneData::with(|data| {
             let outer_mark = data.syntax_contexts[self.0 as usize].outer_mark;

From 263b36b071ba8b52cd4f79ca36494b05d4762430 Mon Sep 17 00:00:00 2001
From: bobtwinkles <srkoser+GitHub@gmail.com>
Date: Sat, 21 Apr 2018 18:15:54 -0400
Subject: [PATCH 04/21] Implement parent() on `syntax_pos::Span`

... and reimplement proc_macro::Span::parent using it. This function turns out
to be useful in the compiler as well
---
 src/libproc_macro/lib.rs | 2 +-
 src/libsyntax_pos/lib.rs | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/libproc_macro/lib.rs b/src/libproc_macro/lib.rs
index e171216523a1e..4d24353a383d1 100644
--- a/src/libproc_macro/lib.rs
+++ b/src/libproc_macro/lib.rs
@@ -270,7 +270,7 @@ impl Span {
     /// `self` was generated from, if any.
     #[unstable(feature = "proc_macro", issue = "38356")]
     pub fn parent(&self) -> Option<Span> {
-        self.0.ctxt().outer().expn_info().map(|i| Span(i.call_site))
+        self.0.parent().map(|x| { Span(x) })
     }
 
     /// The span for the origin source code that `self` was generated from. If
diff --git a/src/libsyntax_pos/lib.rs b/src/libsyntax_pos/lib.rs
index 9a7d1fd8ee6cb..19f52d83a0176 100644
--- a/src/libsyntax_pos/lib.rs
+++ b/src/libsyntax_pos/lib.rs
@@ -291,6 +291,12 @@ impl Span {
         self.ctxt().outer().expn_info().map(|info| info.call_site.source_callsite()).unwrap_or(self)
     }
 
+    /// The `Span for the tokens in the previous macro expansion from which `self` was generated,
+    /// if any
+    pub fn parent(self) -> Option<Span> {
+        self.ctxt().outer().expn_info().map(|i| i.call_site)
+    }
+
     /// Return the source callee.
     ///
     /// Returns None if the supplied span has no expansion trace,

From 498dbe44537998bd4bba6c28232a22e9243b9c67 Mon Sep 17 00:00:00 2001
From: bobtwinkles <srkoser+GitHub@gmail.com>
Date: Sat, 21 Apr 2018 18:20:17 -0400
Subject: [PATCH 05/21] Implement a least upper bound for marks.

This is useful when trying to compute when something is lexically before
something else, but they aren't necessarily in the same SyntaxContext
---
 src/libsyntax_pos/hygiene.rs | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/src/libsyntax_pos/hygiene.rs b/src/libsyntax_pos/hygiene.rs
index 6eb662744c302..8e9564d0ac191 100644
--- a/src/libsyntax_pos/hygiene.rs
+++ b/src/libsyntax_pos/hygiene.rs
@@ -21,6 +21,7 @@ use symbol::{Ident, Symbol};
 
 use serialize::{Encodable, Decodable, Encoder, Decoder};
 use std::collections::HashMap;
+use rustc_data_structures::fx::FxHashSet;
 use std::fmt;
 
 /// A SyntaxContext represents a chain of macro expansions (represented by marks).
@@ -117,6 +118,32 @@ impl Mark {
             true
         })
     }
+
+    /// Computes a mark such that both input marks are descendants of (or equal to) the returned
+    /// mark. That is, the following holds:
+    ///
+    /// ```rust
+    /// let lub = lub(a, b);
+    /// assert!(a.is_descendant_of(lub))
+    /// assert!(b.is_descendant_of(lub))
+    /// ```
+    pub fn lub(mut a: Mark, mut b: Mark) -> Mark {
+        HygieneData::with(|data| {
+            // Compute the path from a to the root
+            let mut a_path = FxHashSet::<Mark>();
+            while a != Mark::root() {
+                a_path.insert(a);
+                a = data.marks[a.0 as usize].parent;
+            }
+
+            // While the path from b to the root hasn't intersected, move up the tree
+            while !a_path.contains(&b) {
+                b =  data.marks[b.0 as usize].parent;
+            }
+
+            b
+        })
+    }
 }
 
 pub struct HygieneData {

From a2a9cc68fe44a4a667dddd01c17b3dcceefb5a5a Mon Sep 17 00:00:00 2001
From: Alex Crichton <alex@alexcrichton.com>
Date: Thu, 26 Apr 2018 06:56:37 -0700
Subject: [PATCH 06/21] rustc: Disable threads in LLD for wasm

Upstream bug reports (rustwasm/wasm-bindgen#119) show that this may be the
culprit of odd crashes/hangs. The linker is a tiny fraction of build time anyway
right now so let's disable it and figure out how to possibly reenable it later
if necessary.
---
 src/librustc_trans/back/linker.rs | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/librustc_trans/back/linker.rs b/src/librustc_trans/back/linker.rs
index e001e809ee5f0..883625a2dd7c9 100644
--- a/src/librustc_trans/back/linker.rs
+++ b/src/librustc_trans/back/linker.rs
@@ -959,7 +959,11 @@ impl Linker for WasmLd {
     }
 
     fn finalize(&mut self) -> Command {
-        self.cmd.arg("--threads");
+        // There have been reports in the wild (rustwasm/wasm-bindgen#119) of
+        // using threads causing weird hangs and bugs. Disable it entirely as
+        // this isn't yet the bottleneck of compilation at all anyway.
+        self.cmd.arg("--no-threads");
+
         self.cmd.arg("-z").arg("stack-size=1048576");
 
         // FIXME we probably shouldn't pass this but instead pass an explicit

From d92d1935cb01cfa469a725f041e4c1d8a2ee9564 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Esteban=20K=C3=BCber?= <esteban@kuber.com.ar>
Date: Thu, 26 Apr 2018 14:19:21 -0700
Subject: [PATCH 07/21] Don't ICE on tuple struct ctor with incorrect arg count

---
 src/librustc/traits/error_reporting.rs          |  6 ++++++
 .../ui/mismatched_types/closure-arg-count.rs    |  6 ++++++
 .../mismatched_types/closure-arg-count.stderr   | 17 ++++++++++++++++-
 3 files changed, 28 insertions(+), 1 deletion(-)

diff --git a/src/librustc/traits/error_reporting.rs b/src/librustc/traits/error_reporting.rs
index 33abc0c7e15aa..3eb45439001cd 100644
--- a/src/librustc/traits/error_reporting.rs
+++ b/src/librustc/traits/error_reporting.rs
@@ -976,6 +976,12 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
                      ArgKind::Arg(format!("{}", field.name), "_".to_string())
                  }).collect::<Vec<_>>())
             }
+            hir::map::NodeStructCtor(ref variant_data) => {
+                (self.tcx.sess.codemap().def_span(self.tcx.hir.span(variant_data.id())),
+                 variant_data.fields()
+                    .iter().map(|_| ArgKind::Arg("_".to_owned(), "_".to_owned()))
+                    .collect())
+            }
             _ => panic!("non-FnLike node found: {:?}", node),
         }
     }
diff --git a/src/test/ui/mismatched_types/closure-arg-count.rs b/src/test/ui/mismatched_types/closure-arg-count.rs
index 34232e81cbdee..9eb11148a8bce 100644
--- a/src/test/ui/mismatched_types/closure-arg-count.rs
+++ b/src/test/ui/mismatched_types/closure-arg-count.rs
@@ -39,7 +39,13 @@ fn main() {
 
     let _it = vec![1, 2, 3].into_iter().map(usize::checked_add);
     //~^ ERROR function is expected to take
+
+    call(Foo);
+    //~^ ERROR function is expected to take
 }
 
 fn foo() {}
 fn qux(x: usize, y: usize) {}
+
+fn call<F, R>(_: F) where F: FnOnce() -> R {}
+struct Foo(u8);
diff --git a/src/test/ui/mismatched_types/closure-arg-count.stderr b/src/test/ui/mismatched_types/closure-arg-count.stderr
index 6451c0d06fa20..6270e79449876 100644
--- a/src/test/ui/mismatched_types/closure-arg-count.stderr
+++ b/src/test/ui/mismatched_types/closure-arg-count.stderr
@@ -116,6 +116,21 @@ error[E0593]: function is expected to take 1 argument, but it takes 2 arguments
 LL |     let _it = vec![1, 2, 3].into_iter().map(usize::checked_add);
    |                                         ^^^ expected function that takes 1 argument
 
-error: aborting due to 12 previous errors
+error[E0593]: function is expected to take 0 arguments, but it takes 1 argument
+  --> $DIR/closure-arg-count.rs:43:5
+   |
+LL |     call(Foo);
+   |     ^^^^ expected function that takes 0 arguments
+...
+LL | struct Foo(u8);
+   | --------------- takes 1 argument
+   |
+note: required by `call`
+  --> $DIR/closure-arg-count.rs:50:1
+   |
+LL | fn call<F, R>(_: F) where F: FnOnce() -> R {}
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 13 previous errors
 
 For more information about this error, try `rustc --explain E0593`.

From 73e0c1e968caaf7b70d659e58c0a40782c60f8da Mon Sep 17 00:00:00 2001
From: bobtwinkles <srkoser+GitHub@gmail.com>
Date: Thu, 26 Apr 2018 18:28:34 -0400
Subject: [PATCH 08/21] Fix review nits

---
 src/libproc_macro/lib.rs     |  2 +-
 src/libsyntax_pos/hygiene.rs | 10 +++++-----
 src/libsyntax_pos/lib.rs     |  2 +-
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/libproc_macro/lib.rs b/src/libproc_macro/lib.rs
index 4d24353a383d1..f51dbc3772f06 100644
--- a/src/libproc_macro/lib.rs
+++ b/src/libproc_macro/lib.rs
@@ -270,7 +270,7 @@ impl Span {
     /// `self` was generated from, if any.
     #[unstable(feature = "proc_macro", issue = "38356")]
     pub fn parent(&self) -> Option<Span> {
-        self.0.parent().map(|x| { Span(x) })
+        self.0.parent().map(Span)
     }
 
     /// The span for the origin source code that `self` was generated from. If
diff --git a/src/libsyntax_pos/hygiene.rs b/src/libsyntax_pos/hygiene.rs
index 8e9564d0ac191..658408519b9c7 100644
--- a/src/libsyntax_pos/hygiene.rs
+++ b/src/libsyntax_pos/hygiene.rs
@@ -123,11 +123,11 @@ impl Mark {
     /// mark. That is, the following holds:
     ///
     /// ```rust
-    /// let lub = lub(a, b);
-    /// assert!(a.is_descendant_of(lub))
-    /// assert!(b.is_descendant_of(lub))
+    /// let la = least_ancestor(a, b);
+    /// assert!(a.is_descendant_of(la))
+    /// assert!(b.is_descendant_of(la))
     /// ```
-    pub fn lub(mut a: Mark, mut b: Mark) -> Mark {
+    pub fn least_ancestor(mut a: Mark, mut b: Mark) -> Mark {
         HygieneData::with(|data| {
             // Compute the path from a to the root
             let mut a_path = FxHashSet::<Mark>();
@@ -138,7 +138,7 @@ impl Mark {
 
             // While the path from b to the root hasn't intersected, move up the tree
             while !a_path.contains(&b) {
-                b =  data.marks[b.0 as usize].parent;
+                b = data.marks[b.0 as usize].parent;
             }
 
             b
diff --git a/src/libsyntax_pos/lib.rs b/src/libsyntax_pos/lib.rs
index 19f52d83a0176..8d37b4aa3968f 100644
--- a/src/libsyntax_pos/lib.rs
+++ b/src/libsyntax_pos/lib.rs
@@ -291,7 +291,7 @@ impl Span {
         self.ctxt().outer().expn_info().map(|info| info.call_site.source_callsite()).unwrap_or(self)
     }
 
-    /// The `Span for the tokens in the previous macro expansion from which `self` was generated,
+    /// The `Span` for the tokens in the previous macro expansion from which `self` was generated,
     /// if any
     pub fn parent(self) -> Option<Span> {
         self.ctxt().outer().expn_info().map(|i| i.call_site)

From 20ad427af014aa6f8734629baa922c52f1ee8b77 Mon Sep 17 00:00:00 2001
From: Alex Crichton <alex@alexcrichton.com>
Date: Thu, 26 Apr 2018 17:09:08 -0700
Subject: [PATCH 09/21] rustc: Emit `uwtable` for allocator shims

This commit emits the `uwtable` attribute to LLVM for platforms that require it
for the allocator shims that we generate to ensure that they can hopefully get
unwound past. This is a stab in the dark at helping
https://bugzilla.mozilla.org/show_bug.cgi?id=1456150 along.
---
 src/librustc_trans/allocator.rs | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/librustc_trans/allocator.rs b/src/librustc_trans/allocator.rs
index ffebb959ebfde..871fe98ec0187 100644
--- a/src/librustc_trans/allocator.rs
+++ b/src/librustc_trans/allocator.rs
@@ -11,6 +11,7 @@
 use std::ffi::CString;
 use std::ptr;
 
+use attributes;
 use libc::c_uint;
 use rustc::middle::allocator::AllocatorKind;
 use rustc::ty::TyCtxt;
@@ -67,6 +68,9 @@ pub(crate) unsafe fn trans(tcx: TyCtxt, mods: &ModuleLlvm, kind: AllocatorKind)
         if tcx.sess.target.target.options.default_hidden_visibility {
             llvm::LLVMRustSetVisibility(llfn, llvm::Visibility::Hidden);
         }
+       if tcx.sess.target.target.options.requires_uwtable {
+           attributes::emit_uwtable(llfn, true);
+       }
 
         let callee = CString::new(kind.fn_name(method.name)).unwrap();
         let callee = llvm::LLVMRustGetOrInsertFunction(llmod,

From 3565556d8bb7c6a662353826cf16df166d11bce6 Mon Sep 17 00:00:00 2001
From: Alex Crichton <alex@alexcrichton.com>
Date: Thu, 26 Apr 2018 20:50:06 -0700
Subject: [PATCH 10/21] Update `parking_lot` dependencies

This commit updates `parking_lot` to pull in Amanieu/parking_lot#70 and...

Closes #49438
---
 src/Cargo.lock | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/Cargo.lock b/src/Cargo.lock
index e14b9da971301..a6f78a7e6b442 100644
--- a/src/Cargo.lock
+++ b/src/Cargo.lock
@@ -1325,16 +1325,16 @@ dependencies = [
 
 [[package]]
 name = "parking_lot"
-version = "0.5.4"
+version = "0.5.5"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
- "parking_lot_core 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)",
+ "parking_lot_core 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
 name = "parking_lot_core"
-version = "0.2.13"
+version = "0.2.14"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1755,8 +1755,8 @@ dependencies = [
  "cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
  "ena 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)",
  "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "parking_lot 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)",
- "parking_lot_core 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)",
+ "parking_lot 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "parking_lot_core 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
  "rustc-ap-serialize 110.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "stable_deref_trait 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1896,8 +1896,8 @@ dependencies = [
  "cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
  "ena 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)",
  "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "parking_lot 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)",
- "parking_lot_core 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)",
+ "parking_lot 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "parking_lot_core 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
  "rustc_cratesio_shim 0.0.0",
  "serialize 0.0.0",
  "stable_deref_trait 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -3096,8 +3096,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 "checksum openssl-sys 0.9.28 (registry+https://github.com/rust-lang/crates.io-index)" = "0bbd90640b148b46305c1691eed6039b5c8509bed16991e3562a01eeb76902a3"
 "checksum ordermap 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "a86ed3f5f244b372d6b1a00b72ef7f8876d0bc6a78a4c9985c53614041512063"
 "checksum owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cdf84f41639e037b484f93433aa3897863b561ed65c6e59c7073d7c561710f37"
-"checksum parking_lot 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)" = "9fd9d732f2de194336fb02fe11f9eed13d9e76f13f4315b4d88a14ca411750cd"
-"checksum parking_lot_core 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "538ef00b7317875071d5e00f603f24d16f0b474c1a5fc0ccb8b454ca72eafa79"
+"checksum parking_lot 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "d4d05f1349491390b1730afba60bb20d55761bef489a954546b58b4b34e1e2ac"
+"checksum parking_lot_core 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "4db1a8ccf734a7bce794cc19b3df06ed87ab2f3907036b693c68f56b4d4537fa"
 "checksum percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831"
 "checksum pest 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0fce5d8b5cc33983fc74f78ad552b5522ab41442c4ca91606e4236eb4b5ceefc"
 "checksum pest_derive 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "ab94faafeb93f4c5e3ce81ca0e5a779529a602ad5d09ae6d21996bfb8b6a52bf"

From 5f2c111165371b1e59fec9cd90e364ccf08b68ef Mon Sep 17 00:00:00 2001
From: Amanieu d'Antras <amanieu@gmail.com>
Date: Fri, 27 Apr 2018 07:20:46 +0200
Subject: [PATCH 11/21] Allow #[inline] on closures

Fixes #49632
---
 src/librustc/hir/check_attr.rs                | 15 +++++++----
 src/test/compile-fail/attr-usage-inline.rs    |  2 +-
 src/test/compile-fail/issue-31769.rs          |  2 +-
 src/test/compile-fail/issue-43988.rs          |  6 ++---
 src/test/run-pass/issue-49632.rs              | 17 ++++++++++++
 src/test/ui/error-codes/E0518.stderr          |  8 +++---
 .../issue-43106-gating-of-inline.rs           | 10 +++----
 .../issue-43106-gating-of-inline.stderr       | 26 +++++++++----------
 8 files changed, 54 insertions(+), 32 deletions(-)
 create mode 100644 src/test/run-pass/issue-49632.rs

diff --git a/src/librustc/hir/check_attr.rs b/src/librustc/hir/check_attr.rs
index 956cd17f38f21..19f8d15662d84 100644
--- a/src/librustc/hir/check_attr.rs
+++ b/src/librustc/hir/check_attr.rs
@@ -30,6 +30,7 @@ enum Target {
     ForeignMod,
     Expression,
     Statement,
+    Closure,
     Other,
 }
 
@@ -103,14 +104,14 @@ impl<'a, 'tcx> CheckAttrVisitor<'a, 'tcx> {
         self.check_repr(item, target);
     }
 
-    /// Check if an `#[inline]` is applied to a function.
+    /// Check if an `#[inline]` is applied to a function or a closure.
     fn check_inline(&self, attr: &hir::Attribute, span: &Span, target: Target) {
-        if target != Target::Fn {
+        if target != Target::Fn && target != Target::Closure {
             struct_span_err!(self.tcx.sess,
                              attr.span,
                              E0518,
-                             "attribute should be applied to function")
-                .span_label(*span, "not a function")
+                             "attribute should be applied to function or closure")
+                .span_label(*span, "not a function or closure")
                 .emit();
         }
     }
@@ -286,9 +287,13 @@ impl<'a, 'tcx> CheckAttrVisitor<'a, 'tcx> {
     }
 
     fn check_expr_attributes(&self, expr: &hir::Expr) {
+        let target = match expr.node {
+            hir::ExprClosure(..) => Target::Closure,
+            _ => Target::Expression,
+        };
         for attr in expr.attrs.iter() {
             if attr.check_name("inline") {
-                self.check_inline(attr, &expr.span, Target::Expression);
+                self.check_inline(attr, &expr.span, target);
             }
             if attr.check_name("repr") {
                 self.emit_repr_error(
diff --git a/src/test/compile-fail/attr-usage-inline.rs b/src/test/compile-fail/attr-usage-inline.rs
index c6b9b016331aa..250905dbdcd8c 100644
--- a/src/test/compile-fail/attr-usage-inline.rs
+++ b/src/test/compile-fail/attr-usage-inline.rs
@@ -13,7 +13,7 @@
 #[inline]
 fn f() {}
 
-#[inline] //~ ERROR: attribute should be applied to function
+#[inline] //~ ERROR: attribute should be applied to function or closure
 struct S;
 
 fn main() {}
diff --git a/src/test/compile-fail/issue-31769.rs b/src/test/compile-fail/issue-31769.rs
index 7f73d9076ec99..2bd45deeab4df 100644
--- a/src/test/compile-fail/issue-31769.rs
+++ b/src/test/compile-fail/issue-31769.rs
@@ -9,6 +9,6 @@
 // except according to those terms.
 
 fn main() {
-    #[inline] struct Foo;  //~ ERROR attribute should be applied to function
+    #[inline] struct Foo;  //~ ERROR attribute should be applied to function or closure
     #[repr(C)] fn foo() {} //~ ERROR attribute should be applied to struct, enum or union
 }
diff --git a/src/test/compile-fail/issue-43988.rs b/src/test/compile-fail/issue-43988.rs
index ff1fdaef416c8..0dfa9f6f0d341 100644
--- a/src/test/compile-fail/issue-43988.rs
+++ b/src/test/compile-fail/issue-43988.rs
@@ -14,12 +14,12 @@ fn main() {
 
     #[inline]
     let _a = 4;
-    //~^^ ERROR attribute should be applied to function
+    //~^^ ERROR attribute should be applied to function or closure
 
 
     #[inline(XYZ)]
     let _b = 4;
-    //~^^ ERROR attribute should be applied to function
+    //~^^ ERROR attribute should be applied to function or closure
 
     #[repr(nothing)]
     let _x = 0;
@@ -40,7 +40,7 @@ fn main() {
 
     #[inline(ABC)]
     foo();
-    //~^^ ERROR attribute should be applied to function
+    //~^^ ERROR attribute should be applied to function or closure
 
     let _z = #[repr] 1;
     //~^ ERROR attribute should not be applied to an expression
diff --git a/src/test/run-pass/issue-49632.rs b/src/test/run-pass/issue-49632.rs
new file mode 100644
index 0000000000000..8cbb7d21af708
--- /dev/null
+++ b/src/test/run-pass/issue-49632.rs
@@ -0,0 +1,17 @@
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(stmt_expr_attributes)]
+
+pub fn main() {
+    let _x = #[inline(always)] || {};
+    let _y = #[inline(never)] || {};
+    let _z = #[inline] || {};
+}
diff --git a/src/test/ui/error-codes/E0518.stderr b/src/test/ui/error-codes/E0518.stderr
index d8feec9914068..27d5d3645fdfc 100644
--- a/src/test/ui/error-codes/E0518.stderr
+++ b/src/test/ui/error-codes/E0518.stderr
@@ -1,19 +1,19 @@
-error[E0518]: attribute should be applied to function
+error[E0518]: attribute should be applied to function or closure
   --> $DIR/E0518.rs:11:1
    |
 LL | #[inline(always)] //~ ERROR: E0518
    | ^^^^^^^^^^^^^^^^^
 LL | struct Foo;
-   | ----------- not a function
+   | ----------- not a function or closure
 
-error[E0518]: attribute should be applied to function
+error[E0518]: attribute should be applied to function or closure
   --> $DIR/E0518.rs:14:1
    |
 LL |   #[inline(never)] //~ ERROR: E0518
    |   ^^^^^^^^^^^^^^^^
 LL | / impl Foo {
 LL | | }
-   | |_- not a function
+   | |_- not a function or closure
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-inline.rs b/src/test/ui/feature-gate/issue-43106-gating-of-inline.rs
index 410f960e655fb..b03faad988ebc 100644
--- a/src/test/ui/feature-gate/issue-43106-gating-of-inline.rs
+++ b/src/test/ui/feature-gate/issue-43106-gating-of-inline.rs
@@ -19,21 +19,21 @@
 #![inline                     = "2100"]
 
 #[inline = "2100"]
-//~^ ERROR attribute should be applied to function
+//~^ ERROR attribute should be applied to function or closure
 mod inline {
     mod inner { #![inline="2100"] }
-    //~^ ERROR attribute should be applied to function
+    //~^ ERROR attribute should be applied to function or closure
 
     #[inline = "2100"] fn f() { }
 
     #[inline = "2100"] struct S;
-    //~^ ERROR attribute should be applied to function
+    //~^ ERROR attribute should be applied to function or closure
 
     #[inline = "2100"] type T = S;
-    //~^ ERROR attribute should be applied to function
+    //~^ ERROR attribute should be applied to function or closure
 
     #[inline = "2100"] impl S { }
-    //~^ ERROR attribute should be applied to function
+    //~^ ERROR attribute should be applied to function or closure
 }
 
 fn main() {}
diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-inline.stderr b/src/test/ui/feature-gate/issue-43106-gating-of-inline.stderr
index d67d78e31a9d5..4d63c3f50125d 100644
--- a/src/test/ui/feature-gate/issue-43106-gating-of-inline.stderr
+++ b/src/test/ui/feature-gate/issue-43106-gating-of-inline.stderr
@@ -1,41 +1,41 @@
-error[E0518]: attribute should be applied to function
+error[E0518]: attribute should be applied to function or closure
   --> $DIR/issue-43106-gating-of-inline.rs:21:1
    |
 LL |   #[inline = "2100"]
    |   ^^^^^^^^^^^^^^^^^^
-LL |   //~^ ERROR attribute should be applied to function
+LL |   //~^ ERROR attribute should be applied to function or closure
 LL | / mod inline {
 LL | |     mod inner { #![inline="2100"] }
-LL | |     //~^ ERROR attribute should be applied to function
+LL | |     //~^ ERROR attribute should be applied to function or closure
 LL | |
 ...  |
-LL | |     //~^ ERROR attribute should be applied to function
+LL | |     //~^ ERROR attribute should be applied to function or closure
 LL | | }
-   | |_- not a function
+   | |_- not a function or closure
 
-error[E0518]: attribute should be applied to function
+error[E0518]: attribute should be applied to function or closure
   --> $DIR/issue-43106-gating-of-inline.rs:24:17
    |
 LL |     mod inner { #![inline="2100"] }
-   |     ------------^^^^^^^^^^^^^^^^^-- not a function
+   |     ------------^^^^^^^^^^^^^^^^^-- not a function or closure
 
-error[E0518]: attribute should be applied to function
+error[E0518]: attribute should be applied to function or closure
   --> $DIR/issue-43106-gating-of-inline.rs:29:5
    |
 LL |     #[inline = "2100"] struct S;
-   |     ^^^^^^^^^^^^^^^^^^ --------- not a function
+   |     ^^^^^^^^^^^^^^^^^^ --------- not a function or closure
 
-error[E0518]: attribute should be applied to function
+error[E0518]: attribute should be applied to function or closure
   --> $DIR/issue-43106-gating-of-inline.rs:32:5
    |
 LL |     #[inline = "2100"] type T = S;
-   |     ^^^^^^^^^^^^^^^^^^ ----------- not a function
+   |     ^^^^^^^^^^^^^^^^^^ ----------- not a function or closure
 
-error[E0518]: attribute should be applied to function
+error[E0518]: attribute should be applied to function or closure
   --> $DIR/issue-43106-gating-of-inline.rs:35:5
    |
 LL |     #[inline = "2100"] impl S { }
-   |     ^^^^^^^^^^^^^^^^^^ ---------- not a function
+   |     ^^^^^^^^^^^^^^^^^^ ---------- not a function or closure
 
 error: aborting due to 5 previous errors
 

From 199ee327739b12c67adef326d68164bfbf5e29c9 Mon Sep 17 00:00:00 2001
From: Christian Poveda <christianpoveda@protonmail.com>
Date: Thu, 12 Apr 2018 16:53:28 -0500
Subject: [PATCH 12/21] stop requiring the feature-gate to use dyn_trait

---
 src/libsyntax/feature_gate.rs             |  9 ++-------
 src/test/ui/feature-gate-dyn-trait.stderr | 11 -----------
 2 files changed, 2 insertions(+), 18 deletions(-)
 delete mode 100644 src/test/ui/feature-gate-dyn-trait.stderr

diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs
index 120dff2dbb926..c4a0ec259b433 100644
--- a/src/libsyntax/feature_gate.rs
+++ b/src/libsyntax/feature_gate.rs
@@ -375,9 +375,6 @@ declare_features! (
     // Future-proofing enums/structs with #[non_exhaustive] attribute (RFC 2008)
     (active, non_exhaustive, "1.22.0", Some(44109), None),
 
-    // Trait object syntax with `dyn` prefix
-    (active, dyn_trait, "1.22.0", Some(44662), Some(Edition::Edition2018)),
-
     // `crate` as visibility modifier, synonymous to `pub(crate)`
     (active, crate_visibility_modifier, "1.23.0", Some(45388), Some(Edition::Edition2018)),
 
@@ -592,6 +589,8 @@ declare_features! (
     (accepted, cfg_target_feature, "1.27.0", Some(29717), None),
     // Allows #[target_feature(...)]
     (accepted, target_feature, "1.27.0", None, None),
+    // Trait object syntax with `dyn` prefix
+    (accepted, dyn_trait, "1.22.0", Some(44662), None),
 );
 
 // If you change this, please modify src/doc/unstable-book as well. You must
@@ -1657,10 +1656,6 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
                 gate_feature_post!(&self, never_type, ty.span,
                                    "The `!` type is experimental");
             }
-            ast::TyKind::TraitObject(_, ast::TraitObjectSyntax::Dyn) => {
-                gate_feature_post!(&self, dyn_trait, ty.span,
-                                   "`dyn Trait` syntax is unstable");
-            }
             _ => {}
         }
         visit::walk_ty(self, ty)
diff --git a/src/test/ui/feature-gate-dyn-trait.stderr b/src/test/ui/feature-gate-dyn-trait.stderr
deleted file mode 100644
index 6e6bdf1cbf0de..0000000000000
--- a/src/test/ui/feature-gate-dyn-trait.stderr
+++ /dev/null
@@ -1,11 +0,0 @@
-error[E0658]: `dyn Trait` syntax is unstable (see issue #44662)
-  --> $DIR/feature-gate-dyn-trait.rs:12:14
-   |
-LL | type A = Box<dyn Trait>; //~ ERROR `dyn Trait` syntax is unstable
-   |              ^^^^^^^^^
-   |
-   = help: add #![feature(dyn_trait)] to the crate attributes to enable
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0658`.

From c86f1c8cc396df443e0933278c441e36302047b1 Mon Sep 17 00:00:00 2001
From: Christian Poveda <christianpoveda@protonmail.com>
Date: Thu, 12 Apr 2018 16:54:17 -0500
Subject: [PATCH 13/21] removed dyn_trait feature from tests

---
 src/test/compile-fail/impl-trait/where-allowed.rs             | 4 +++-
 src/test/compile-fail/mir_check_cast_unsize.rs                | 1 -
 src/test/compile-fail/trait-bounds-not-on-struct.rs           | 1 -
 src/test/run-pass/dyn-trait.rs                                | 2 --
 src/test/ui/impl_trait_projections.rs                         | 2 ++
 src/test/ui/nll/ty-outlives/projection-no-regions-closure.rs  | 1 -
 src/test/ui/nll/ty-outlives/projection-no-regions-fn.rs       | 1 -
 src/test/ui/nll/ty-outlives/projection-one-region-closure.rs  | 1 -
 .../ty-outlives/projection-one-region-trait-bound-closure.rs  | 1 -
 .../projection-one-region-trait-bound-static-closure.rs       | 1 -
 .../ty-outlives/projection-two-region-trait-bound-closure.rs  | 1 -
 .../ty-outlives/ty-param-closure-approximate-lower-bound.rs   | 1 -
 .../ty-outlives/ty-param-closure-outlives-from-return-type.rs | 1 -
 .../ty-param-closure-outlives-from-where-clause.rs            | 1 -
 src/test/ui/nll/ty-outlives/ty-param-fn-body-nll-feature.rs   | 1 -
 src/test/ui/nll/ty-outlives/ty-param-fn-body.rs               | 1 -
 src/test/ui/nll/ty-outlives/ty-param-fn.rs                    | 1 -
 17 files changed, 5 insertions(+), 17 deletions(-)

diff --git a/src/test/compile-fail/impl-trait/where-allowed.rs b/src/test/compile-fail/impl-trait/where-allowed.rs
index 038eacaf1103e..f7b331238c6dd 100644
--- a/src/test/compile-fail/impl-trait/where-allowed.rs
+++ b/src/test/compile-fail/impl-trait/where-allowed.rs
@@ -10,7 +10,9 @@
 
 //! A simple test for testing many permutations of allowedness of
 //! impl Trait
-#![feature(dyn_trait)]
+
+#![feature(conservative_impl_trait, universal_impl_trait)]
+
 use std::fmt::Debug;
 
 // Allowed
diff --git a/src/test/compile-fail/mir_check_cast_unsize.rs b/src/test/compile-fail/mir_check_cast_unsize.rs
index e30bed6105815..a2c840a70980b 100644
--- a/src/test/compile-fail/mir_check_cast_unsize.rs
+++ b/src/test/compile-fail/mir_check_cast_unsize.rs
@@ -11,7 +11,6 @@
 // compile-flags: -Z borrowck=mir
 
 #![allow(dead_code)]
-#![feature(dyn_trait)]
 
 use std::fmt::Debug;
 
diff --git a/src/test/compile-fail/trait-bounds-not-on-struct.rs b/src/test/compile-fail/trait-bounds-not-on-struct.rs
index 0dd1a4e7d7335..1b1a238a941e5 100644
--- a/src/test/compile-fail/trait-bounds-not-on-struct.rs
+++ b/src/test/compile-fail/trait-bounds-not-on-struct.rs
@@ -8,7 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(dyn_trait)]
 #![allow(bare_trait_object)]
 
 struct Foo;
diff --git a/src/test/run-pass/dyn-trait.rs b/src/test/run-pass/dyn-trait.rs
index 399823ec92d0c..010667942424c 100644
--- a/src/test/run-pass/dyn-trait.rs
+++ b/src/test/run-pass/dyn-trait.rs
@@ -10,8 +10,6 @@
 
 // ignore-pretty `dyn ::foo` parses differently in the current edition
 
-#![feature(dyn_trait)]
-
 use std::fmt::Display;
 
 static BYTE: u8 = 33;
diff --git a/src/test/ui/impl_trait_projections.rs b/src/test/ui/impl_trait_projections.rs
index 6a72794227109..e8e25c1984003 100644
--- a/src/test/ui/impl_trait_projections.rs
+++ b/src/test/ui/impl_trait_projections.rs
@@ -7,7 +7,9 @@
 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
+
 #![feature(dyn_trait)]
+#![feature(conservative_impl_trait, universal_impl_trait)]
 
 use std::fmt::Debug;
 use std::option;
diff --git a/src/test/ui/nll/ty-outlives/projection-no-regions-closure.rs b/src/test/ui/nll/ty-outlives/projection-no-regions-closure.rs
index 7b3ed6a94fcbb..4767b75d89c1a 100644
--- a/src/test/ui/nll/ty-outlives/projection-no-regions-closure.rs
+++ b/src/test/ui/nll/ty-outlives/projection-no-regions-closure.rs
@@ -15,7 +15,6 @@
 // Iterator>::Item`, to be exact).
 
 #![allow(warnings)]
-#![feature(dyn_trait)]
 #![feature(rustc_attrs)]
 
 trait Anything { }
diff --git a/src/test/ui/nll/ty-outlives/projection-no-regions-fn.rs b/src/test/ui/nll/ty-outlives/projection-no-regions-fn.rs
index 32b73a51e11a5..dea2daf7e8eeb 100644
--- a/src/test/ui/nll/ty-outlives/projection-no-regions-fn.rs
+++ b/src/test/ui/nll/ty-outlives/projection-no-regions-fn.rs
@@ -11,7 +11,6 @@
 // compile-flags:-Zborrowck=mir -Zverbose
 
 #![allow(warnings)]
-#![feature(dyn_trait)]
 
 trait Anything { }
 
diff --git a/src/test/ui/nll/ty-outlives/projection-one-region-closure.rs b/src/test/ui/nll/ty-outlives/projection-one-region-closure.rs
index cfe2880bfed47..77024c4119ff9 100644
--- a/src/test/ui/nll/ty-outlives/projection-one-region-closure.rs
+++ b/src/test/ui/nll/ty-outlives/projection-one-region-closure.rs
@@ -25,7 +25,6 @@
 // compile-flags:-Zborrowck=mir -Zverbose
 
 #![allow(warnings)]
-#![feature(dyn_trait)]
 #![feature(rustc_attrs)]
 
 use std::cell::Cell;
diff --git a/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.rs b/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.rs
index 16e91f2708fe9..fb1009c9cc8e8 100644
--- a/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.rs
+++ b/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.rs
@@ -17,7 +17,6 @@
 // compile-flags:-Zborrowck=mir -Zverbose
 
 #![allow(warnings)]
-#![feature(dyn_trait)]
 #![feature(rustc_attrs)]
 
 use std::cell::Cell;
diff --git a/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-static-closure.rs b/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-static-closure.rs
index 0d42636c844a5..1f2f40196f8ee 100644
--- a/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-static-closure.rs
+++ b/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-static-closure.rs
@@ -16,7 +16,6 @@
 // compile-pass
 
 #![allow(warnings)]
-#![feature(dyn_trait)]
 #![feature(rustc_attrs)]
 
 use std::cell::Cell;
diff --git a/src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.rs b/src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.rs
index 7c8ef140a2907..5307d0880d4da 100644
--- a/src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.rs
+++ b/src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.rs
@@ -18,7 +18,6 @@
 // compile-flags:-Zborrowck=mir -Zverbose
 
 #![allow(warnings)]
-#![feature(dyn_trait)]
 #![feature(rustc_attrs)]
 
 use std::cell::Cell;
diff --git a/src/test/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.rs b/src/test/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.rs
index 80b42c29563f1..7ff4b484af17b 100644
--- a/src/test/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.rs
+++ b/src/test/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.rs
@@ -11,7 +11,6 @@
 // compile-flags:-Zborrowck=mir -Zverbose
 
 #![allow(warnings)]
-#![feature(dyn_trait)]
 #![feature(rustc_attrs)]
 
 use std::cell::Cell;
diff --git a/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.rs b/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.rs
index 50763a1d50808..b5cbd07b99c18 100644
--- a/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.rs
+++ b/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.rs
@@ -11,7 +11,6 @@
 // compile-flags:-Zborrowck=mir -Zverbose
 
 #![allow(warnings)]
-#![feature(dyn_trait)]
 #![feature(rustc_attrs)]
 
 use std::fmt::Debug;
diff --git a/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.rs b/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.rs
index b70fc2b2ec4b4..edaaeac080d4d 100644
--- a/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.rs
+++ b/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.rs
@@ -15,7 +15,6 @@
 // compile-flags:-Zborrowck=mir -Zverbose
 
 #![allow(warnings)]
-#![feature(dyn_trait)]
 #![feature(rustc_attrs)]
 
 use std::cell::Cell;
diff --git a/src/test/ui/nll/ty-outlives/ty-param-fn-body-nll-feature.rs b/src/test/ui/nll/ty-outlives/ty-param-fn-body-nll-feature.rs
index babe608354fb9..c0c483b3957d4 100644
--- a/src/test/ui/nll/ty-outlives/ty-param-fn-body-nll-feature.rs
+++ b/src/test/ui/nll/ty-outlives/ty-param-fn-body-nll-feature.rs
@@ -15,7 +15,6 @@
 #![feature(nll)]
 
 #![allow(warnings)]
-#![feature(dyn_trait)]
 
 use std::cell::Cell;
 
diff --git a/src/test/ui/nll/ty-outlives/ty-param-fn-body.rs b/src/test/ui/nll/ty-outlives/ty-param-fn-body.rs
index fb4ea63f8532c..6226108ef196f 100644
--- a/src/test/ui/nll/ty-outlives/ty-param-fn-body.rs
+++ b/src/test/ui/nll/ty-outlives/ty-param-fn-body.rs
@@ -14,7 +14,6 @@
 // function body.
 
 #![allow(warnings)]
-#![feature(dyn_trait)]
 
 use std::cell::Cell;
 
diff --git a/src/test/ui/nll/ty-outlives/ty-param-fn.rs b/src/test/ui/nll/ty-outlives/ty-param-fn.rs
index 42d662e14193c..258d77eb2b078 100644
--- a/src/test/ui/nll/ty-outlives/ty-param-fn.rs
+++ b/src/test/ui/nll/ty-outlives/ty-param-fn.rs
@@ -11,7 +11,6 @@
 // compile-flags:-Zborrowck=mir
 
 #![allow(warnings)]
-#![feature(dyn_trait)]
 
 use std::fmt::Debug;
 

From 0efb5677d74451787a4dbd77fce1701c52c72a68 Mon Sep 17 00:00:00 2001
From: Christian Poveda <christianpoveda@protonmail.com>
Date: Thu, 12 Apr 2018 16:55:09 -0500
Subject: [PATCH 14/21] dyn_trait feature-gate just for stage0

---
 src/librustc/lib.rs                                           | 2 +-
 src/librustc_mir/lib.rs                                       | 2 +-
 src/librustc_typeck/lib.rs                                    | 4 +++-
 .../termination-trait-for-box-dyn-error.rs                    | 2 --
 .../termination-trait-for-box-dyn-error.rs                    | 2 --
 src/test/ui/impl_trait_projections.rs                         | 1 -
 src/test/ui/in-band-lifetimes/impl/dyn-trait.rs               | 1 -
 src/test/ui/raw-literal-keywords.rs                           | 1 -
 .../ui/underscore-lifetime/dyn-trait-underscore-in-struct.rs  | 2 --
 src/test/ui/underscore-lifetime/dyn-trait-underscore.rs       | 2 --
 10 files changed, 5 insertions(+), 14 deletions(-)

diff --git a/src/librustc/lib.rs b/src/librustc/lib.rs
index bb495049483ac..f29da5eb11280 100644
--- a/src/librustc/lib.rs
+++ b/src/librustc/lib.rs
@@ -45,8 +45,8 @@
 #![feature(const_fn)]
 #![feature(core_intrinsics)]
 #![feature(drain_filter)]
-#![feature(dyn_trait)]
 #![feature(entry_or_default)]
+#![cfg_attr(stage0, feature(dyn_trait))]
 #![feature(from_ref)]
 #![feature(fs_read_write)]
 #![cfg_attr(windows, feature(libc))]
diff --git a/src/librustc_mir/lib.rs b/src/librustc_mir/lib.rs
index a47b3cacc517e..482fd5989f8bd 100644
--- a/src/librustc_mir/lib.rs
+++ b/src/librustc_mir/lib.rs
@@ -24,7 +24,7 @@ Rust MIR: a lowered representation of Rust. Also: an experiment!
 #![feature(const_fn)]
 #![feature(core_intrinsics)]
 #![feature(decl_macro)]
-#![feature(dyn_trait)]
+#![cfg_attr(stage0, feature(dyn_trait))]
 #![feature(fs_read_write)]
 #![feature(macro_vis_matcher)]
 #![feature(exhaustive_patterns)]
diff --git a/src/librustc_typeck/lib.rs b/src/librustc_typeck/lib.rs
index ed0cfe38a7ad9..e852edc6eed00 100644
--- a/src/librustc_typeck/lib.rs
+++ b/src/librustc_typeck/lib.rs
@@ -71,6 +71,8 @@ This API is completely unstable and subject to change.
 
 #![allow(non_camel_case_types)]
 
+#![cfg_attr(stage0, feature(dyn_trait))]
+
 #![feature(box_patterns)]
 #![feature(box_syntax)]
 #![feature(crate_visibility_modifier)]
@@ -81,8 +83,8 @@ This API is completely unstable and subject to change.
 #![feature(rustc_diagnostic_macros)]
 #![feature(slice_patterns)]
 #![feature(slice_sort_by_cached_key)]
-#![feature(dyn_trait)]
 #![feature(never_type)]
+#![feature(underscore_lifetimes)]
 
 #[macro_use] extern crate log;
 #[macro_use] extern crate syntax;
diff --git a/src/test/run-fail/rfc-1937-termination-trait/termination-trait-for-box-dyn-error.rs b/src/test/run-fail/rfc-1937-termination-trait/termination-trait-for-box-dyn-error.rs
index 219eca6fd21e5..66a6e6afed34b 100644
--- a/src/test/run-fail/rfc-1937-termination-trait/termination-trait-for-box-dyn-error.rs
+++ b/src/test/run-fail/rfc-1937-termination-trait/termination-trait-for-box-dyn-error.rs
@@ -11,8 +11,6 @@
 // compile-pass
 // failure-status: 1
 
-#![feature(dyn_trait)]
-
 use std::error::Error;
 use std::io;
 
diff --git a/src/test/run-pass/rfc-1937-termination-trait/termination-trait-for-box-dyn-error.rs b/src/test/run-pass/rfc-1937-termination-trait/termination-trait-for-box-dyn-error.rs
index 24c30a5abc22a..183bb55353052 100644
--- a/src/test/run-pass/rfc-1937-termination-trait/termination-trait-for-box-dyn-error.rs
+++ b/src/test/run-pass/rfc-1937-termination-trait/termination-trait-for-box-dyn-error.rs
@@ -8,8 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(dyn_trait)]
-
 use std::error::Error;
 
 fn main() -> Result<(), Box<dyn Error>> {
diff --git a/src/test/ui/impl_trait_projections.rs b/src/test/ui/impl_trait_projections.rs
index e8e25c1984003..e8f39e169ff9a 100644
--- a/src/test/ui/impl_trait_projections.rs
+++ b/src/test/ui/impl_trait_projections.rs
@@ -8,7 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(dyn_trait)]
 #![feature(conservative_impl_trait, universal_impl_trait)]
 
 use std::fmt::Debug;
diff --git a/src/test/ui/in-band-lifetimes/impl/dyn-trait.rs b/src/test/ui/in-band-lifetimes/impl/dyn-trait.rs
index a504bae2e6007..c27bbe77fbf19 100644
--- a/src/test/ui/in-band-lifetimes/impl/dyn-trait.rs
+++ b/src/test/ui/in-band-lifetimes/impl/dyn-trait.rs
@@ -13,7 +13,6 @@
 
 #![allow(warnings)]
 
-#![feature(dyn_trait)]
 #![feature(in_band_lifetimes)]
 
 use std::fmt::Debug;
diff --git a/src/test/ui/raw-literal-keywords.rs b/src/test/ui/raw-literal-keywords.rs
index 9b28aa0b15116..9bb6653d77080 100644
--- a/src/test/ui/raw-literal-keywords.rs
+++ b/src/test/ui/raw-literal-keywords.rs
@@ -10,7 +10,6 @@
 
 // compile-flags: -Z parse-only
 
-#![feature(dyn_trait)]
 #![feature(raw_identifiers)]
 
 fn test_if() {
diff --git a/src/test/ui/underscore-lifetime/dyn-trait-underscore-in-struct.rs b/src/test/ui/underscore-lifetime/dyn-trait-underscore-in-struct.rs
index e573ad8fc1f09..6c83205d0504c 100644
--- a/src/test/ui/underscore-lifetime/dyn-trait-underscore-in-struct.rs
+++ b/src/test/ui/underscore-lifetime/dyn-trait-underscore-in-struct.rs
@@ -13,8 +13,6 @@
 //
 // cc #48468
 
-#![feature(dyn_trait)]
-
 use std::fmt::Debug;
 
 struct Foo {
diff --git a/src/test/ui/underscore-lifetime/dyn-trait-underscore.rs b/src/test/ui/underscore-lifetime/dyn-trait-underscore.rs
index 9640d3465978f..247492fb7b77b 100644
--- a/src/test/ui/underscore-lifetime/dyn-trait-underscore.rs
+++ b/src/test/ui/underscore-lifetime/dyn-trait-underscore.rs
@@ -13,8 +13,6 @@
 //
 // cc #48468
 
-#![feature(dyn_trait)]
-
 fn a<T>(items: &[T]) -> Box<dyn Iterator<Item=&T>> {
     //                      ^^^^^^^^^^^^^^^^^^^^^ bound *here* defaults to `'static`
     Box::new(items.iter()) //~ ERROR cannot infer an appropriate lifetime

From 55a653dd359a6e5c8da7e47399310a79fd094932 Mon Sep 17 00:00:00 2001
From: Christian Poveda <christianpoveda@protonmail.com>
Date: Fri, 13 Apr 2018 17:07:33 -0500
Subject: [PATCH 15/21] removed linting for dyn_trait

---
 src/librustc/hir/lowering.rs | 16 +++++++---------
 src/librustc_typeck/lib.rs   |  1 -
 2 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/src/librustc/hir/lowering.rs b/src/librustc/hir/lowering.rs
index 4023521147e78..74fedd6bfbafe 100644
--- a/src/librustc/hir/lowering.rs
+++ b/src/librustc/hir/lowering.rs
@@ -4107,15 +4107,13 @@ impl<'a> LoweringContext<'a> {
     }
 
     fn maybe_lint_bare_trait(&self, span: Span, id: NodeId, is_global: bool) {
-        if self.sess.features_untracked().dyn_trait {
-            self.sess.buffer_lint_with_diagnostic(
-                builtin::BARE_TRAIT_OBJECT,
-                id,
-                span,
-                "trait objects without an explicit `dyn` are deprecated",
-                builtin::BuiltinLintDiagnostics::BareTraitObject(span, is_global),
-            )
-        }
+        self.sess.buffer_lint_with_diagnostic(
+            builtin::BARE_TRAIT_OBJECT,
+            id,
+            span,
+            "trait objects without an explicit `dyn` are deprecated",
+            builtin::BuiltinLintDiagnostics::BareTraitObject(span, is_global),
+        )
     }
 
     fn wrap_in_try_constructor(
diff --git a/src/librustc_typeck/lib.rs b/src/librustc_typeck/lib.rs
index e852edc6eed00..1e48926f2b3be 100644
--- a/src/librustc_typeck/lib.rs
+++ b/src/librustc_typeck/lib.rs
@@ -84,7 +84,6 @@ This API is completely unstable and subject to change.
 #![feature(slice_patterns)]
 #![feature(slice_sort_by_cached_key)]
 #![feature(never_type)]
-#![feature(underscore_lifetimes)]
 
 #[macro_use] extern crate log;
 #[macro_use] extern crate syntax;

From 4bf35f93c9e753b413a9ff5b2a79ae5b1efbd4b8 Mon Sep 17 00:00:00 2001
From: Christian Poveda <christianpoveda@protonmail.com>
Date: Fri, 13 Apr 2018 19:21:23 -0500
Subject: [PATCH 16/21] updated stderr files and removed feature-gate test for
 dyn_trait

---
 src/test/ui/feature-gate-dyn-trait.rs         | 14 ------
 src/test/ui/impl_trait_projections.stderr     | 10 ++--
 .../in-band-lifetimes/impl/dyn-trait.stderr   |  6 +--
 .../projection-no-regions-closure.stderr      | 24 +++++-----
 .../projection-no-regions-fn.stderr           |  8 ++--
 .../projection-one-region-closure.stderr      | 34 ++++++-------
 ...tion-one-region-trait-bound-closure.stderr | 32 ++++++-------
 ...e-region-trait-bound-static-closure.stderr | 20 ++++----
 ...tion-two-region-trait-bound-closure.stderr | 48 +++++++++----------
 ...ram-closure-approximate-lower-bound.stderr | 16 +++----
 ...m-closure-outlives-from-return-type.stderr | 12 ++---
 ...-closure-outlives-from-where-clause.stderr | 24 +++++-----
 .../ty-param-fn-body-nll-feature.stderr       |  2 +-
 .../nll/ty-outlives/ty-param-fn-body.stderr   |  4 +-
 .../ui/nll/ty-outlives/ty-param-fn.stderr     |  8 ++--
 src/test/ui/raw-literal-keywords.stderr       |  6 +--
 .../dyn-trait-underscore-in-struct.stderr     |  4 +-
 .../dyn-trait-underscore.stderr               |  8 ++--
 18 files changed, 133 insertions(+), 147 deletions(-)
 delete mode 100644 src/test/ui/feature-gate-dyn-trait.rs

diff --git a/src/test/ui/feature-gate-dyn-trait.rs b/src/test/ui/feature-gate-dyn-trait.rs
deleted file mode 100644
index 4b3803d019baa..0000000000000
--- a/src/test/ui/feature-gate-dyn-trait.rs
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-trait Trait {}
-type A = Box<dyn Trait>; //~ ERROR `dyn Trait` syntax is unstable
-
-fn main() {}
diff --git a/src/test/ui/impl_trait_projections.stderr b/src/test/ui/impl_trait_projections.stderr
index 9b38de614fc10..f0fe1a9754a95 100644
--- a/src/test/ui/impl_trait_projections.stderr
+++ b/src/test/ui/impl_trait_projections.stderr
@@ -1,29 +1,29 @@
 error[E0667]: `impl Trait` is not allowed in path parameters
-  --> $DIR/impl_trait_projections.rs:23:51
+  --> $DIR/impl_trait_projections.rs:24:51
    |
 LL | fn projection_is_disallowed(x: impl Iterator) -> <impl Iterator>::Item {
    |                                                   ^^^^^^^^^^^^^
 
 error[E0667]: `impl Trait` is not allowed in path parameters
-  --> $DIR/impl_trait_projections.rs:30:9
+  --> $DIR/impl_trait_projections.rs:31:9
    |
 LL |     -> <impl Iterator as Iterator>::Item
    |         ^^^^^^^^^^^^^
 
 error[E0667]: `impl Trait` is not allowed in path parameters
-  --> $DIR/impl_trait_projections.rs:37:27
+  --> $DIR/impl_trait_projections.rs:38:27
    |
 LL |     -> <::std::ops::Range<impl Debug> as Iterator>::Item
    |                           ^^^^^^^^^^
 
 error[E0667]: `impl Trait` is not allowed in path parameters
-  --> $DIR/impl_trait_projections.rs:44:29
+  --> $DIR/impl_trait_projections.rs:45:29
    |
 LL |     -> <dyn Iterator<Item = impl Debug> as Iterator>::Item
    |                             ^^^^^^^^^^
 
 error[E0223]: ambiguous associated type
-  --> $DIR/impl_trait_projections.rs:23:50
+  --> $DIR/impl_trait_projections.rs:24:50
    |
 LL | fn projection_is_disallowed(x: impl Iterator) -> <impl Iterator>::Item {
    |                                                  ^^^^^^^^^^^^^^^^^^^^^ ambiguous associated type
diff --git a/src/test/ui/in-band-lifetimes/impl/dyn-trait.stderr b/src/test/ui/in-band-lifetimes/impl/dyn-trait.stderr
index 9d6a318c07513..201470abe674c 100644
--- a/src/test/ui/in-band-lifetimes/impl/dyn-trait.stderr
+++ b/src/test/ui/in-band-lifetimes/impl/dyn-trait.stderr
@@ -1,11 +1,11 @@
 error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements
-  --> $DIR/dyn-trait.rs:33:16
+  --> $DIR/dyn-trait.rs:32:16
    |
 LL |     static_val(x); //~ ERROR cannot infer
    |                ^
    |
-note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 32:1...
-  --> $DIR/dyn-trait.rs:32:1
+note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 31:1...
+  --> $DIR/dyn-trait.rs:31:1
    |
 LL | fn with_dyn_debug_static<'a>(x: Box<dyn Debug + 'a>) {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/src/test/ui/nll/ty-outlives/projection-no-regions-closure.stderr b/src/test/ui/nll/ty-outlives/projection-no-regions-closure.stderr
index 0efbbdff12a3f..3689ca74adb8c 100644
--- a/src/test/ui/nll/ty-outlives/projection-no-regions-closure.stderr
+++ b/src/test/ui/nll/ty-outlives/projection-no-regions-closure.stderr
@@ -1,17 +1,17 @@
 warning: not reporting region error due to nll
-  --> $DIR/projection-no-regions-closure.rs:36:31
+  --> $DIR/projection-no-regions-closure.rs:35:31
    |
 LL |     with_signature(x, |mut y| Box::new(y.next()))
    |                               ^^^^^^^^^^^^^^^^^^
 
 warning: not reporting region error due to nll
-  --> $DIR/projection-no-regions-closure.rs:54:31
+  --> $DIR/projection-no-regions-closure.rs:53:31
    |
 LL |     with_signature(x, |mut y| Box::new(y.next()))
    |                               ^^^^^^^^^^^^^^^^^^
 
 note: External requirements
-  --> $DIR/projection-no-regions-closure.rs:36:23
+  --> $DIR/projection-no-regions-closure.rs:35:23
    |
 LL |     with_signature(x, |mut y| Box::new(y.next()))
    |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -26,7 +26,7 @@ LL |     with_signature(x, |mut y| Box::new(y.next()))
    = note: where <T as std::iter::Iterator>::Item: '_#2r
 
 error[E0309]: the associated type `<T as std::iter::Iterator>::Item` may not live long enough
-  --> $DIR/projection-no-regions-closure.rs:36:23
+  --> $DIR/projection-no-regions-closure.rs:35:23
    |
 LL |     with_signature(x, |mut y| Box::new(y.next()))
    |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -34,7 +34,7 @@ LL |     with_signature(x, |mut y| Box::new(y.next()))
    = help: consider adding an explicit lifetime bound `<T as std::iter::Iterator>::Item: ReEarlyBound(0, 'a)`...
 
 note: No external requirements
-  --> $DIR/projection-no-regions-closure.rs:32:1
+  --> $DIR/projection-no-regions-closure.rs:31:1
    |
 LL | / fn no_region<'a, T>(x: Box<T>) -> Box<dyn Anything + 'a>
 LL | | where
@@ -51,7 +51,7 @@ LL | | }
            ]
 
 note: External requirements
-  --> $DIR/projection-no-regions-closure.rs:46:23
+  --> $DIR/projection-no-regions-closure.rs:45:23
    |
 LL |     with_signature(x, |mut y| Box::new(y.next()))
    |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -66,7 +66,7 @@ LL |     with_signature(x, |mut y| Box::new(y.next()))
    = note: where <T as std::iter::Iterator>::Item: '_#2r
 
 note: No external requirements
-  --> $DIR/projection-no-regions-closure.rs:42:1
+  --> $DIR/projection-no-regions-closure.rs:41:1
    |
 LL | / fn correct_region<'a, T>(x: Box<T>) -> Box<dyn Anything + 'a>
 LL | | where
@@ -82,7 +82,7 @@ LL | | }
            ]
 
 note: External requirements
-  --> $DIR/projection-no-regions-closure.rs:54:23
+  --> $DIR/projection-no-regions-closure.rs:53:23
    |
 LL |     with_signature(x, |mut y| Box::new(y.next()))
    |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -98,7 +98,7 @@ LL |     with_signature(x, |mut y| Box::new(y.next()))
    = note: where <T as std::iter::Iterator>::Item: '_#3r
 
 error[E0309]: the associated type `<T as std::iter::Iterator>::Item` may not live long enough
-  --> $DIR/projection-no-regions-closure.rs:54:23
+  --> $DIR/projection-no-regions-closure.rs:53:23
    |
 LL |     with_signature(x, |mut y| Box::new(y.next()))
    |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -106,7 +106,7 @@ LL |     with_signature(x, |mut y| Box::new(y.next()))
    = help: consider adding an explicit lifetime bound `<T as std::iter::Iterator>::Item: ReEarlyBound(0, 'a)`...
 
 note: No external requirements
-  --> $DIR/projection-no-regions-closure.rs:50:1
+  --> $DIR/projection-no-regions-closure.rs:49:1
    |
 LL | / fn wrong_region<'a, 'b, T>(x: Box<T>) -> Box<dyn Anything + 'a>
 LL | | where
@@ -124,7 +124,7 @@ LL | | }
            ]
 
 note: External requirements
-  --> $DIR/projection-no-regions-closure.rs:65:23
+  --> $DIR/projection-no-regions-closure.rs:64:23
    |
 LL |     with_signature(x, |mut y| Box::new(y.next()))
    |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -140,7 +140,7 @@ LL |     with_signature(x, |mut y| Box::new(y.next()))
    = note: where <T as std::iter::Iterator>::Item: '_#3r
 
 note: No external requirements
-  --> $DIR/projection-no-regions-closure.rs:60:1
+  --> $DIR/projection-no-regions-closure.rs:59:1
    |
 LL | / fn outlives_region<'a, 'b, T>(x: Box<T>) -> Box<dyn Anything + 'a>
 LL | | where
diff --git a/src/test/ui/nll/ty-outlives/projection-no-regions-fn.stderr b/src/test/ui/nll/ty-outlives/projection-no-regions-fn.stderr
index b2c5f28268db8..3199ec151335d 100644
--- a/src/test/ui/nll/ty-outlives/projection-no-regions-fn.stderr
+++ b/src/test/ui/nll/ty-outlives/projection-no-regions-fn.stderr
@@ -1,17 +1,17 @@
 warning: not reporting region error due to nll
-  --> $DIR/projection-no-regions-fn.rs:24:5
+  --> $DIR/projection-no-regions-fn.rs:23:5
    |
 LL |     Box::new(x.next())
    |     ^^^^^^^^^^^^^^^^^^
 
 warning: not reporting region error due to nll
-  --> $DIR/projection-no-regions-fn.rs:40:5
+  --> $DIR/projection-no-regions-fn.rs:39:5
    |
 LL |     Box::new(x.next())
    |     ^^^^^^^^^^^^^^^^^^
 
 error[E0309]: the associated type `<T as std::iter::Iterator>::Item` may not live long enough
-  --> $DIR/projection-no-regions-fn.rs:24:5
+  --> $DIR/projection-no-regions-fn.rs:23:5
    |
 LL |     Box::new(x.next())
    |     ^^^^^^^^^^^^^^^^^^
@@ -19,7 +19,7 @@ LL |     Box::new(x.next())
    = help: consider adding an explicit lifetime bound `<T as std::iter::Iterator>::Item: ReEarlyBound(0, 'a)`...
 
 error[E0309]: the associated type `<T as std::iter::Iterator>::Item` may not live long enough
-  --> $DIR/projection-no-regions-fn.rs:40:5
+  --> $DIR/projection-no-regions-fn.rs:39:5
    |
 LL |     Box::new(x.next())
    |     ^^^^^^^^^^^^^^^^^^
diff --git a/src/test/ui/nll/ty-outlives/projection-one-region-closure.stderr b/src/test/ui/nll/ty-outlives/projection-one-region-closure.stderr
index 0d5a2dc7c5598..e1218830dbb64 100644
--- a/src/test/ui/nll/ty-outlives/projection-one-region-closure.stderr
+++ b/src/test/ui/nll/ty-outlives/projection-one-region-closure.stderr
@@ -1,23 +1,23 @@
 warning: not reporting region error due to nll
-  --> $DIR/projection-one-region-closure.rs:56:39
+  --> $DIR/projection-one-region-closure.rs:55:39
    |
 LL |     with_signature(cell, t, |cell, t| require(cell, t));
    |                                       ^^^^^^^
 
 warning: not reporting region error due to nll
-  --> $DIR/projection-one-region-closure.rs:68:39
+  --> $DIR/projection-one-region-closure.rs:67:39
    |
 LL |     with_signature(cell, t, |cell, t| require(cell, t));
    |                                       ^^^^^^^
 
 warning: not reporting region error due to nll
-  --> $DIR/projection-one-region-closure.rs:90:39
+  --> $DIR/projection-one-region-closure.rs:89:39
    |
 LL |     with_signature(cell, t, |cell, t| require(cell, t));
    |                                       ^^^^^^^
 
 note: External requirements
-  --> $DIR/projection-one-region-closure.rs:56:29
+  --> $DIR/projection-one-region-closure.rs:55:29
    |
 LL |     with_signature(cell, t, |cell, t| require(cell, t));
    |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -33,7 +33,7 @@ LL |     with_signature(cell, t, |cell, t| require(cell, t));
    = note: where '_#1r: '_#2r
 
 error[E0309]: the parameter type `T` may not live long enough
-  --> $DIR/projection-one-region-closure.rs:56:29
+  --> $DIR/projection-one-region-closure.rs:55:29
    |
 LL |     with_signature(cell, t, |cell, t| require(cell, t));
    |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -41,13 +41,13 @@ LL |     with_signature(cell, t, |cell, t| require(cell, t));
    = help: consider adding an explicit lifetime bound `T: ReFree(DefId(0/0:8 ~ projection_one_region_closure[317d]::no_relationships_late[0]), BrNamed(crate0:DefIndex(1:16), 'a))`...
 
 error: free region `ReEarlyBound(0, 'b)` does not outlive free region `ReFree(DefId(0/0:8 ~ projection_one_region_closure[317d]::no_relationships_late[0]), BrNamed(crate0:DefIndex(1:16), 'a))`
-  --> $DIR/projection-one-region-closure.rs:56:20
+  --> $DIR/projection-one-region-closure.rs:55:20
    |
 LL |     with_signature(cell, t, |cell, t| require(cell, t));
    |                    ^^^^
 
 note: No external requirements
-  --> $DIR/projection-one-region-closure.rs:52:1
+  --> $DIR/projection-one-region-closure.rs:51:1
    |
 LL | / fn no_relationships_late<'a, 'b, T>(cell: Cell<&'a ()>, t: T)
 LL | | where
@@ -64,7 +64,7 @@ LL | | }
            ]
 
 note: External requirements
-  --> $DIR/projection-one-region-closure.rs:68:29
+  --> $DIR/projection-one-region-closure.rs:67:29
    |
 LL |     with_signature(cell, t, |cell, t| require(cell, t));
    |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -81,7 +81,7 @@ LL |     with_signature(cell, t, |cell, t| require(cell, t));
    = note: where '_#2r: '_#3r
 
 error[E0309]: the parameter type `T` may not live long enough
-  --> $DIR/projection-one-region-closure.rs:68:29
+  --> $DIR/projection-one-region-closure.rs:67:29
    |
 LL |     with_signature(cell, t, |cell, t| require(cell, t));
    |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -89,13 +89,13 @@ LL |     with_signature(cell, t, |cell, t| require(cell, t));
    = help: consider adding an explicit lifetime bound `T: ReEarlyBound(0, 'a)`...
 
 error: free region `ReEarlyBound(1, 'b)` does not outlive free region `ReEarlyBound(0, 'a)`
-  --> $DIR/projection-one-region-closure.rs:68:20
+  --> $DIR/projection-one-region-closure.rs:67:20
    |
 LL |     with_signature(cell, t, |cell, t| require(cell, t));
    |                    ^^^^
 
 note: No external requirements
-  --> $DIR/projection-one-region-closure.rs:63:1
+  --> $DIR/projection-one-region-closure.rs:62:1
    |
 LL | / fn no_relationships_early<'a, 'b, T>(cell: Cell<&'a ()>, t: T)
 LL | | where
@@ -113,7 +113,7 @@ LL | | }
            ]
 
 note: External requirements
-  --> $DIR/projection-one-region-closure.rs:90:29
+  --> $DIR/projection-one-region-closure.rs:89:29
    |
 LL |     with_signature(cell, t, |cell, t| require(cell, t));
    |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -130,7 +130,7 @@ LL |     with_signature(cell, t, |cell, t| require(cell, t));
    = note: where '_#2r: '_#3r
 
 error[E0309]: the parameter type `T` may not live long enough
-  --> $DIR/projection-one-region-closure.rs:90:29
+  --> $DIR/projection-one-region-closure.rs:89:29
    |
 LL |     with_signature(cell, t, |cell, t| require(cell, t));
    |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -138,13 +138,13 @@ LL |     with_signature(cell, t, |cell, t| require(cell, t));
    = help: consider adding an explicit lifetime bound `T: ReEarlyBound(0, 'a)`...
 
 error: free region `ReEarlyBound(1, 'b)` does not outlive free region `ReEarlyBound(0, 'a)`
-  --> $DIR/projection-one-region-closure.rs:90:20
+  --> $DIR/projection-one-region-closure.rs:89:20
    |
 LL |     with_signature(cell, t, |cell, t| require(cell, t));
    |                    ^^^^
 
 note: No external requirements
-  --> $DIR/projection-one-region-closure.rs:75:1
+  --> $DIR/projection-one-region-closure.rs:74:1
    |
 LL | / fn projection_outlives<'a, 'b, T>(cell: Cell<&'a ()>, t: T)
 LL | | where
@@ -162,7 +162,7 @@ LL | | }
            ]
 
 note: External requirements
-  --> $DIR/projection-one-region-closure.rs:103:29
+  --> $DIR/projection-one-region-closure.rs:102:29
    |
 LL |     with_signature(cell, t, |cell, t| require(cell, t));
    |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -179,7 +179,7 @@ LL |     with_signature(cell, t, |cell, t| require(cell, t));
    = note: where '_#2r: '_#3r
 
 note: No external requirements
-  --> $DIR/projection-one-region-closure.rs:97:1
+  --> $DIR/projection-one-region-closure.rs:96:1
    |
 LL | / fn elements_outlive<'a, 'b, T>(cell: Cell<&'a ()>, t: T)
 LL | | where
diff --git a/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.stderr b/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.stderr
index d4aca8380b469..76554e29f62ea 100644
--- a/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.stderr
+++ b/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.stderr
@@ -1,23 +1,23 @@
 warning: not reporting region error due to nll
-  --> $DIR/projection-one-region-trait-bound-closure.rs:48:39
+  --> $DIR/projection-one-region-trait-bound-closure.rs:47:39
    |
 LL |     with_signature(cell, t, |cell, t| require(cell, t));
    |                                       ^^^^^^^
 
 warning: not reporting region error due to nll
-  --> $DIR/projection-one-region-trait-bound-closure.rs:59:39
+  --> $DIR/projection-one-region-trait-bound-closure.rs:58:39
    |
 LL |     with_signature(cell, t, |cell, t| require(cell, t));
    |                                       ^^^^^^^
 
 warning: not reporting region error due to nll
-  --> $DIR/projection-one-region-trait-bound-closure.rs:80:39
+  --> $DIR/projection-one-region-trait-bound-closure.rs:79:39
    |
 LL |     with_signature(cell, t, |cell, t| require(cell, t));
    |                                       ^^^^^^^
 
 note: External requirements
-  --> $DIR/projection-one-region-trait-bound-closure.rs:48:29
+  --> $DIR/projection-one-region-trait-bound-closure.rs:47:29
    |
 LL |     with_signature(cell, t, |cell, t| require(cell, t));
    |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -32,13 +32,13 @@ LL |     with_signature(cell, t, |cell, t| require(cell, t));
    = note: where '_#1r: '_#2r
 
 error: free region `ReEarlyBound(0, 'b)` does not outlive free region `ReFree(DefId(0/0:8 ~ projection_one_region_trait_bound_closure[317d]::no_relationships_late[0]), BrNamed(crate0:DefIndex(1:16), 'a))`
-  --> $DIR/projection-one-region-trait-bound-closure.rs:48:20
+  --> $DIR/projection-one-region-trait-bound-closure.rs:47:20
    |
 LL |     with_signature(cell, t, |cell, t| require(cell, t));
    |                    ^^^^
 
 note: No external requirements
-  --> $DIR/projection-one-region-trait-bound-closure.rs:44:1
+  --> $DIR/projection-one-region-trait-bound-closure.rs:43:1
    |
 LL | / fn no_relationships_late<'a, 'b, T>(cell: Cell<&'a ()>, t: T)
 LL | | where
@@ -55,7 +55,7 @@ LL | | }
            ]
 
 note: External requirements
-  --> $DIR/projection-one-region-trait-bound-closure.rs:59:29
+  --> $DIR/projection-one-region-trait-bound-closure.rs:58:29
    |
 LL |     with_signature(cell, t, |cell, t| require(cell, t));
    |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -71,13 +71,13 @@ LL |     with_signature(cell, t, |cell, t| require(cell, t));
    = note: where '_#2r: '_#3r
 
 error: free region `ReEarlyBound(1, 'b)` does not outlive free region `ReEarlyBound(0, 'a)`
-  --> $DIR/projection-one-region-trait-bound-closure.rs:59:20
+  --> $DIR/projection-one-region-trait-bound-closure.rs:58:20
    |
 LL |     with_signature(cell, t, |cell, t| require(cell, t));
    |                    ^^^^
 
 note: No external requirements
-  --> $DIR/projection-one-region-trait-bound-closure.rs:54:1
+  --> $DIR/projection-one-region-trait-bound-closure.rs:53:1
    |
 LL | / fn no_relationships_early<'a, 'b, T>(cell: Cell<&'a ()>, t: T)
 LL | | where
@@ -95,7 +95,7 @@ LL | | }
            ]
 
 note: External requirements
-  --> $DIR/projection-one-region-trait-bound-closure.rs:80:29
+  --> $DIR/projection-one-region-trait-bound-closure.rs:79:29
    |
 LL |     with_signature(cell, t, |cell, t| require(cell, t));
    |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -111,13 +111,13 @@ LL |     with_signature(cell, t, |cell, t| require(cell, t));
    = note: where '_#2r: '_#3r
 
 error: free region `ReEarlyBound(1, 'b)` does not outlive free region `ReEarlyBound(0, 'a)`
-  --> $DIR/projection-one-region-trait-bound-closure.rs:80:20
+  --> $DIR/projection-one-region-trait-bound-closure.rs:79:20
    |
 LL |     with_signature(cell, t, |cell, t| require(cell, t));
    |                    ^^^^
 
 note: No external requirements
-  --> $DIR/projection-one-region-trait-bound-closure.rs:65:1
+  --> $DIR/projection-one-region-trait-bound-closure.rs:64:1
    |
 LL | / fn projection_outlives<'a, 'b, T>(cell: Cell<&'a ()>, t: T)
 LL | | where
@@ -135,7 +135,7 @@ LL | | }
            ]
 
 note: External requirements
-  --> $DIR/projection-one-region-trait-bound-closure.rs:91:29
+  --> $DIR/projection-one-region-trait-bound-closure.rs:90:29
    |
 LL |     with_signature(cell, t, |cell, t| require(cell, t));
    |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -151,7 +151,7 @@ LL |     with_signature(cell, t, |cell, t| require(cell, t));
    = note: where '_#2r: '_#3r
 
 note: No external requirements
-  --> $DIR/projection-one-region-trait-bound-closure.rs:86:1
+  --> $DIR/projection-one-region-trait-bound-closure.rs:85:1
    |
 LL | / fn elements_outlive<'a, 'b, T>(cell: Cell<&'a ()>, t: T)
 LL | | where
@@ -169,7 +169,7 @@ LL | | }
            ]
 
 note: External requirements
-  --> $DIR/projection-one-region-trait-bound-closure.rs:103:29
+  --> $DIR/projection-one-region-trait-bound-closure.rs:102:29
    |
 LL |     with_signature(cell, t, |cell, t| require(cell, t));
    |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -184,7 +184,7 @@ LL |     with_signature(cell, t, |cell, t| require(cell, t));
    = note: where '_#1r: '_#2r
 
 note: No external requirements
-  --> $DIR/projection-one-region-trait-bound-closure.rs:95:1
+  --> $DIR/projection-one-region-trait-bound-closure.rs:94:1
    |
 LL | / fn one_region<'a, T>(cell: Cell<&'a ()>, t: T)
 LL | | where
diff --git a/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-static-closure.stderr b/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-static-closure.stderr
index 875907e6b39d5..136e143e80edf 100644
--- a/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-static-closure.stderr
+++ b/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-static-closure.stderr
@@ -1,5 +1,5 @@
 note: No external requirements
-  --> $DIR/projection-one-region-trait-bound-static-closure.rs:47:29
+  --> $DIR/projection-one-region-trait-bound-static-closure.rs:46:29
    |
 LL |     with_signature(cell, t, |cell, t| require(cell, t));
    |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -12,7 +12,7 @@ LL |     with_signature(cell, t, |cell, t| require(cell, t));
            ]
 
 note: No external requirements
-  --> $DIR/projection-one-region-trait-bound-static-closure.rs:43:1
+  --> $DIR/projection-one-region-trait-bound-static-closure.rs:42:1
    |
 LL | / fn no_relationships_late<'a, 'b, T>(cell: Cell<&'a ()>, t: T)
 LL | | where
@@ -28,7 +28,7 @@ LL | | }
            ]
 
 note: No external requirements
-  --> $DIR/projection-one-region-trait-bound-static-closure.rs:56:29
+  --> $DIR/projection-one-region-trait-bound-static-closure.rs:55:29
    |
 LL |     with_signature(cell, t, |cell, t| require(cell, t));
    |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -42,7 +42,7 @@ LL |     with_signature(cell, t, |cell, t| require(cell, t));
            ]
 
 note: No external requirements
-  --> $DIR/projection-one-region-trait-bound-static-closure.rs:51:1
+  --> $DIR/projection-one-region-trait-bound-static-closure.rs:50:1
    |
 LL | / fn no_relationships_early<'a, 'b, T>(cell: Cell<&'a ()>, t: T)
 LL | | where
@@ -60,7 +60,7 @@ LL | | }
            ]
 
 note: No external requirements
-  --> $DIR/projection-one-region-trait-bound-static-closure.rs:75:29
+  --> $DIR/projection-one-region-trait-bound-static-closure.rs:74:29
    |
 LL |     with_signature(cell, t, |cell, t| require(cell, t));
    |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -74,7 +74,7 @@ LL |     with_signature(cell, t, |cell, t| require(cell, t));
            ]
 
 note: No external requirements
-  --> $DIR/projection-one-region-trait-bound-static-closure.rs:60:1
+  --> $DIR/projection-one-region-trait-bound-static-closure.rs:59:1
    |
 LL | / fn projection_outlives<'a, 'b, T>(cell: Cell<&'a ()>, t: T)
 LL | | where
@@ -92,7 +92,7 @@ LL | | }
            ]
 
 note: No external requirements
-  --> $DIR/projection-one-region-trait-bound-static-closure.rs:84:29
+  --> $DIR/projection-one-region-trait-bound-static-closure.rs:83:29
    |
 LL |     with_signature(cell, t, |cell, t| require(cell, t));
    |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -106,7 +106,7 @@ LL |     with_signature(cell, t, |cell, t| require(cell, t));
            ]
 
 note: No external requirements
-  --> $DIR/projection-one-region-trait-bound-static-closure.rs:79:1
+  --> $DIR/projection-one-region-trait-bound-static-closure.rs:78:1
    |
 LL | / fn elements_outlive<'a, 'b, T>(cell: Cell<&'a ()>, t: T)
 LL | | where
@@ -124,7 +124,7 @@ LL | | }
            ]
 
 note: No external requirements
-  --> $DIR/projection-one-region-trait-bound-static-closure.rs:96:29
+  --> $DIR/projection-one-region-trait-bound-static-closure.rs:95:29
    |
 LL |     with_signature(cell, t, |cell, t| require(cell, t));
    |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -137,7 +137,7 @@ LL |     with_signature(cell, t, |cell, t| require(cell, t));
            ]
 
 note: No external requirements
-  --> $DIR/projection-one-region-trait-bound-static-closure.rs:88:1
+  --> $DIR/projection-one-region-trait-bound-static-closure.rs:87:1
    |
 LL | / fn one_region<'a, T>(cell: Cell<&'a ()>, t: T)
 LL | | where
diff --git a/src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr b/src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr
index 7e36e467e4eba..c7f456929609e 100644
--- a/src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr
+++ b/src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr
@@ -1,29 +1,29 @@
 warning: not reporting region error due to nll
-  --> $DIR/projection-two-region-trait-bound-closure.rs:49:39
+  --> $DIR/projection-two-region-trait-bound-closure.rs:48:39
    |
 LL |     with_signature(cell, t, |cell, t| require(cell, t));
    |                                       ^^^^^^^
 
 warning: not reporting region error due to nll
-  --> $DIR/projection-two-region-trait-bound-closure.rs:60:39
+  --> $DIR/projection-two-region-trait-bound-closure.rs:59:39
    |
 LL |     with_signature(cell, t, |cell, t| require(cell, t));
    |                                       ^^^^^^^
 
 warning: not reporting region error due to nll
-  --> $DIR/projection-two-region-trait-bound-closure.rs:81:39
+  --> $DIR/projection-two-region-trait-bound-closure.rs:80:39
    |
 LL |     with_signature(cell, t, |cell, t| require(cell, t));
    |                                       ^^^^^^^
 
 warning: not reporting region error due to nll
-  --> $DIR/projection-two-region-trait-bound-closure.rs:109:39
+  --> $DIR/projection-two-region-trait-bound-closure.rs:108:39
    |
 LL |     with_signature(cell, t, |cell, t| require(cell, t));
    |                                       ^^^^^^^
 
 note: External requirements
-  --> $DIR/projection-two-region-trait-bound-closure.rs:49:29
+  --> $DIR/projection-two-region-trait-bound-closure.rs:48:29
    |
 LL |     with_signature(cell, t, |cell, t| require(cell, t));
    |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -39,7 +39,7 @@ LL |     with_signature(cell, t, |cell, t| require(cell, t));
    = note: where <T as Anything<ReClosureBound('_#1r), ReClosureBound('_#2r)>>::AssocType: '_#3r
 
 error[E0309]: the associated type `<T as Anything<'_#5r, '_#6r>>::AssocType` may not live long enough
-  --> $DIR/projection-two-region-trait-bound-closure.rs:49:29
+  --> $DIR/projection-two-region-trait-bound-closure.rs:48:29
    |
 LL |     with_signature(cell, t, |cell, t| require(cell, t));
    |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -47,7 +47,7 @@ LL |     with_signature(cell, t, |cell, t| require(cell, t));
    = help: consider adding an explicit lifetime bound `<T as Anything<'_#5r, '_#6r>>::AssocType: ReFree(DefId(0/0:8 ~ projection_two_region_trait_bound_closure[317d]::no_relationships_late[0]), BrNamed(crate0:DefIndex(1:18), 'a))`...
 
 note: No external requirements
-  --> $DIR/projection-two-region-trait-bound-closure.rs:45:1
+  --> $DIR/projection-two-region-trait-bound-closure.rs:44:1
    |
 LL | / fn no_relationships_late<'a, 'b, 'c, T>(cell: Cell<&'a ()>, t: T)
 LL | | where
@@ -65,7 +65,7 @@ LL | | }
            ]
 
 note: External requirements
-  --> $DIR/projection-two-region-trait-bound-closure.rs:60:29
+  --> $DIR/projection-two-region-trait-bound-closure.rs:59:29
    |
 LL |     with_signature(cell, t, |cell, t| require(cell, t));
    |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -82,7 +82,7 @@ LL |     with_signature(cell, t, |cell, t| require(cell, t));
    = note: where <T as Anything<ReClosureBound('_#2r), ReClosureBound('_#3r)>>::AssocType: '_#4r
 
 error[E0309]: the associated type `<T as Anything<'_#6r, '_#7r>>::AssocType` may not live long enough
-  --> $DIR/projection-two-region-trait-bound-closure.rs:60:29
+  --> $DIR/projection-two-region-trait-bound-closure.rs:59:29
    |
 LL |     with_signature(cell, t, |cell, t| require(cell, t));
    |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -90,7 +90,7 @@ LL |     with_signature(cell, t, |cell, t| require(cell, t));
    = help: consider adding an explicit lifetime bound `<T as Anything<'_#6r, '_#7r>>::AssocType: ReEarlyBound(0, 'a)`...
 
 note: No external requirements
-  --> $DIR/projection-two-region-trait-bound-closure.rs:55:1
+  --> $DIR/projection-two-region-trait-bound-closure.rs:54:1
    |
 LL | / fn no_relationships_early<'a, 'b, 'c, T>(cell: Cell<&'a ()>, t: T)
 LL | | where
@@ -109,7 +109,7 @@ LL | | }
            ]
 
 note: External requirements
-  --> $DIR/projection-two-region-trait-bound-closure.rs:81:29
+  --> $DIR/projection-two-region-trait-bound-closure.rs:80:29
    |
 LL |     with_signature(cell, t, |cell, t| require(cell, t));
    |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -126,7 +126,7 @@ LL |     with_signature(cell, t, |cell, t| require(cell, t));
    = note: where <T as Anything<ReClosureBound('_#2r), ReClosureBound('_#3r)>>::AssocType: '_#4r
 
 error[E0309]: the associated type `<T as Anything<'_#6r, '_#7r>>::AssocType` may not live long enough
-  --> $DIR/projection-two-region-trait-bound-closure.rs:81:29
+  --> $DIR/projection-two-region-trait-bound-closure.rs:80:29
    |
 LL |     with_signature(cell, t, |cell, t| require(cell, t));
    |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -134,7 +134,7 @@ LL |     with_signature(cell, t, |cell, t| require(cell, t));
    = help: consider adding an explicit lifetime bound `<T as Anything<'_#6r, '_#7r>>::AssocType: ReEarlyBound(0, 'a)`...
 
 note: No external requirements
-  --> $DIR/projection-two-region-trait-bound-closure.rs:66:1
+  --> $DIR/projection-two-region-trait-bound-closure.rs:65:1
    |
 LL | / fn projection_outlives<'a, 'b, 'c, T>(cell: Cell<&'a ()>, t: T)
 LL | | where
@@ -153,7 +153,7 @@ LL | | }
            ]
 
 note: External requirements
-  --> $DIR/projection-two-region-trait-bound-closure.rs:92:29
+  --> $DIR/projection-two-region-trait-bound-closure.rs:91:29
    |
 LL |     with_signature(cell, t, |cell, t| require(cell, t));
    |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -170,7 +170,7 @@ LL |     with_signature(cell, t, |cell, t| require(cell, t));
    = note: where <T as Anything<ReClosureBound('_#2r), ReClosureBound('_#3r)>>::AssocType: '_#4r
 
 note: No external requirements
-  --> $DIR/projection-two-region-trait-bound-closure.rs:87:1
+  --> $DIR/projection-two-region-trait-bound-closure.rs:86:1
    |
 LL | / fn elements_outlive1<'a, 'b, 'c, T>(cell: Cell<&'a ()>, t: T)
 LL | | where
@@ -189,7 +189,7 @@ LL | | }
            ]
 
 note: External requirements
-  --> $DIR/projection-two-region-trait-bound-closure.rs:101:29
+  --> $DIR/projection-two-region-trait-bound-closure.rs:100:29
    |
 LL |     with_signature(cell, t, |cell, t| require(cell, t));
    |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -206,7 +206,7 @@ LL |     with_signature(cell, t, |cell, t| require(cell, t));
    = note: where <T as Anything<ReClosureBound('_#2r), ReClosureBound('_#3r)>>::AssocType: '_#4r
 
 note: No external requirements
-  --> $DIR/projection-two-region-trait-bound-closure.rs:96:1
+  --> $DIR/projection-two-region-trait-bound-closure.rs:95:1
    |
 LL | / fn elements_outlive2<'a, 'b, 'c, T>(cell: Cell<&'a ()>, t: T)
 LL | | where
@@ -225,7 +225,7 @@ LL | | }
            ]
 
 note: External requirements
-  --> $DIR/projection-two-region-trait-bound-closure.rs:109:29
+  --> $DIR/projection-two-region-trait-bound-closure.rs:108:29
    |
 LL |     with_signature(cell, t, |cell, t| require(cell, t));
    |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -240,13 +240,13 @@ LL |     with_signature(cell, t, |cell, t| require(cell, t));
    = note: where <T as Anything<ReClosureBound('_#1r), ReClosureBound('_#1r)>>::AssocType: '_#2r
 
 error: free region `ReEarlyBound(0, 'b)` does not outlive free region `ReFree(DefId(0/0:13 ~ projection_two_region_trait_bound_closure[317d]::two_regions[0]), BrNamed(crate0:DefIndex(1:43), 'a))`
-  --> $DIR/projection-two-region-trait-bound-closure.rs:109:20
+  --> $DIR/projection-two-region-trait-bound-closure.rs:108:20
    |
 LL |     with_signature(cell, t, |cell, t| require(cell, t));
    |                    ^^^^
 
 note: No external requirements
-  --> $DIR/projection-two-region-trait-bound-closure.rs:105:1
+  --> $DIR/projection-two-region-trait-bound-closure.rs:104:1
    |
 LL | / fn two_regions<'a, 'b, T>(cell: Cell<&'a ()>, t: T)
 LL | | where
@@ -263,7 +263,7 @@ LL | | }
            ]
 
 note: External requirements
-  --> $DIR/projection-two-region-trait-bound-closure.rs:120:29
+  --> $DIR/projection-two-region-trait-bound-closure.rs:119:29
    |
 LL |     with_signature(cell, t, |cell, t| require(cell, t));
    |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -279,7 +279,7 @@ LL |     with_signature(cell, t, |cell, t| require(cell, t));
    = note: where <T as Anything<ReClosureBound('_#2r), ReClosureBound('_#2r)>>::AssocType: '_#3r
 
 note: No external requirements
-  --> $DIR/projection-two-region-trait-bound-closure.rs:115:1
+  --> $DIR/projection-two-region-trait-bound-closure.rs:114:1
    |
 LL | / fn two_regions_outlive<'a, 'b, T>(cell: Cell<&'a ()>, t: T)
 LL | | where
@@ -297,7 +297,7 @@ LL | | }
            ]
 
 note: External requirements
-  --> $DIR/projection-two-region-trait-bound-closure.rs:132:29
+  --> $DIR/projection-two-region-trait-bound-closure.rs:131:29
    |
 LL |     with_signature(cell, t, |cell, t| require(cell, t));
    |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -312,7 +312,7 @@ LL |     with_signature(cell, t, |cell, t| require(cell, t));
    = note: where <T as Anything<ReClosureBound('_#1r), ReClosureBound('_#1r)>>::AssocType: '_#2r
 
 note: No external requirements
-  --> $DIR/projection-two-region-trait-bound-closure.rs:124:1
+  --> $DIR/projection-two-region-trait-bound-closure.rs:123:1
    |
 LL | / fn one_region<'a, T>(cell: Cell<&'a ()>, t: T)
 LL | | where
diff --git a/src/test/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.stderr b/src/test/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.stderr
index c8feaddff9382..b4f51401a90f6 100644
--- a/src/test/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.stderr
+++ b/src/test/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.stderr
@@ -1,23 +1,23 @@
 warning: not reporting region error due to nll
-  --> $DIR/ty-param-closure-approximate-lower-bound.rs:35:31
+  --> $DIR/ty-param-closure-approximate-lower-bound.rs:34:31
    |
 LL |     twice(cell, value, |a, b| invoke(a, b));
    |                               ^^^^^^^^^^^^
 
 warning: not reporting region error due to nll
-  --> $DIR/ty-param-closure-approximate-lower-bound.rs:43:31
+  --> $DIR/ty-param-closure-approximate-lower-bound.rs:42:31
    |
 LL |     twice(cell, value, |a, b| invoke(a, b));
    |                               ^^^^^^
 
 warning: not reporting region error due to nll
-  --> $DIR/ty-param-closure-approximate-lower-bound.rs:43:31
+  --> $DIR/ty-param-closure-approximate-lower-bound.rs:42:31
    |
 LL |     twice(cell, value, |a, b| invoke(a, b));
    |                               ^^^^^^^^^^^^
 
 note: External requirements
-  --> $DIR/ty-param-closure-approximate-lower-bound.rs:35:24
+  --> $DIR/ty-param-closure-approximate-lower-bound.rs:34:24
    |
 LL |     twice(cell, value, |a, b| invoke(a, b));
    |                        ^^^^^^^^^^^^^^^^^^^
@@ -31,7 +31,7 @@ LL |     twice(cell, value, |a, b| invoke(a, b));
    = note: where T: '_#1r
 
 note: No external requirements
-  --> $DIR/ty-param-closure-approximate-lower-bound.rs:33:1
+  --> $DIR/ty-param-closure-approximate-lower-bound.rs:32:1
    |
 LL | / fn generic<T>(value: T) {
 LL | |     let cell = Cell::new(&());
@@ -47,7 +47,7 @@ LL | | }
            ]
 
 note: External requirements
-  --> $DIR/ty-param-closure-approximate-lower-bound.rs:43:24
+  --> $DIR/ty-param-closure-approximate-lower-bound.rs:42:24
    |
 LL |     twice(cell, value, |a, b| invoke(a, b));
    |                        ^^^^^^^^^^^^^^^^^^^
@@ -61,7 +61,7 @@ LL |     twice(cell, value, |a, b| invoke(a, b));
    = note: where T: '_#1r
 
 error[E0309]: the parameter type `T` may not live long enough
-  --> $DIR/ty-param-closure-approximate-lower-bound.rs:43:24
+  --> $DIR/ty-param-closure-approximate-lower-bound.rs:42:24
    |
 LL |     twice(cell, value, |a, b| invoke(a, b));
    |                        ^^^^^^^^^^^^^^^^^^^
@@ -69,7 +69,7 @@ LL |     twice(cell, value, |a, b| invoke(a, b));
    = help: consider adding an explicit lifetime bound `T: ReFree(DefId(0/0:6 ~ ty_param_closure_approximate_lower_bound[317d]::generic_fail[0]), BrNamed(crate0:DefIndex(1:15), 'a))`...
 
 note: No external requirements
-  --> $DIR/ty-param-closure-approximate-lower-bound.rs:42:1
+  --> $DIR/ty-param-closure-approximate-lower-bound.rs:41:1
    |
 LL | / fn generic_fail<'a, T>(cell: Cell<&'a ()>, value: T) {
 LL | |     twice(cell, value, |a, b| invoke(a, b));
diff --git a/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr b/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr
index 500595e0c5dca..59a8a39a7b085 100644
--- a/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr
+++ b/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr
@@ -1,17 +1,17 @@
 warning: not reporting region error due to nll
-  --> $DIR/ty-param-closure-outlives-from-return-type.rs:37:27
+  --> $DIR/ty-param-closure-outlives-from-return-type.rs:36:27
    |
 LL |     with_signature(x, |y| y)
    |                           ^
 
 warning: not reporting region error due to nll
-  --> $DIR/ty-param-closure-outlives-from-return-type.rs:53:5
+  --> $DIR/ty-param-closure-outlives-from-return-type.rs:52:5
    |
 LL |     x
    |     ^
 
 note: External requirements
-  --> $DIR/ty-param-closure-outlives-from-return-type.rs:37:23
+  --> $DIR/ty-param-closure-outlives-from-return-type.rs:36:23
    |
 LL |     with_signature(x, |y| y)
    |                       ^^^^^
@@ -26,7 +26,7 @@ LL |     with_signature(x, |y| y)
    = note: where T: '_#2r
 
 error[E0309]: the parameter type `T` may not live long enough
-  --> $DIR/ty-param-closure-outlives-from-return-type.rs:37:23
+  --> $DIR/ty-param-closure-outlives-from-return-type.rs:36:23
    |
 LL |     with_signature(x, |y| y)
    |                       ^^^^^
@@ -34,7 +34,7 @@ LL |     with_signature(x, |y| y)
    = help: consider adding an explicit lifetime bound `T: ReEarlyBound(0, 'a)`...
 
 note: No external requirements
-  --> $DIR/ty-param-closure-outlives-from-return-type.rs:26:1
+  --> $DIR/ty-param-closure-outlives-from-return-type.rs:25:1
    |
 LL | / fn no_region<'a, T>(x: Box<T>) -> Box<dyn Debug + 'a>
 LL | | where
@@ -51,7 +51,7 @@ LL | | }
            ]
 
 error[E0309]: the parameter type `T` may not live long enough
-  --> $DIR/ty-param-closure-outlives-from-return-type.rs:53:5
+  --> $DIR/ty-param-closure-outlives-from-return-type.rs:52:5
    |
 LL |     x
    |     ^
diff --git a/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.stderr b/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.stderr
index 4d8a66ba8e1c4..a53ce21b7e6d2 100644
--- a/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.stderr
+++ b/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.stderr
@@ -1,17 +1,17 @@
 warning: not reporting region error due to nll
-  --> $DIR/ty-param-closure-outlives-from-where-clause.rs:45:9
+  --> $DIR/ty-param-closure-outlives-from-where-clause.rs:44:9
    |
 LL |         require(&x, &y)
    |         ^^^^^^^
 
 warning: not reporting region error due to nll
-  --> $DIR/ty-param-closure-outlives-from-where-clause.rs:79:9
+  --> $DIR/ty-param-closure-outlives-from-where-clause.rs:78:9
    |
 LL |         require(&x, &y)
    |         ^^^^^^^
 
 note: External requirements
-  --> $DIR/ty-param-closure-outlives-from-where-clause.rs:38:26
+  --> $DIR/ty-param-closure-outlives-from-where-clause.rs:37:26
    |
 LL |       with_signature(a, b, |x, y| {
    |  __________________________^
@@ -32,7 +32,7 @@ LL | |     })
    = note: where T: '_#1r
 
 error[E0309]: the parameter type `T` may not live long enough
-  --> $DIR/ty-param-closure-outlives-from-where-clause.rs:38:26
+  --> $DIR/ty-param-closure-outlives-from-where-clause.rs:37:26
    |
 LL |       with_signature(a, b, |x, y| {
    |  __________________________^
@@ -47,7 +47,7 @@ LL | |     })
    = help: consider adding an explicit lifetime bound `T: ReFree(DefId(0/0:6 ~ ty_param_closure_outlives_from_where_clause[317d]::no_region[0]), BrNamed(crate0:DefIndex(1:14), 'a))`...
 
 note: No external requirements
-  --> $DIR/ty-param-closure-outlives-from-where-clause.rs:37:1
+  --> $DIR/ty-param-closure-outlives-from-where-clause.rs:36:1
    |
 LL | / fn no_region<'a, T>(a: Cell<&'a ()>, b: T) {
 LL | |     with_signature(a, b, |x, y| {
@@ -63,7 +63,7 @@ LL | | }
            ]
 
 note: External requirements
-  --> $DIR/ty-param-closure-outlives-from-where-clause.rs:55:26
+  --> $DIR/ty-param-closure-outlives-from-where-clause.rs:54:26
    |
 LL |       with_signature(a, b, |x, y| {
    |  __________________________^
@@ -85,7 +85,7 @@ LL | |     })
    = note: where T: '_#2r
 
 note: No external requirements
-  --> $DIR/ty-param-closure-outlives-from-where-clause.rs:51:1
+  --> $DIR/ty-param-closure-outlives-from-where-clause.rs:50:1
    |
 LL | / fn correct_region<'a, T>(a: Cell<&'a ()>, b: T)
 LL | | where
@@ -102,7 +102,7 @@ LL | | }
            ]
 
 note: External requirements
-  --> $DIR/ty-param-closure-outlives-from-where-clause.rs:76:26
+  --> $DIR/ty-param-closure-outlives-from-where-clause.rs:75:26
    |
 LL |       with_signature(a, b, |x, y| {
    |  __________________________^
@@ -123,7 +123,7 @@ LL | |     })
    = note: where T: '_#2r
 
 error[E0309]: the parameter type `T` may not live long enough
-  --> $DIR/ty-param-closure-outlives-from-where-clause.rs:76:26
+  --> $DIR/ty-param-closure-outlives-from-where-clause.rs:75:26
    |
 LL |       with_signature(a, b, |x, y| {
    |  __________________________^
@@ -137,7 +137,7 @@ LL | |     })
    = help: consider adding an explicit lifetime bound `T: ReFree(DefId(0/0:8 ~ ty_param_closure_outlives_from_where_clause[317d]::wrong_region[0]), BrNamed(crate0:DefIndex(1:20), 'a))`...
 
 note: No external requirements
-  --> $DIR/ty-param-closure-outlives-from-where-clause.rs:72:1
+  --> $DIR/ty-param-closure-outlives-from-where-clause.rs:71:1
    |
 LL | / fn wrong_region<'a, 'b, T>(a: Cell<&'a ()>, b: T)
 LL | | where
@@ -154,7 +154,7 @@ LL | | }
            ]
 
 note: External requirements
-  --> $DIR/ty-param-closure-outlives-from-where-clause.rs:90:26
+  --> $DIR/ty-param-closure-outlives-from-where-clause.rs:89:26
    |
 LL |       with_signature(a, b, |x, y| {
    |  __________________________^
@@ -174,7 +174,7 @@ LL | |     })
    = note: where T: '_#3r
 
 note: No external requirements
-  --> $DIR/ty-param-closure-outlives-from-where-clause.rs:85:1
+  --> $DIR/ty-param-closure-outlives-from-where-clause.rs:84:1
    |
 LL | / fn outlives_region<'a, 'b, T>(a: Cell<&'a ()>, b: T)
 LL | | where
diff --git a/src/test/ui/nll/ty-outlives/ty-param-fn-body-nll-feature.stderr b/src/test/ui/nll/ty-outlives/ty-param-fn-body-nll-feature.stderr
index 1510ca61e5c75..dec15f47a0301 100644
--- a/src/test/ui/nll/ty-outlives/ty-param-fn-body-nll-feature.stderr
+++ b/src/test/ui/nll/ty-outlives/ty-param-fn-body-nll-feature.stderr
@@ -1,5 +1,5 @@
 error[E0309]: the parameter type `T` may not live long enough
-  --> $DIR/ty-param-fn-body-nll-feature.rs:31:5
+  --> $DIR/ty-param-fn-body-nll-feature.rs:30:5
    |
 LL |     outlives(cell, t)
    |     ^^^^^^^^^^^^^^^^^
diff --git a/src/test/ui/nll/ty-outlives/ty-param-fn-body.stderr b/src/test/ui/nll/ty-outlives/ty-param-fn-body.stderr
index 0596861e67b57..537f12234708e 100644
--- a/src/test/ui/nll/ty-outlives/ty-param-fn-body.stderr
+++ b/src/test/ui/nll/ty-outlives/ty-param-fn-body.stderr
@@ -1,11 +1,11 @@
 warning: not reporting region error due to nll
-  --> $DIR/ty-param-fn-body.rs:30:5
+  --> $DIR/ty-param-fn-body.rs:29:5
    |
 LL |     outlives(cell, t)
    |     ^^^^^^^^
 
 error[E0309]: the parameter type `T` may not live long enough
-  --> $DIR/ty-param-fn-body.rs:30:5
+  --> $DIR/ty-param-fn-body.rs:29:5
    |
 LL |     outlives(cell, t)
    |     ^^^^^^^^^^^^^^^^^
diff --git a/src/test/ui/nll/ty-outlives/ty-param-fn.stderr b/src/test/ui/nll/ty-outlives/ty-param-fn.stderr
index 0d09cac8c3851..5ce50d8118578 100644
--- a/src/test/ui/nll/ty-outlives/ty-param-fn.stderr
+++ b/src/test/ui/nll/ty-outlives/ty-param-fn.stderr
@@ -1,17 +1,17 @@
 warning: not reporting region error due to nll
-  --> $DIR/ty-param-fn.rs:22:5
+  --> $DIR/ty-param-fn.rs:21:5
    |
 LL |     x
    |     ^
 
 warning: not reporting region error due to nll
-  --> $DIR/ty-param-fn.rs:38:5
+  --> $DIR/ty-param-fn.rs:37:5
    |
 LL |     x
    |     ^
 
 error[E0309]: the parameter type `T` may not live long enough
-  --> $DIR/ty-param-fn.rs:22:5
+  --> $DIR/ty-param-fn.rs:21:5
    |
 LL |     x
    |     ^
@@ -19,7 +19,7 @@ LL |     x
    = help: consider adding an explicit lifetime bound `T: 'a`...
 
 error[E0309]: the parameter type `T` may not live long enough
-  --> $DIR/ty-param-fn.rs:38:5
+  --> $DIR/ty-param-fn.rs:37:5
    |
 LL |     x
    |     ^
diff --git a/src/test/ui/raw-literal-keywords.stderr b/src/test/ui/raw-literal-keywords.stderr
index 3758568323cc0..022f80ae8a4ec 100644
--- a/src/test/ui/raw-literal-keywords.stderr
+++ b/src/test/ui/raw-literal-keywords.stderr
@@ -1,17 +1,17 @@
 error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `true`
-  --> $DIR/raw-literal-keywords.rs:17:10
+  --> $DIR/raw-literal-keywords.rs:16:10
    |
 LL |     r#if true { } //~ ERROR found `true`
    |          ^^^^ expected one of 8 possible tokens here
 
 error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `Test`
-  --> $DIR/raw-literal-keywords.rs:21:14
+  --> $DIR/raw-literal-keywords.rs:20:14
    |
 LL |     r#struct Test; //~ ERROR found `Test`
    |              ^^^^ expected one of 8 possible tokens here
 
 error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `Test`
-  --> $DIR/raw-literal-keywords.rs:25:13
+  --> $DIR/raw-literal-keywords.rs:24:13
    |
 LL |     r#union Test; //~ ERROR found `Test`
    |             ^^^^ expected one of 8 possible tokens here
diff --git a/src/test/ui/underscore-lifetime/dyn-trait-underscore-in-struct.stderr b/src/test/ui/underscore-lifetime/dyn-trait-underscore-in-struct.stderr
index 6d777841f0319..1017217828a7b 100644
--- a/src/test/ui/underscore-lifetime/dyn-trait-underscore-in-struct.stderr
+++ b/src/test/ui/underscore-lifetime/dyn-trait-underscore-in-struct.stderr
@@ -1,11 +1,11 @@
 error[E0106]: missing lifetime specifier
-  --> $DIR/dyn-trait-underscore-in-struct.rs:21:24
+  --> $DIR/dyn-trait-underscore-in-struct.rs:19:24
    |
 LL |     x: Box<dyn Debug + '_>, //~ ERROR missing lifetime specifier
    |                        ^^ expected lifetime parameter
 
 error[E0228]: the lifetime bound for this object type cannot be deduced from context; please supply an explicit bound
-  --> $DIR/dyn-trait-underscore-in-struct.rs:21:12
+  --> $DIR/dyn-trait-underscore-in-struct.rs:19:12
    |
 LL |     x: Box<dyn Debug + '_>, //~ ERROR missing lifetime specifier
    |            ^^^^^^^^^^^^^^
diff --git a/src/test/ui/underscore-lifetime/dyn-trait-underscore.stderr b/src/test/ui/underscore-lifetime/dyn-trait-underscore.stderr
index f1e59aed54a36..98249d3f2b567 100644
--- a/src/test/ui/underscore-lifetime/dyn-trait-underscore.stderr
+++ b/src/test/ui/underscore-lifetime/dyn-trait-underscore.stderr
@@ -1,11 +1,11 @@
 error[E0495]: cannot infer an appropriate lifetime for autoref due to conflicting requirements
-  --> $DIR/dyn-trait-underscore.rs:20:20
+  --> $DIR/dyn-trait-underscore.rs:18:20
    |
 LL |     Box::new(items.iter()) //~ ERROR cannot infer an appropriate lifetime
    |                    ^^^^
    |
-note: first, the lifetime cannot outlive the anonymous lifetime #1 defined on the function body at 18:1...
-  --> $DIR/dyn-trait-underscore.rs:18:1
+note: first, the lifetime cannot outlive the anonymous lifetime #1 defined on the function body at 16:1...
+  --> $DIR/dyn-trait-underscore.rs:16:1
    |
 LL | / fn a<T>(items: &[T]) -> Box<dyn Iterator<Item=&T>> {
 LL | |     //                      ^^^^^^^^^^^^^^^^^^^^^ bound *here* defaults to `'static`
@@ -13,7 +13,7 @@ LL | |     Box::new(items.iter()) //~ ERROR cannot infer an appropriate lifetime
 LL | | }
    | |_^
 note: ...so that reference does not outlive borrowed content
-  --> $DIR/dyn-trait-underscore.rs:20:14
+  --> $DIR/dyn-trait-underscore.rs:18:14
    |
 LL |     Box::new(items.iter()) //~ ERROR cannot infer an appropriate lifetime
    |              ^^^^^

From 72a8eb92b083b22c610512c9c89c6bc97660de34 Mon Sep 17 00:00:00 2001
From: Christian Poveda <christianpoveda@protonmail.com>
Date: Sun, 15 Apr 2018 09:41:10 -0500
Subject: [PATCH 17/21] fixed rustc version for dyn_trait

---
 src/libsyntax/feature_gate.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs
index c4a0ec259b433..6ab8a54cf96ad 100644
--- a/src/libsyntax/feature_gate.rs
+++ b/src/libsyntax/feature_gate.rs
@@ -590,7 +590,7 @@ declare_features! (
     // Allows #[target_feature(...)]
     (accepted, target_feature, "1.27.0", None, None),
     // Trait object syntax with `dyn` prefix
-    (accepted, dyn_trait, "1.22.0", Some(44662), None),
+    (accepted, dyn_trait, "1.27.0", Some(44662), None),
 );
 
 // If you change this, please modify src/doc/unstable-book as well. You must

From cadf251b7874cbd94198ebef95e6260c118a2fef Mon Sep 17 00:00:00 2001
From: Christian Poveda <christianpoveda@protonmail.com>
Date: Wed, 18 Apr 2018 13:33:36 -0500
Subject: [PATCH 18/21] removed dyn trait attribute from librustdoc

---
 src/librustdoc/lib.rs | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs
index 60b713f2995e1..1819c7eb7d15f 100644
--- a/src/librustdoc/lib.rs
+++ b/src/librustdoc/lib.rs
@@ -23,7 +23,6 @@
 #![feature(test)]
 #![feature(vec_remove_item)]
 #![feature(entry_and_modify)]
-#![feature(dyn_trait)]
 
 extern crate arena;
 extern crate getopts;

From 74412d27074a0671fc68ea651f224a97d985e813 Mon Sep 17 00:00:00 2001
From: Guillaume Gomez <guillaume1.gomez@gmail.com>
Date: Fri, 27 Apr 2018 17:14:29 +0200
Subject: [PATCH 19/21] fix search load page failure

---
 src/librustdoc/html/layout.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/librustdoc/html/layout.rs b/src/librustdoc/html/layout.rs
index fd54e9bd1e06c..5e93b20ea17fd 100644
--- a/src/librustdoc/html/layout.rs
+++ b/src/librustdoc/html/layout.rs
@@ -146,9 +146,9 @@ pub fn render<T: fmt::Display, S: fmt::Display>(
         window.rootPath = \"{root_path}\";\
         window.currentCrate = \"{krate}\";\
     </script>\
+    <script src=\"{root_path}aliases.js\"></script>\
     <script src=\"{root_path}main{suffix}.js\"></script>\
     <script defer src=\"{root_path}search-index.js\"></script>\
-    <script defer src=\"{root_path}aliases.js\"></script>\
 </body>\
 </html>",
     css_extension = if css_file_extension {

From b80472d84c4b5b28fd22c5ef56af181bbf544c88 Mon Sep 17 00:00:00 2001
From: Christian Poveda <christianpoveda@protonmail.com>
Date: Wed, 25 Apr 2018 10:38:15 -0500
Subject: [PATCH 20/21] fixed tests

---
 src/test/compile-fail/impl-trait/where-allowed.rs      |  3 ---
 src/test/ui/impl_trait_projections.rs                  |  3 ---
 src/test/ui/impl_trait_projections.stderr              | 10 +++++-----
 .../ui/in-band-lifetimes/impl/dyn-trait.nll.stderr     |  4 ++--
 .../dyn-trait-underscore.nll.stderr                    | 10 +++++-----
 5 files changed, 12 insertions(+), 18 deletions(-)

diff --git a/src/test/compile-fail/impl-trait/where-allowed.rs b/src/test/compile-fail/impl-trait/where-allowed.rs
index f7b331238c6dd..2891cd59e3e1f 100644
--- a/src/test/compile-fail/impl-trait/where-allowed.rs
+++ b/src/test/compile-fail/impl-trait/where-allowed.rs
@@ -10,9 +10,6 @@
 
 //! A simple test for testing many permutations of allowedness of
 //! impl Trait
-
-#![feature(conservative_impl_trait, universal_impl_trait)]
-
 use std::fmt::Debug;
 
 // Allowed
diff --git a/src/test/ui/impl_trait_projections.rs b/src/test/ui/impl_trait_projections.rs
index e8f39e169ff9a..57a0040600a25 100644
--- a/src/test/ui/impl_trait_projections.rs
+++ b/src/test/ui/impl_trait_projections.rs
@@ -7,9 +7,6 @@
 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
-
-#![feature(conservative_impl_trait, universal_impl_trait)]
-
 use std::fmt::Debug;
 use std::option;
 
diff --git a/src/test/ui/impl_trait_projections.stderr b/src/test/ui/impl_trait_projections.stderr
index f0fe1a9754a95..f6d58984ecef7 100644
--- a/src/test/ui/impl_trait_projections.stderr
+++ b/src/test/ui/impl_trait_projections.stderr
@@ -1,29 +1,29 @@
 error[E0667]: `impl Trait` is not allowed in path parameters
-  --> $DIR/impl_trait_projections.rs:24:51
+  --> $DIR/impl_trait_projections.rs:21:51
    |
 LL | fn projection_is_disallowed(x: impl Iterator) -> <impl Iterator>::Item {
    |                                                   ^^^^^^^^^^^^^
 
 error[E0667]: `impl Trait` is not allowed in path parameters
-  --> $DIR/impl_trait_projections.rs:31:9
+  --> $DIR/impl_trait_projections.rs:28:9
    |
 LL |     -> <impl Iterator as Iterator>::Item
    |         ^^^^^^^^^^^^^
 
 error[E0667]: `impl Trait` is not allowed in path parameters
-  --> $DIR/impl_trait_projections.rs:38:27
+  --> $DIR/impl_trait_projections.rs:35:27
    |
 LL |     -> <::std::ops::Range<impl Debug> as Iterator>::Item
    |                           ^^^^^^^^^^
 
 error[E0667]: `impl Trait` is not allowed in path parameters
-  --> $DIR/impl_trait_projections.rs:45:29
+  --> $DIR/impl_trait_projections.rs:42:29
    |
 LL |     -> <dyn Iterator<Item = impl Debug> as Iterator>::Item
    |                             ^^^^^^^^^^
 
 error[E0223]: ambiguous associated type
-  --> $DIR/impl_trait_projections.rs:24:50
+  --> $DIR/impl_trait_projections.rs:21:50
    |
 LL | fn projection_is_disallowed(x: impl Iterator) -> <impl Iterator>::Item {
    |                                                  ^^^^^^^^^^^^^^^^^^^^^ ambiguous associated type
diff --git a/src/test/ui/in-band-lifetimes/impl/dyn-trait.nll.stderr b/src/test/ui/in-band-lifetimes/impl/dyn-trait.nll.stderr
index ec8c4ecf10246..4cf7feddd4654 100644
--- a/src/test/ui/in-band-lifetimes/impl/dyn-trait.nll.stderr
+++ b/src/test/ui/in-band-lifetimes/impl/dyn-trait.nll.stderr
@@ -1,11 +1,11 @@
 warning: not reporting region error due to nll
-  --> $DIR/dyn-trait.rs:33:16
+  --> $DIR/dyn-trait.rs:32:16
    |
 LL |     static_val(x); //~ ERROR cannot infer
    |                ^
 
 error: free region `'a` does not outlive free region `'static`
-  --> $DIR/dyn-trait.rs:33:5
+  --> $DIR/dyn-trait.rs:32:5
    |
 LL |     static_val(x); //~ ERROR cannot infer
    |     ^^^^^^^^^^^^^
diff --git a/src/test/ui/underscore-lifetime/dyn-trait-underscore.nll.stderr b/src/test/ui/underscore-lifetime/dyn-trait-underscore.nll.stderr
index 10a03786d7b1f..cdc0c78e69414 100644
--- a/src/test/ui/underscore-lifetime/dyn-trait-underscore.nll.stderr
+++ b/src/test/ui/underscore-lifetime/dyn-trait-underscore.nll.stderr
@@ -1,29 +1,29 @@
 warning: not reporting region error due to nll
-  --> $DIR/dyn-trait-underscore.rs:20:14
+  --> $DIR/dyn-trait-underscore.rs:18:14
    |
 LL |     Box::new(items.iter()) //~ ERROR cannot infer an appropriate lifetime
    |              ^^^^^
 
 warning: not reporting region error due to nll
-  --> $DIR/dyn-trait-underscore.rs:20:20
+  --> $DIR/dyn-trait-underscore.rs:18:20
    |
 LL |     Box::new(items.iter()) //~ ERROR cannot infer an appropriate lifetime
    |                    ^^^^
 
 warning: not reporting region error due to nll
-  --> $DIR/dyn-trait-underscore.rs:20:5
+  --> $DIR/dyn-trait-underscore.rs:18:5
    |
 LL |     Box::new(items.iter()) //~ ERROR cannot infer an appropriate lifetime
    |     ^^^^^^^^
 
 warning: not reporting region error due to nll
-  --> $DIR/dyn-trait-underscore.rs:20:5
+  --> $DIR/dyn-trait-underscore.rs:18:5
    |
 LL |     Box::new(items.iter()) //~ ERROR cannot infer an appropriate lifetime
    |     ^^^^^^^^^^^^^^^^^^^^^^
 
 error: free region `` does not outlive free region `'static`
-  --> $DIR/dyn-trait-underscore.rs:18:52
+  --> $DIR/dyn-trait-underscore.rs:16:52
    |
 LL |   fn a<T>(items: &[T]) -> Box<dyn Iterator<Item=&T>> {
    |  ____________________________________________________^

From b5c7cbf2f288967f55f8155a1ded7379ee4161f0 Mon Sep 17 00:00:00 2001
From: Christian Poveda <christianpoveda@protonmail.com>
Date: Wed, 25 Apr 2018 12:55:21 -0500
Subject: [PATCH 21/21] rustdoc asks for dyn_trait feature in stage0

---
 src/librustdoc/lib.rs | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs
index 1819c7eb7d15f..00153061fd5e9 100644
--- a/src/librustdoc/lib.rs
+++ b/src/librustdoc/lib.rs
@@ -13,6 +13,8 @@
        html_root_url = "https://doc.rust-lang.org/nightly/",
        html_playground_url = "https://play.rust-lang.org/")]
 
+#![cfg_attr(stage0, feature(dyn_trait))]
+
 #![feature(ascii_ctype)]
 #![feature(rustc_private)]
 #![feature(box_patterns)]