about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-05-26 01:09:02 +0000
committerbors <bors@rust-lang.org>2018-05-26 01:09:02 +0000
commit49a97ef010c731974f167174bb2e10465dfe745b (patch)
tree4b05c9e184d5d8735b55741d9049628911f96429 /src/test
parent07c415c2154f29d6dce8da0154ef41c8a5497fbf (diff)
parent3da712381d0d264e31dcfaf9b29bbe8d4a8d1474 (diff)
downloadrust-49a97ef010c731974f167174bb2e10465dfe745b.tar.gz
rust-49a97ef010c731974f167174bb2e10465dfe745b.zip
Auto merge of #50070 - toidiu:ak-2093-outlives, r=nikomatsakis
2093 infer outlives requirements

Tracking issue:  #44493
RFC: https://github.com/rust-lang/rfcs/pull/2093

- [x] add `rustc_attrs` flag
- [x] use `RequirePredicates` type
- [x]  handle explicit predicates on `dyn` Trait
- [x] handle explicit predicates on projections
- [x] more tests
- [x]  remove `unused`, `dead_code` and etc..
- [x]  documentation
Diffstat (limited to 'src/test')
-rw-r--r--src/test/compile-fail/outlives-associated-types.rs25
-rw-r--r--src/test/ui/rfc-2093-infer-outlives/explicit-dyn.rs (renamed from src/test/ui/rfc-2093-infer-outlives/multiple-regions.rs)15
-rw-r--r--src/test/ui/rfc-2093-infer-outlives/explicit-dyn.stderr13
-rw-r--r--src/test/ui/rfc-2093-infer-outlives/explicit-enum.rs (renamed from src/test/ui/rfc-2093-infer-outlives/projections-pass.rs)14
-rw-r--r--src/test/ui/rfc-2093-infer-outlives/explicit-enum.stderr12
-rw-r--r--src/test/ui/rfc-2093-infer-outlives/explicit-impl-lifetime-pass.rs30
-rw-r--r--src/test/ui/rfc-2093-infer-outlives/explicit-impl-pass.rs30
-rw-r--r--src/test/ui/rfc-2093-infer-outlives/explicit-impl.rs30
-rw-r--r--src/test/ui/rfc-2093-infer-outlives/explicit-impl.stderr17
-rw-r--r--src/test/ui/rfc-2093-infer-outlives/explicit-projection.rs24
-rw-r--r--src/test/ui/rfc-2093-infer-outlives/explicit-projection.stderr13
-rw-r--r--src/test/ui/rfc-2093-infer-outlives/explicit-struct.rs (renamed from src/test/ui/rfc-2093-infer-outlives/explicit-where-pass.rs)14
-rw-r--r--src/test/ui/rfc-2093-infer-outlives/explicit-struct.stderr12
-rw-r--r--src/test/ui/rfc-2093-infer-outlives/explicit-union.rs (renamed from src/test/ui/rfc-2093-infer-outlives/nested-structs-pass.rs)19
-rw-r--r--src/test/ui/rfc-2093-infer-outlives/explicit-union.stderr12
-rw-r--r--src/test/ui/rfc-2093-infer-outlives/explicit-where.rs23
-rw-r--r--src/test/ui/rfc-2093-infer-outlives/explicit-where.stderr17
-rw-r--r--src/test/ui/rfc-2093-infer-outlives/multiple-regions.stderr20
-rw-r--r--src/test/ui/rfc-2093-infer-outlives/nested-enum.rs (renamed from src/test/ui/rfc-2093-infer-outlives/enum-pass.rs)21
-rw-r--r--src/test/ui/rfc-2093-infer-outlives/nested-enum.stderr13
-rw-r--r--src/test/ui/rfc-2093-infer-outlives/nested-regions.rs (renamed from src/test/ui/rfc-2093-infer-outlives/multiple-regions-pass.rs)9
-rw-r--r--src/test/ui/rfc-2093-infer-outlives/nested-regions.stderr14
-rw-r--r--src/test/ui/rfc-2093-infer-outlives/nested-structs.rs15
-rw-r--r--src/test/ui/rfc-2093-infer-outlives/nested-structs.stderr19
-rw-r--r--src/test/ui/rfc-2093-infer-outlives/nested-union.rs (renamed from src/test/ui/rfc-2093-infer-outlives/union-pass.rs)20
-rw-r--r--src/test/ui/rfc-2093-infer-outlives/nested-union.stderr12
-rw-r--r--src/test/ui/rfc-2093-infer-outlives/projection.rs (renamed from src/test/ui/rfc-2093-infer-outlives/reference-pass.rs)11
-rw-r--r--src/test/ui/rfc-2093-infer-outlives/projection.stderr12
-rw-r--r--src/test/ui/rfc-2093-infer-outlives/projections.rs20
-rw-r--r--src/test/ui/rfc-2093-infer-outlives/projections.stderr16
-rw-r--r--src/test/ui/rfc-2093-infer-outlives/reference.rs13
-rw-r--r--src/test/ui/rfc-2093-infer-outlives/reference.stderr19
-rw-r--r--src/test/ui/rfc-2093-infer-outlives/self-dyn.rs25
-rw-r--r--src/test/ui/rfc-2093-infer-outlives/self-dyn.stderr13
-rw-r--r--src/test/ui/rfc-2093-infer-outlives/self-structs.rs24
-rw-r--r--src/test/ui/rfc-2093-infer-outlives/self-structs.stderr12
-rw-r--r--src/test/ui/rfc-2093-infer-outlives/union.rs40
-rw-r--r--src/test/ui/rfc-2093-infer-outlives/union.stderr31
38 files changed, 288 insertions, 411 deletions
diff --git a/src/test/compile-fail/outlives-associated-types.rs b/src/test/compile-fail/outlives-associated-types.rs
deleted file mode 100644
index 5c392223f88..00000000000
--- a/src/test/compile-fail/outlives-associated-types.rs
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-tidy-linelength
-
-// Test that the outlives computation runs for now...
-
-#![feature(rustc_attrs)]
-
-//todo add all the test cases
-// https://github.com/rust-lang/rfcs/blob/master/text/2093-infer-outlives.md#example-1-a-reference
-
-#[rustc_outlives]
-struct Direct<'a, T> { //~ ERROR 21:1: 23:2: [Binder(OutlivesPredicate(T, ReEarlyBound(0, 'a)))] [E0640]
-    field: &'a T
-}
-
-fn main() { }
diff --git a/src/test/ui/rfc-2093-infer-outlives/multiple-regions.rs b/src/test/ui/rfc-2093-infer-outlives/explicit-dyn.rs
index 7ea1ce2d3dc..445c246a120 100644
--- a/src/test/ui/rfc-2093-infer-outlives/multiple-regions.rs
+++ b/src/test/ui/rfc-2093-infer-outlives/explicit-dyn.rs
@@ -8,12 +8,17 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// Needs an explicit where clause stating outlives condition. (RFC 2093)
+#![feature(dyn_trait)]
+#![feature(rustc_attrs)]
+#![feature(infer_outlives_requirements)]
 
-// Lifetime 'b needs to outlive lifetime 'a
-struct Foo<'a,'b,T> {
-    x: &'a &'b T //~ ERROR reference has a longer lifetime than the data it references [E0491]
+trait Trait<'x, T> where T: 'x {
 }
 
-fn main() {}
+#[rustc_outlives]
+struct Foo<'a, A> //~ ERROR 19:1: 22:2: rustc_outlives
+{
+    foo: Box<dyn Trait<'a, A>>
+}
 
+fn main() {}
diff --git a/src/test/ui/rfc-2093-infer-outlives/explicit-dyn.stderr b/src/test/ui/rfc-2093-infer-outlives/explicit-dyn.stderr
new file mode 100644
index 00000000000..4bb5d90e964
--- /dev/null
+++ b/src/test/ui/rfc-2093-infer-outlives/explicit-dyn.stderr
@@ -0,0 +1,13 @@
+error: rustc_outlives
+  --> $DIR/explicit-dyn.rs:19:1
+   |
+LL | / struct Foo<'a, A> //~ ERROR 19:1: 22:2: rustc_outlives
+LL | | {
+LL | |     foo: Box<dyn Trait<'a, A>>
+LL | | }
+   | |_^
+   |
+   = note: A : 'a
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/rfc-2093-infer-outlives/projections-pass.rs b/src/test/ui/rfc-2093-infer-outlives/explicit-enum.rs
index 9c6e84cdd6e..e85b49bb0bf 100644
--- a/src/test/ui/rfc-2093-infer-outlives/projections-pass.rs
+++ b/src/test/ui/rfc-2093-infer-outlives/explicit-enum.rs
@@ -8,16 +8,18 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// compile-pass
-
+#![feature(rustc_attrs)]
 #![feature(infer_outlives_requirements)]
-// Outlives requirementes are inferred (RFC 2093)
 
-// projections: infer <Iterator>::Item: 'a
-struct ProjFoo<'a, T: Iterator> {
-    bar: &'a T::Item
+#[rustc_outlives]
+enum Foo<'a, U> { //~ ERROR 15:1: 17:2: rustc_outlives
+    One(Bar<'a, U>)
 }
 
+struct Bar<'x, T> where T: 'x {
+    x: &'x (),
+    y: T,
+}
 
 fn main() {}
 
diff --git a/src/test/ui/rfc-2093-infer-outlives/explicit-enum.stderr b/src/test/ui/rfc-2093-infer-outlives/explicit-enum.stderr
new file mode 100644
index 00000000000..d7438758d77
--- /dev/null
+++ b/src/test/ui/rfc-2093-infer-outlives/explicit-enum.stderr
@@ -0,0 +1,12 @@
+error: rustc_outlives
+  --> $DIR/explicit-enum.rs:15:1
+   |
+LL | / enum Foo<'a, U> { //~ ERROR 15:1: 17:2: rustc_outlives
+LL | |     One(Bar<'a, U>)
+LL | | }
+   | |_^
+   |
+   = note: U : 'a
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/rfc-2093-infer-outlives/explicit-impl-lifetime-pass.rs b/src/test/ui/rfc-2093-infer-outlives/explicit-impl-lifetime-pass.rs
deleted file mode 100644
index 45449fa0cf8..00000000000
--- a/src/test/ui/rfc-2093-infer-outlives/explicit-impl-lifetime-pass.rs
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-test
-// compile-pass
-
-#![feature(infer_outlives_requirements)]
-// Outlives requirementes are inferred (RFC 2093)
-
-trait MakeRef<'a>: 'a {
-    type Type;
-}
-impl<'a, T> MakeRef<'a> for Vec<T>
-where T: 'a,
-{
-    type Type = &'a T;
-}
-// explicit-impl: T: 'a
-struct Foo<'a, T> {
-    foo: <Vec<T> as MakeRef<'a>>::Type,
-}
-
-fn main() {}
diff --git a/src/test/ui/rfc-2093-infer-outlives/explicit-impl-pass.rs b/src/test/ui/rfc-2093-infer-outlives/explicit-impl-pass.rs
deleted file mode 100644
index bfd6db1eb5d..00000000000
--- a/src/test/ui/rfc-2093-infer-outlives/explicit-impl-pass.rs
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-test
-// compile-pass
-
-#![feature(infer_outlives_requirements)]
-// Outlives requirementes are inferred (RFC 2093)
-
-trait MakeRef<'a> {
-    type Type;
-}
-impl<'a, T> MakeRef<'a> for Vec<T>
-where T: 'a,
-{
-    type Type = &'a T;
-}
-// explicit-impl: T: 'a
-struct Foo<'a, T> {
-    foo: <Vec<T> as MakeRef<'a>>::Type,
-}
-
-fn main() {}
diff --git a/src/test/ui/rfc-2093-infer-outlives/explicit-impl.rs b/src/test/ui/rfc-2093-infer-outlives/explicit-impl.rs
deleted file mode 100644
index 3a10087551c..00000000000
--- a/src/test/ui/rfc-2093-infer-outlives/explicit-impl.rs
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-tidy-linelength
-
-// Needs an explicit where clause stating outlives condition. (RFC 2093)
-
-trait MakeRef<'a> {
-    type Type;
-}
-
-impl<'a, T> MakeRef<'a> for Vec<T>
-  where T: 'a
-{
-    type Type = &'a T;
-}
-
-// Type T needs to outlive lifetime 'a, as stated in impl.
-struct Foo<'a, T> {
-    foo: <Vec<T> as MakeRef<'a>>::Type //~ Error the parameter type `T` may not live long enough [E0309]
-}
-
-fn main() { }
diff --git a/src/test/ui/rfc-2093-infer-outlives/explicit-impl.stderr b/src/test/ui/rfc-2093-infer-outlives/explicit-impl.stderr
deleted file mode 100644
index 498d66ef9a5..00000000000
--- a/src/test/ui/rfc-2093-infer-outlives/explicit-impl.stderr
+++ /dev/null
@@ -1,17 +0,0 @@
-error[E0309]: the parameter type `T` may not live long enough
-  --> $DIR/explicit-impl.rs:27:5
-   |
-LL | struct Foo<'a, T> {
-   |                - help: consider adding an explicit lifetime bound `T: 'a`...
-LL |     foo: <Vec<T> as MakeRef<'a>>::Type //~ Error the parameter type `T` may not live long enough [E0309]
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-note: ...so that the type `T` will meet its required lifetime bounds
-  --> $DIR/explicit-impl.rs:27:5
-   |
-LL |     foo: <Vec<T> as MakeRef<'a>>::Type //~ Error the parameter type `T` may not live long enough [E0309]
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0309`.
diff --git a/src/test/ui/rfc-2093-infer-outlives/explicit-projection.rs b/src/test/ui/rfc-2093-infer-outlives/explicit-projection.rs
new file mode 100644
index 00000000000..2662043c36d
--- /dev/null
+++ b/src/test/ui/rfc-2093-infer-outlives/explicit-projection.rs
@@ -0,0 +1,24 @@
+// 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(rustc_attrs)]
+#![feature(infer_outlives_requirements)]
+
+trait Trait<'x, T> where T: 'x {
+    type Type;
+}
+
+#[rustc_outlives]
+struct Foo<'a, A, B> where A: Trait<'a, B> //~ ERROR rustc_outlives
+{
+    foo: <A as Trait<'a, B>>::Type
+}
+
+fn main() {}
diff --git a/src/test/ui/rfc-2093-infer-outlives/explicit-projection.stderr b/src/test/ui/rfc-2093-infer-outlives/explicit-projection.stderr
new file mode 100644
index 00000000000..43ab02d01ed
--- /dev/null
+++ b/src/test/ui/rfc-2093-infer-outlives/explicit-projection.stderr
@@ -0,0 +1,13 @@
+error: rustc_outlives
+  --> $DIR/explicit-projection.rs:19:1
+   |
+LL | / struct Foo<'a, A, B> where A: Trait<'a, B> //~ ERROR rustc_outlives
+LL | | {
+LL | |     foo: <A as Trait<'a, B>>::Type
+LL | | }
+   | |_^
+   |
+   = note: B : 'a
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/rfc-2093-infer-outlives/explicit-where-pass.rs b/src/test/ui/rfc-2093-infer-outlives/explicit-struct.rs
index fd5fc79a2ab..d42c9160e1e 100644
--- a/src/test/ui/rfc-2093-infer-outlives/explicit-where-pass.rs
+++ b/src/test/ui/rfc-2093-infer-outlives/explicit-struct.rs
@@ -8,20 +8,18 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// compile-pass
-
+#![feature(rustc_attrs)]
 #![feature(infer_outlives_requirements)]
-// Outlives requirementes are inferred (RFC 2093)
 
-// explicit-where: infer U: 'b
-struct ExFoo<'b, U> {
-    bar: ExBar<'b, U>
+#[rustc_outlives]
+struct Foo<'b, U> { //~ ERROR 15:1: 17:2: rustc_outlives
+    bar: Bar<'b, U>
 }
-struct ExBar<'a, T> where T: 'a {
+
+struct Bar<'a, T> where T: 'a {
     x: &'a (),
     y: T,
 }
 
-
 fn main() {}
 
diff --git a/src/test/ui/rfc-2093-infer-outlives/explicit-struct.stderr b/src/test/ui/rfc-2093-infer-outlives/explicit-struct.stderr
new file mode 100644
index 00000000000..0223f707e8d
--- /dev/null
+++ b/src/test/ui/rfc-2093-infer-outlives/explicit-struct.stderr
@@ -0,0 +1,12 @@
+error: rustc_outlives
+  --> $DIR/explicit-struct.rs:15:1
+   |
+LL | / struct Foo<'b, U> { //~ ERROR 15:1: 17:2: rustc_outlives
+LL | |     bar: Bar<'b, U>
+LL | | }
+   | |_^
+   |
+   = note: U : 'b
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/rfc-2093-infer-outlives/nested-structs-pass.rs b/src/test/ui/rfc-2093-infer-outlives/explicit-union.rs
index 9432804cc42..e548b247193 100644
--- a/src/test/ui/rfc-2093-infer-outlives/nested-structs-pass.rs
+++ b/src/test/ui/rfc-2093-infer-outlives/explicit-union.rs
@@ -8,17 +8,20 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// compile-pass
-
+#![feature(rustc_attrs)]
 #![feature(infer_outlives_requirements)]
-// Outlives requirementes are inferred (RFC 2093)
+#![feature(untagged_unions)]
+#![allow(unions_with_drop_fields)]
+
 
-// nested-structs: infer U: 'b and therefore T: 'a
-struct NestFoo<'a, T> {
-    field1: NestBar<'a, T>
+#[rustc_outlives]
+union Foo<'b, U> { //~ ERROR 18:1: 20:2: rustc_outlives
+    bar: Bar<'b, U>
 }
-struct NestBar<'b, U> {
-    field2: &'b U
+
+union Bar<'a, T> where T: 'a {
+    x: &'a (),
+    y: T,
 }
 
 fn main() {}
diff --git a/src/test/ui/rfc-2093-infer-outlives/explicit-union.stderr b/src/test/ui/rfc-2093-infer-outlives/explicit-union.stderr
new file mode 100644
index 00000000000..8622ae12aa1
--- /dev/null
+++ b/src/test/ui/rfc-2093-infer-outlives/explicit-union.stderr
@@ -0,0 +1,12 @@
+error: rustc_outlives
+  --> $DIR/explicit-union.rs:18:1
+   |
+LL | / union Foo<'b, U> { //~ ERROR 18:1: 20:2: rustc_outlives
+LL | |     bar: Bar<'b, U>
+LL | | }
+   | |_^
+   |
+   = note: U : 'b
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/rfc-2093-infer-outlives/explicit-where.rs b/src/test/ui/rfc-2093-infer-outlives/explicit-where.rs
deleted file mode 100644
index 81734bf514e..00000000000
--- a/src/test/ui/rfc-2093-infer-outlives/explicit-where.rs
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Needs an explicit where clause stating outlives condition. (RFC 2093)
-
-// Type U needs to outlive lifetime 'b.
-struct Foo<'b, U> {
-    bar: Bar<'b, U> //~ Error the parameter type `U` may not live long enough [E0309]
-}
-
-struct Bar<'a, T> where T: 'a {
-    x: &'a (),
-    y: T,
-}
-
-fn main() { }
diff --git a/src/test/ui/rfc-2093-infer-outlives/explicit-where.stderr b/src/test/ui/rfc-2093-infer-outlives/explicit-where.stderr
deleted file mode 100644
index 436754c7dc1..00000000000
--- a/src/test/ui/rfc-2093-infer-outlives/explicit-where.stderr
+++ /dev/null
@@ -1,17 +0,0 @@
-error[E0309]: the parameter type `U` may not live long enough
-  --> $DIR/explicit-where.rs:15:5
-   |
-LL | struct Foo<'b, U> {
-   |                - help: consider adding an explicit lifetime bound `U: 'b`...
-LL |     bar: Bar<'b, U> //~ Error the parameter type `U` may not live long enough [E0309]
-   |     ^^^^^^^^^^^^^^^
-   |
-note: ...so that the type `U` will meet its required lifetime bounds
-  --> $DIR/explicit-where.rs:15:5
-   |
-LL |     bar: Bar<'b, U> //~ Error the parameter type `U` may not live long enough [E0309]
-   |     ^^^^^^^^^^^^^^^
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0309`.
diff --git a/src/test/ui/rfc-2093-infer-outlives/multiple-regions.stderr b/src/test/ui/rfc-2093-infer-outlives/multiple-regions.stderr
deleted file mode 100644
index 3722abd5ad6..00000000000
--- a/src/test/ui/rfc-2093-infer-outlives/multiple-regions.stderr
+++ /dev/null
@@ -1,20 +0,0 @@
-error[E0491]: in type `&'a &'b T`, reference has a longer lifetime than the data it references
-  --> $DIR/multiple-regions.rs:15:5
-   |
-LL |     x: &'a &'b T //~ ERROR reference has a longer lifetime than the data it references [E0491]
-   |     ^^^^^^^^^^^^
-   |
-note: the pointer is valid for the lifetime 'a as defined on the struct at 14:1
-  --> $DIR/multiple-regions.rs:14:1
-   |
-LL | struct Foo<'a,'b,T> {
-   | ^^^^^^^^^^^^^^^^^^^
-note: but the referenced data is only valid for the lifetime 'b as defined on the struct at 14:1
-  --> $DIR/multiple-regions.rs:14:1
-   |
-LL | struct Foo<'a,'b,T> {
-   | ^^^^^^^^^^^^^^^^^^^
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0491`.
diff --git a/src/test/ui/rfc-2093-infer-outlives/enum-pass.rs b/src/test/ui/rfc-2093-infer-outlives/nested-enum.rs
index 2a28bde78a8..85f381ea515 100644
--- a/src/test/ui/rfc-2093-infer-outlives/enum-pass.rs
+++ b/src/test/ui/rfc-2093-infer-outlives/nested-enum.rs
@@ -8,31 +8,18 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// compile-pass
-
+#![feature(rustc_attrs)]
 #![feature(infer_outlives_requirements)]
 
-// Type T needs to outlive lifetime 'a.
-enum Foo<'a, T> {
+
+#[rustc_outlives]
+enum Foo<'a, T> { //~ ERROR 16:1: 19:2: rustc_outlives
 
     One(Bar<'a, T>)
 }
 
-// Type U needs to outlive lifetime 'b
 struct Bar<'b, U> {
     field2: &'b U
 }
 
-
-
-// Type K needs to outlive lifetime 'c.
-enum Ying<'c, K> {
-    One(&'c Yang<K>)
-}
-
-struct Yang<V> {
-    field2: V
-}
-
 fn main() {}
-
diff --git a/src/test/ui/rfc-2093-infer-outlives/nested-enum.stderr b/src/test/ui/rfc-2093-infer-outlives/nested-enum.stderr
new file mode 100644
index 00000000000..54a886a92fd
--- /dev/null
+++ b/src/test/ui/rfc-2093-infer-outlives/nested-enum.stderr
@@ -0,0 +1,13 @@
+error: rustc_outlives
+  --> $DIR/nested-enum.rs:16:1
+   |
+LL | / enum Foo<'a, T> { //~ ERROR 16:1: 19:2: rustc_outlives
+LL | |
+LL | |     One(Bar<'a, T>)
+LL | | }
+   | |_^
+   |
+   = note: T : 'a
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/rfc-2093-infer-outlives/multiple-regions-pass.rs b/src/test/ui/rfc-2093-infer-outlives/nested-regions.rs
index 290dbd330a2..792d2a02962 100644
--- a/src/test/ui/rfc-2093-infer-outlives/multiple-regions-pass.rs
+++ b/src/test/ui/rfc-2093-infer-outlives/nested-regions.rs
@@ -8,15 +8,12 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// compile-pass
-
+#![feature(rustc_attrs)]
 #![feature(infer_outlives_requirements)]
-// Outlives requirementes are inferred (RFC 2093)
 
-// multiple-regions: infer 'b: 'a
-struct MultiFoo<'a, 'b, T> {
+#[rustc_outlives]
+struct Foo<'a, 'b, T> { //~ ERROR 15:1: 17:2: rustc_outlives
     x: &'a &'b T
 }
 
 fn main() {}
-
diff --git a/src/test/ui/rfc-2093-infer-outlives/nested-regions.stderr b/src/test/ui/rfc-2093-infer-outlives/nested-regions.stderr
new file mode 100644
index 00000000000..04fe4814a04
--- /dev/null
+++ b/src/test/ui/rfc-2093-infer-outlives/nested-regions.stderr
@@ -0,0 +1,14 @@
+error: rustc_outlives
+  --> $DIR/nested-regions.rs:15:1
+   |
+LL | / struct Foo<'a, 'b, T> { //~ ERROR 15:1: 17:2: rustc_outlives
+LL | |     x: &'a &'b T
+LL | | }
+   | |_^
+   |
+   = note: 'b : 'a
+   = note: T : 'a
+   = note: T : 'b
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/rfc-2093-infer-outlives/nested-structs.rs b/src/test/ui/rfc-2093-infer-outlives/nested-structs.rs
index 7c444dbd3b0..71a36dfb344 100644
--- a/src/test/ui/rfc-2093-infer-outlives/nested-structs.rs
+++ b/src/test/ui/rfc-2093-infer-outlives/nested-structs.rs
@@ -1,4 +1,4 @@
-// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
 // file at the top-level directory of this distribution and at
 // http://rust-lang.org/COPYRIGHT.
 //
@@ -8,19 +8,16 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// Needs an explicit where clause stating outlives condition. (RFC 2093)
+#![feature(rustc_attrs)]
+#![feature(infer_outlives_requirements)]
 
-
-// Type T needs to outlive lifetime 'a. This is not reported due to
-// a compilation error in Bar.
-struct Foo<'a, T> {
+#[rustc_outlives]
+struct Foo<'a, T> { //~ ERROR 15:1: 17:2: rustc_outlives
     field1: Bar<'a, T>
 }
 
-// Type U needs to outlive lifetime 'b
 struct Bar<'b, U> {
-    field2: &'b U //~ ERROR the parameter type `U` may not live long enough [E0309]
+    field2: &'b U
 }
 
 fn main() {}
-
diff --git a/src/test/ui/rfc-2093-infer-outlives/nested-structs.stderr b/src/test/ui/rfc-2093-infer-outlives/nested-structs.stderr
index 94d6cbdb5fe..abea71f2d12 100644
--- a/src/test/ui/rfc-2093-infer-outlives/nested-structs.stderr
+++ b/src/test/ui/rfc-2093-infer-outlives/nested-structs.stderr
@@ -1,17 +1,12 @@
-error[E0309]: the parameter type `U` may not live long enough
-  --> $DIR/nested-structs.rs:22:5
+error: rustc_outlives
+  --> $DIR/nested-structs.rs:15:1
    |
-LL | struct Bar<'b, U> {
-   |                - help: consider adding an explicit lifetime bound `U: 'b`...
-LL |     field2: &'b U //~ ERROR the parameter type `U` may not live long enough [E0309]
-   |     ^^^^^^^^^^^^^
+LL | / struct Foo<'a, T> { //~ ERROR 15:1: 17:2: rustc_outlives
+LL | |     field1: Bar<'a, T>
+LL | | }
+   | |_^
    |
-note: ...so that the reference type `&'b U` does not outlive the data it points at
-  --> $DIR/nested-structs.rs:22:5
-   |
-LL |     field2: &'b U //~ ERROR the parameter type `U` may not live long enough [E0309]
-   |     ^^^^^^^^^^^^^
+   = note: T : 'a
 
 error: aborting due to previous error
 
-For more information about this error, try `rustc --explain E0309`.
diff --git a/src/test/ui/rfc-2093-infer-outlives/union-pass.rs b/src/test/ui/rfc-2093-infer-outlives/nested-union.rs
index 5e46c2b7f5c..0720e581e2c 100644
--- a/src/test/ui/rfc-2093-infer-outlives/union-pass.rs
+++ b/src/test/ui/rfc-2093-infer-outlives/nested-union.rs
@@ -8,15 +8,14 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// compile-pass
-
+#![feature(rustc_attrs)]
 #![feature(infer_outlives_requirements)]
 #![feature(untagged_unions)]
 #![allow(unions_with_drop_fields)]
 
-// Type T needs to outlive lifetime 'a. This is not reported due to
-// a compilation error in Bar.
-union Foo<'a, T> {
+
+#[rustc_outlives]
+union Foo<'a, T> { //~ ERROR 18:1: 20:2: rustc_outlives
     field1: Bar<'a, T>
 }
 
@@ -25,15 +24,4 @@ union Bar<'b, U> {
     field2: &'b U
 }
 
-
-// Type K needs to outlive lifetime 'c.
-union Ying<'c, K> {
-    field1: &'c Yang<K>
-}
-
-union Yang<V> {
-    field2: V
-}
-
 fn main() {}
-
diff --git a/src/test/ui/rfc-2093-infer-outlives/nested-union.stderr b/src/test/ui/rfc-2093-infer-outlives/nested-union.stderr
new file mode 100644
index 00000000000..b7b50c15061
--- /dev/null
+++ b/src/test/ui/rfc-2093-infer-outlives/nested-union.stderr
@@ -0,0 +1,12 @@
+error: rustc_outlives
+  --> $DIR/nested-union.rs:18:1
+   |
+LL | / union Foo<'a, T> { //~ ERROR 18:1: 20:2: rustc_outlives
+LL | |     field1: Bar<'a, T>
+LL | | }
+   | |_^
+   |
+   = note: T : 'a
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/rfc-2093-infer-outlives/reference-pass.rs b/src/test/ui/rfc-2093-infer-outlives/projection.rs
index 903b8a9ddbf..3abce873b28 100644
--- a/src/test/ui/rfc-2093-infer-outlives/reference-pass.rs
+++ b/src/test/ui/rfc-2093-infer-outlives/projection.rs
@@ -8,16 +8,13 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// compile-pass
-
+#![feature(rustc_attrs)]
 #![feature(infer_outlives_requirements)]
-// Outlives requirementes are inferred (RFC 2093)
 
-// reference: infer T: 'a
-struct RefFoo<'a, T> {
-    bar: &'a [T]
+#[rustc_outlives]
+struct Foo<'a, T: Iterator> { //~ ERROR rustc_outlives
+    bar: &'a T::Item
 }
 
-
 fn main() {}
 
diff --git a/src/test/ui/rfc-2093-infer-outlives/projection.stderr b/src/test/ui/rfc-2093-infer-outlives/projection.stderr
new file mode 100644
index 00000000000..dfaf7793a51
--- /dev/null
+++ b/src/test/ui/rfc-2093-infer-outlives/projection.stderr
@@ -0,0 +1,12 @@
+error: rustc_outlives
+  --> $DIR/projection.rs:15:1
+   |
+LL | / struct Foo<'a, T: Iterator> { //~ ERROR rustc_outlives
+LL | |     bar: &'a T::Item
+LL | | }
+   | |_^
+   |
+   = note: <T as std::iter::Iterator>::Item : 'a
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/rfc-2093-infer-outlives/projections.rs b/src/test/ui/rfc-2093-infer-outlives/projections.rs
deleted file mode 100644
index f6a557c174c..00000000000
--- a/src/test/ui/rfc-2093-infer-outlives/projections.rs
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-tidy-linelength
-
-// Needs an explicit where clause stating outlives condition. RFC 2093
-
-// Associated type <Iterator>::Item  needs to outlives lifetime 'a.
-struct Foo<'a, T: Iterator> {
-    bar: &'a T::Item //~ Error the associated type `<T as std::iter::Iterator>::Item` may not live long enough [E0309]
-}
-
-fn main() { }
diff --git a/src/test/ui/rfc-2093-infer-outlives/projections.stderr b/src/test/ui/rfc-2093-infer-outlives/projections.stderr
deleted file mode 100644
index 9969cf48ecd..00000000000
--- a/src/test/ui/rfc-2093-infer-outlives/projections.stderr
+++ /dev/null
@@ -1,16 +0,0 @@
-error[E0309]: the associated type `<T as std::iter::Iterator>::Item` may not live long enough
-  --> $DIR/projections.rs:17:5
-   |
-LL |     bar: &'a T::Item //~ Error the associated type `<T as std::iter::Iterator>::Item` may not live long enough [E0309]
-   |     ^^^^^^^^^^^^^^^^
-   |
-   = help: consider adding an explicit lifetime bound `<T as std::iter::Iterator>::Item: 'a`...
-note: ...so that the reference type `&'a <T as std::iter::Iterator>::Item` does not outlive the data it points at
-  --> $DIR/projections.rs:17:5
-   |
-LL |     bar: &'a T::Item //~ Error the associated type `<T as std::iter::Iterator>::Item` may not live long enough [E0309]
-   |     ^^^^^^^^^^^^^^^^
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0309`.
diff --git a/src/test/ui/rfc-2093-infer-outlives/reference.rs b/src/test/ui/rfc-2093-infer-outlives/reference.rs
index 01ccc50a130..56b1bc3c7d1 100644
--- a/src/test/ui/rfc-2093-infer-outlives/reference.rs
+++ b/src/test/ui/rfc-2093-infer-outlives/reference.rs
@@ -1,4 +1,4 @@
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// 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.
 //
@@ -8,11 +8,12 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// Needs an explicit where clause stating outlives condition. (RFC 2093)
+#![feature(rustc_attrs)]
+#![feature(infer_outlives_requirements)]
 
-// Type T needs to outlive lifetime 'a.
-struct Foo<'a, T> {
-    bar: &'a [T] //~ ERROR the parameter type `T` may not live long enough [E0309]
+#[rustc_outlives]
+struct Foo<'a, T> { //~ ERROR rustc_outlives
+    bar: &'a T,
 }
 
-fn main() { }
+fn main() {}
diff --git a/src/test/ui/rfc-2093-infer-outlives/reference.stderr b/src/test/ui/rfc-2093-infer-outlives/reference.stderr
index 7236bd535c9..785d76e8f22 100644
--- a/src/test/ui/rfc-2093-infer-outlives/reference.stderr
+++ b/src/test/ui/rfc-2093-infer-outlives/reference.stderr
@@ -1,17 +1,12 @@
-error[E0309]: the parameter type `T` may not live long enough
-  --> $DIR/reference.rs:15:5
+error: rustc_outlives
+  --> $DIR/reference.rs:15:1
    |
-LL | struct Foo<'a, T> {
-   |                - help: consider adding an explicit lifetime bound `T: 'a`...
-LL |     bar: &'a [T] //~ ERROR the parameter type `T` may not live long enough [E0309]
-   |     ^^^^^^^^^^^^
+LL | / struct Foo<'a, T> { //~ ERROR rustc_outlives
+LL | |     bar: &'a T,
+LL | | }
+   | |_^
    |
-note: ...so that the reference type `&'a [T]` does not outlive the data it points at
-  --> $DIR/reference.rs:15:5
-   |
-LL |     bar: &'a [T] //~ ERROR the parameter type `T` may not live long enough [E0309]
-   |     ^^^^^^^^^^^^
+   = note: T : 'a
 
 error: aborting due to previous error
 
-For more information about this error, try `rustc --explain E0309`.
diff --git a/src/test/ui/rfc-2093-infer-outlives/self-dyn.rs b/src/test/ui/rfc-2093-infer-outlives/self-dyn.rs
new file mode 100644
index 00000000000..a19bcf8afff
--- /dev/null
+++ b/src/test/ui/rfc-2093-infer-outlives/self-dyn.rs
@@ -0,0 +1,25 @@
+// 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(dyn_trait)]
+#![feature(rustc_attrs)]
+#![feature(infer_outlives_requirements)]
+
+trait Trait<'x, 's, T> where T: 'x,
+      's: {
+}
+
+#[rustc_outlives]
+struct Foo<'a, 'b, A> //~ ERROR 20:1: 23:2: rustc_outlives
+{
+    foo: Box<dyn Trait<'a, 'b, A>>
+}
+
+fn main() {}
diff --git a/src/test/ui/rfc-2093-infer-outlives/self-dyn.stderr b/src/test/ui/rfc-2093-infer-outlives/self-dyn.stderr
new file mode 100644
index 00000000000..546ba9db644
--- /dev/null
+++ b/src/test/ui/rfc-2093-infer-outlives/self-dyn.stderr
@@ -0,0 +1,13 @@
+error: rustc_outlives
+  --> $DIR/self-dyn.rs:20:1
+   |
+LL | / struct Foo<'a, 'b, A> //~ ERROR 20:1: 23:2: rustc_outlives
+LL | | {
+LL | |     foo: Box<dyn Trait<'a, 'b, A>>
+LL | | }
+   | |_^
+   |
+   = note: A : 'a
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/rfc-2093-infer-outlives/self-structs.rs b/src/test/ui/rfc-2093-infer-outlives/self-structs.rs
new file mode 100644
index 00000000000..c4f8f83bdce
--- /dev/null
+++ b/src/test/ui/rfc-2093-infer-outlives/self-structs.rs
@@ -0,0 +1,24 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(rustc_attrs)]
+#![feature(infer_outlives_requirements)]
+
+#[rustc_outlives]
+struct Foo<'a, 'b, T> { //~ ERROR 15:1: 17:2: rustc_outlives
+    field1: Bar<'a, 'b, T>
+}
+
+trait Bar<'x, 's, U>
+    where U: 'x,
+    Self:'s
+{}
+
+fn main() {}
diff --git a/src/test/ui/rfc-2093-infer-outlives/self-structs.stderr b/src/test/ui/rfc-2093-infer-outlives/self-structs.stderr
new file mode 100644
index 00000000000..04284577a07
--- /dev/null
+++ b/src/test/ui/rfc-2093-infer-outlives/self-structs.stderr
@@ -0,0 +1,12 @@
+error: rustc_outlives
+  --> $DIR/self-structs.rs:15:1
+   |
+LL | / struct Foo<'a, 'b, T> { //~ ERROR 15:1: 17:2: rustc_outlives
+LL | |     field1: Bar<'a, 'b, T>
+LL | | }
+   | |_^
+   |
+   = note: T : 'a
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/rfc-2093-infer-outlives/union.rs b/src/test/ui/rfc-2093-infer-outlives/union.rs
deleted file mode 100644
index 36b1dccb13e..00000000000
--- a/src/test/ui/rfc-2093-infer-outlives/union.rs
+++ /dev/null
@@ -1,40 +0,0 @@
-// 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.
-
-// ignore-tidy-linelength
-
-// Needs an explicit where clause stating outlives condition. (RFC 2093)
-
-#![feature(untagged_unions)]
-
-// Type T needs to outlive lifetime 'a. This is not reported due to
-// a compilation error in Bar.
-union Foo<'a, T> {
-    field1: Bar<'a, T>
-}
-
-// Type U needs to outlive lifetime 'b
-union Bar<'b, U> {
-    field2: &'b U //~ ERROR 25:5: 25:18: the parameter type `U` may not live long enough [E0309]
-}
-
-
-// Type K needs to outlive lifetime 'c.
-union Ying<'c, K> {
-    field1: &'c Yang<K> //~ ERROR 31:5: 31:24: the parameter type `K` may not live long enough [E0309]
-}
-
-union Yang<V> {
-    field2: V
-}
-
-
-fn main() {}
-
diff --git a/src/test/ui/rfc-2093-infer-outlives/union.stderr b/src/test/ui/rfc-2093-infer-outlives/union.stderr
deleted file mode 100644
index cd13c423293..00000000000
--- a/src/test/ui/rfc-2093-infer-outlives/union.stderr
+++ /dev/null
@@ -1,31 +0,0 @@
-error[E0309]: the parameter type `U` may not live long enough
-  --> $DIR/union.rs:25:5
-   |
-LL | union Bar<'b, U> {
-   |               - help: consider adding an explicit lifetime bound `U: 'b`...
-LL |     field2: &'b U //~ ERROR 25:5: 25:18: the parameter type `U` may not live long enough [E0309]
-   |     ^^^^^^^^^^^^^
-   |
-note: ...so that the reference type `&'b U` does not outlive the data it points at
-  --> $DIR/union.rs:25:5
-   |
-LL |     field2: &'b U //~ ERROR 25:5: 25:18: the parameter type `U` may not live long enough [E0309]
-   |     ^^^^^^^^^^^^^
-
-error[E0309]: the parameter type `K` may not live long enough
-  --> $DIR/union.rs:31:5
-   |
-LL | union Ying<'c, K> {
-   |                - help: consider adding an explicit lifetime bound `K: 'c`...
-LL |     field1: &'c Yang<K> //~ ERROR 31:5: 31:24: the parameter type `K` may not live long enough [E0309]
-   |     ^^^^^^^^^^^^^^^^^^^
-   |
-note: ...so that the reference type `&'c Yang<K>` does not outlive the data it points at
-  --> $DIR/union.rs:31:5
-   |
-LL |     field1: &'c Yang<K> //~ ERROR 31:5: 31:24: the parameter type `K` may not live long enough [E0309]
-   |     ^^^^^^^^^^^^^^^^^^^
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0309`.