]> git.lizzy.rs Git - rust.git/commitdiff
More nll revisions
authorJack Huey <31162821+jackh726@users.noreply.github.com>
Sat, 2 Apr 2022 02:12:17 +0000 (22:12 -0400)
committerJack Huey <31162821+jackh726@users.noreply.github.com>
Tue, 5 Apr 2022 15:42:44 +0000 (11:42 -0400)
72 files changed:
src/test/ui/variance/variance-associated-types2.base.stderr [new file with mode: 0644]
src/test/ui/variance/variance-associated-types2.nll.stderr
src/test/ui/variance/variance-associated-types2.rs
src/test/ui/variance/variance-associated-types2.stderr [deleted file]
src/test/ui/variance/variance-btree-invariant-types.base.stderr [new file with mode: 0644]
src/test/ui/variance/variance-btree-invariant-types.nll.stderr
src/test/ui/variance/variance-btree-invariant-types.rs
src/test/ui/variance/variance-btree-invariant-types.stderr [deleted file]
src/test/ui/variance/variance-cell-is-invariant.base.stderr [new file with mode: 0644]
src/test/ui/variance/variance-cell-is-invariant.nll.stderr
src/test/ui/variance/variance-cell-is-invariant.rs
src/test/ui/variance/variance-cell-is-invariant.stderr [deleted file]
src/test/ui/variance/variance-contravariant-arg-object.base.stderr [new file with mode: 0644]
src/test/ui/variance/variance-contravariant-arg-object.nll.stderr
src/test/ui/variance/variance-contravariant-arg-object.rs
src/test/ui/variance/variance-contravariant-arg-object.stderr [deleted file]
src/test/ui/variance/variance-contravariant-arg-trait-match.base.stderr [new file with mode: 0644]
src/test/ui/variance/variance-contravariant-arg-trait-match.nll.stderr
src/test/ui/variance/variance-contravariant-arg-trait-match.rs
src/test/ui/variance/variance-contravariant-arg-trait-match.stderr [deleted file]
src/test/ui/variance/variance-contravariant-self-trait-match.base.stderr [new file with mode: 0644]
src/test/ui/variance/variance-contravariant-self-trait-match.nll.stderr
src/test/ui/variance/variance-contravariant-self-trait-match.rs
src/test/ui/variance/variance-contravariant-self-trait-match.stderr [deleted file]
src/test/ui/variance/variance-covariant-arg-object.base.stderr [new file with mode: 0644]
src/test/ui/variance/variance-covariant-arg-object.nll.stderr
src/test/ui/variance/variance-covariant-arg-object.rs
src/test/ui/variance/variance-covariant-arg-object.stderr [deleted file]
src/test/ui/variance/variance-covariant-arg-trait-match.base.stderr [new file with mode: 0644]
src/test/ui/variance/variance-covariant-arg-trait-match.nll.stderr
src/test/ui/variance/variance-covariant-arg-trait-match.rs
src/test/ui/variance/variance-covariant-arg-trait-match.stderr [deleted file]
src/test/ui/variance/variance-covariant-self-trait-match.base.stderr [new file with mode: 0644]
src/test/ui/variance/variance-covariant-self-trait-match.nll.stderr
src/test/ui/variance/variance-covariant-self-trait-match.rs
src/test/ui/variance/variance-covariant-self-trait-match.stderr [deleted file]
src/test/ui/variance/variance-invariant-arg-object.base.stderr [new file with mode: 0644]
src/test/ui/variance/variance-invariant-arg-object.nll.stderr
src/test/ui/variance/variance-invariant-arg-object.rs
src/test/ui/variance/variance-invariant-arg-object.stderr [deleted file]
src/test/ui/variance/variance-invariant-arg-trait-match.base.stderr [new file with mode: 0644]
src/test/ui/variance/variance-invariant-arg-trait-match.nll.stderr
src/test/ui/variance/variance-invariant-arg-trait-match.rs
src/test/ui/variance/variance-invariant-arg-trait-match.stderr [deleted file]
src/test/ui/variance/variance-invariant-self-trait-match.base.stderr [new file with mode: 0644]
src/test/ui/variance/variance-invariant-self-trait-match.nll.stderr
src/test/ui/variance/variance-invariant-self-trait-match.rs
src/test/ui/variance/variance-invariant-self-trait-match.stderr [deleted file]
src/test/ui/variance/variance-trait-matching.base.stderr [new file with mode: 0644]
src/test/ui/variance/variance-trait-matching.nll.stderr
src/test/ui/variance/variance-trait-matching.rs
src/test/ui/variance/variance-trait-matching.stderr [deleted file]
src/test/ui/variance/variance-use-contravariant-struct-1.base.stderr [new file with mode: 0644]
src/test/ui/variance/variance-use-contravariant-struct-1.nll.stderr
src/test/ui/variance/variance-use-contravariant-struct-1.rs
src/test/ui/variance/variance-use-contravariant-struct-1.stderr [deleted file]
src/test/ui/variance/variance-use-covariant-struct-1.base.stderr [new file with mode: 0644]
src/test/ui/variance/variance-use-covariant-struct-1.nll.stderr
src/test/ui/variance/variance-use-covariant-struct-1.rs
src/test/ui/variance/variance-use-covariant-struct-1.stderr [deleted file]
src/test/ui/variance/variance-use-invariant-struct-1.base.stderr [new file with mode: 0644]
src/test/ui/variance/variance-use-invariant-struct-1.nll.stderr
src/test/ui/variance/variance-use-invariant-struct-1.rs
src/test/ui/variance/variance-use-invariant-struct-1.stderr [deleted file]
src/test/ui/wf/wf-static-method.base.stderr [new file with mode: 0644]
src/test/ui/wf/wf-static-method.nll.stderr
src/test/ui/wf/wf-static-method.rs
src/test/ui/wf/wf-static-method.stderr [deleted file]
src/test/ui/where-clauses/where-for-self-2.base.stderr [new file with mode: 0644]
src/test/ui/where-clauses/where-for-self-2.nll.stderr
src/test/ui/where-clauses/where-for-self-2.rs
src/test/ui/where-clauses/where-for-self-2.stderr [deleted file]

diff --git a/src/test/ui/variance/variance-associated-types2.base.stderr b/src/test/ui/variance/variance-associated-types2.base.stderr
new file mode 100644 (file)
index 0000000..c8ace08
--- /dev/null
@@ -0,0 +1,18 @@
+error[E0308]: mismatched types
+  --> $DIR/variance-associated-types2.rs:17:42
+   |
+LL |     let _: Box<dyn Foo<Bar = &'a u32>> = make();
+   |                                          ^^^^^^ lifetime mismatch
+   |
+   = note: expected trait object `dyn Foo<Bar = &'a u32>`
+              found trait object `dyn Foo<Bar = &'static u32>`
+note: the lifetime `'a` as defined here...
+  --> $DIR/variance-associated-types2.rs:16:9
+   |
+LL | fn take<'a>(_: &'a u32) {
+   |         ^^
+   = note: ...does not necessarily outlive the static lifetime
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
index 35871c1236fae11cdfec983f1dcbb779aa26b47f..b74c400969237f570c1d9c95662af321f2284856 100644 (file)
@@ -1,5 +1,5 @@
 error: lifetime may not live long enough
-  --> $DIR/variance-associated-types2.rs:13:12
+  --> $DIR/variance-associated-types2.rs:17:12
    |
 LL | fn take<'a>(_: &'a u32) {
    |         -- lifetime `'a` defined here
index 6a095fce7abfac9ab43064f5594105a0b12135f9..e3c8e6d7ca242bd6ca9b0ae96bf1d2d93a5c949e 100644 (file)
@@ -1,6 +1,10 @@
 // Test that dyn Foo<Bar = T> is invariant with respect to T.
 // Failure to enforce invariance here can be weaponized, see #71550 for details.
 
+// revisions: base nll
+// ignore-compare-mode-nll
+//[nll] compile-flags: -Z borrowck=mir
+
 trait Foo {
     type Bar;
 }
@@ -11,7 +15,8 @@ fn make() -> Box<dyn Foo<Bar = &'static u32>> {
 
 fn take<'a>(_: &'a u32) {
     let _: Box<dyn Foo<Bar = &'a u32>> = make();
-    //~^ ERROR mismatched types [E0308]
+    //[base]~^ ERROR mismatched types [E0308]
+    //[nll]~^^ ERROR lifetime may not live long enough
 }
 
 fn main() {}
diff --git a/src/test/ui/variance/variance-associated-types2.stderr b/src/test/ui/variance/variance-associated-types2.stderr
deleted file mode 100644 (file)
index af4f2a7..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-error[E0308]: mismatched types
-  --> $DIR/variance-associated-types2.rs:13:42
-   |
-LL |     let _: Box<dyn Foo<Bar = &'a u32>> = make();
-   |                                          ^^^^^^ lifetime mismatch
-   |
-   = note: expected trait object `dyn Foo<Bar = &'a u32>`
-              found trait object `dyn Foo<Bar = &'static u32>`
-note: the lifetime `'a` as defined here...
-  --> $DIR/variance-associated-types2.rs:12:9
-   |
-LL | fn take<'a>(_: &'a u32) {
-   |         ^^
-   = note: ...does not necessarily outlive the static lifetime
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/variance/variance-btree-invariant-types.base.stderr b/src/test/ui/variance/variance-btree-invariant-types.base.stderr
new file mode 100644 (file)
index 0000000..5b78f42
--- /dev/null
@@ -0,0 +1,243 @@
+error[E0308]: mismatched types
+  --> $DIR/variance-btree-invariant-types.rs:8:5
+   |
+LL |     v
+   |     ^ lifetime mismatch
+   |
+   = note: expected struct `std::collections::btree_map::IterMut<'_, &'new (), _>`
+              found struct `std::collections::btree_map::IterMut<'_, &'static (), _>`
+note: the lifetime `'new` as defined here...
+  --> $DIR/variance-btree-invariant-types.rs:7:21
+   |
+LL | fn iter_cov_key<'a, 'new>(v: IterMut<'a, &'static (), ()>) -> IterMut<'a, &'new (), ()> {
+   |                     ^^^^
+   = note: ...does not necessarily outlive the static lifetime
+
+error[E0308]: mismatched types
+  --> $DIR/variance-btree-invariant-types.rs:13:5
+   |
+LL |     v
+   |     ^ lifetime mismatch
+   |
+   = note: expected struct `std::collections::btree_map::IterMut<'_, _, &'new ()>`
+              found struct `std::collections::btree_map::IterMut<'_, _, &'static ()>`
+note: the lifetime `'new` as defined here...
+  --> $DIR/variance-btree-invariant-types.rs:12:21
+   |
+LL | fn iter_cov_val<'a, 'new>(v: IterMut<'a, (), &'static ()>) -> IterMut<'a, (), &'new ()> {
+   |                     ^^^^
+   = note: ...does not necessarily outlive the static lifetime
+
+error[E0308]: mismatched types
+  --> $DIR/variance-btree-invariant-types.rs:18:5
+   |
+LL |     v
+   |     ^ lifetime mismatch
+   |
+   = note: expected struct `std::collections::btree_map::IterMut<'_, &'static (), _>`
+              found struct `std::collections::btree_map::IterMut<'_, &'new (), _>`
+note: the lifetime `'new` as defined here...
+  --> $DIR/variance-btree-invariant-types.rs:17:24
+   |
+LL | fn iter_contra_key<'a, 'new>(v: IterMut<'a, &'new (), ()>) -> IterMut<'a, &'static (), ()> {
+   |                        ^^^^
+   = note: ...does not necessarily outlive the static lifetime
+
+error[E0308]: mismatched types
+  --> $DIR/variance-btree-invariant-types.rs:23:5
+   |
+LL |     v
+   |     ^ lifetime mismatch
+   |
+   = note: expected struct `std::collections::btree_map::IterMut<'_, _, &'static ()>`
+              found struct `std::collections::btree_map::IterMut<'_, _, &'new ()>`
+note: the lifetime `'new` as defined here...
+  --> $DIR/variance-btree-invariant-types.rs:22:24
+   |
+LL | fn iter_contra_val<'a, 'new>(v: IterMut<'a, (), &'new ()>) -> IterMut<'a, (), &'static ()> {
+   |                        ^^^^
+   = note: ...does not necessarily outlive the static lifetime
+
+error[E0308]: mismatched types
+  --> $DIR/variance-btree-invariant-types.rs:29:5
+   |
+LL |     v
+   |     ^ lifetime mismatch
+   |
+   = note: expected struct `RangeMut<'_, &'new (), _>`
+              found struct `RangeMut<'_, &'static (), _>`
+note: the lifetime `'new` as defined here...
+  --> $DIR/variance-btree-invariant-types.rs:28:22
+   |
+LL | fn range_cov_key<'a, 'new>(v: RangeMut<'a, &'static (), ()>) -> RangeMut<'a, &'new (), ()> {
+   |                      ^^^^
+   = note: ...does not necessarily outlive the static lifetime
+
+error[E0308]: mismatched types
+  --> $DIR/variance-btree-invariant-types.rs:34:5
+   |
+LL |     v
+   |     ^ lifetime mismatch
+   |
+   = note: expected struct `RangeMut<'_, _, &'new ()>`
+              found struct `RangeMut<'_, _, &'static ()>`
+note: the lifetime `'new` as defined here...
+  --> $DIR/variance-btree-invariant-types.rs:33:22
+   |
+LL | fn range_cov_val<'a, 'new>(v: RangeMut<'a, (), &'static ()>) -> RangeMut<'a, (), &'new ()> {
+   |                      ^^^^
+   = note: ...does not necessarily outlive the static lifetime
+
+error[E0308]: mismatched types
+  --> $DIR/variance-btree-invariant-types.rs:39:5
+   |
+LL |     v
+   |     ^ lifetime mismatch
+   |
+   = note: expected struct `RangeMut<'_, &'static (), _>`
+              found struct `RangeMut<'_, &'new (), _>`
+note: the lifetime `'new` as defined here...
+  --> $DIR/variance-btree-invariant-types.rs:38:25
+   |
+LL | fn range_contra_key<'a, 'new>(v: RangeMut<'a, &'new (), ()>) -> RangeMut<'a, &'static (), ()> {
+   |                         ^^^^
+   = note: ...does not necessarily outlive the static lifetime
+
+error[E0308]: mismatched types
+  --> $DIR/variance-btree-invariant-types.rs:44:5
+   |
+LL |     v
+   |     ^ lifetime mismatch
+   |
+   = note: expected struct `RangeMut<'_, _, &'static ()>`
+              found struct `RangeMut<'_, _, &'new ()>`
+note: the lifetime `'new` as defined here...
+  --> $DIR/variance-btree-invariant-types.rs:43:25
+   |
+LL | fn range_contra_val<'a, 'new>(v: RangeMut<'a, (), &'new ()>) -> RangeMut<'a, (), &'static ()> {
+   |                         ^^^^
+   = note: ...does not necessarily outlive the static lifetime
+
+error[E0308]: mismatched types
+  --> $DIR/variance-btree-invariant-types.rs:51:5
+   |
+LL |     v
+   |     ^ lifetime mismatch
+   |
+   = note: expected struct `std::collections::btree_map::OccupiedEntry<'_, &'new (), _>`
+              found struct `std::collections::btree_map::OccupiedEntry<'_, &'static (), _>`
+note: the lifetime `'new` as defined here...
+  --> $DIR/variance-btree-invariant-types.rs:49:20
+   |
+LL | fn occ_cov_key<'a, 'new>(v: OccupiedEntry<'a, &'static (), ()>)
+   |                    ^^^^
+   = note: ...does not necessarily outlive the static lifetime
+
+error[E0308]: mismatched types
+  --> $DIR/variance-btree-invariant-types.rs:57:5
+   |
+LL |     v
+   |     ^ lifetime mismatch
+   |
+   = note: expected struct `std::collections::btree_map::OccupiedEntry<'_, _, &'new ()>`
+              found struct `std::collections::btree_map::OccupiedEntry<'_, _, &'static ()>`
+note: the lifetime `'new` as defined here...
+  --> $DIR/variance-btree-invariant-types.rs:55:20
+   |
+LL | fn occ_cov_val<'a, 'new>(v: OccupiedEntry<'a, (), &'static ()>)
+   |                    ^^^^
+   = note: ...does not necessarily outlive the static lifetime
+
+error[E0308]: mismatched types
+  --> $DIR/variance-btree-invariant-types.rs:63:5
+   |
+LL |     v
+   |     ^ lifetime mismatch
+   |
+   = note: expected struct `std::collections::btree_map::OccupiedEntry<'_, &'static (), _>`
+              found struct `std::collections::btree_map::OccupiedEntry<'_, &'new (), _>`
+note: the lifetime `'new` as defined here...
+  --> $DIR/variance-btree-invariant-types.rs:61:23
+   |
+LL | fn occ_contra_key<'a, 'new>(v: OccupiedEntry<'a, &'new (), ()>)
+   |                       ^^^^
+   = note: ...does not necessarily outlive the static lifetime
+
+error[E0308]: mismatched types
+  --> $DIR/variance-btree-invariant-types.rs:69:5
+   |
+LL |     v
+   |     ^ lifetime mismatch
+   |
+   = note: expected struct `std::collections::btree_map::OccupiedEntry<'_, _, &'static ()>`
+              found struct `std::collections::btree_map::OccupiedEntry<'_, _, &'new ()>`
+note: the lifetime `'new` as defined here...
+  --> $DIR/variance-btree-invariant-types.rs:67:23
+   |
+LL | fn occ_contra_val<'a, 'new>(v: OccupiedEntry<'a, (), &'new ()>)
+   |                       ^^^^
+   = note: ...does not necessarily outlive the static lifetime
+
+error[E0308]: mismatched types
+  --> $DIR/variance-btree-invariant-types.rs:76:5
+   |
+LL |     v
+   |     ^ lifetime mismatch
+   |
+   = note: expected struct `std::collections::btree_map::VacantEntry<'_, &'new (), _>`
+              found struct `std::collections::btree_map::VacantEntry<'_, &'static (), _>`
+note: the lifetime `'new` as defined here...
+  --> $DIR/variance-btree-invariant-types.rs:74:20
+   |
+LL | fn vac_cov_key<'a, 'new>(v: VacantEntry<'a, &'static (), ()>)
+   |                    ^^^^
+   = note: ...does not necessarily outlive the static lifetime
+
+error[E0308]: mismatched types
+  --> $DIR/variance-btree-invariant-types.rs:82:5
+   |
+LL |     v
+   |     ^ lifetime mismatch
+   |
+   = note: expected struct `std::collections::btree_map::VacantEntry<'_, _, &'new ()>`
+              found struct `std::collections::btree_map::VacantEntry<'_, _, &'static ()>`
+note: the lifetime `'new` as defined here...
+  --> $DIR/variance-btree-invariant-types.rs:80:20
+   |
+LL | fn vac_cov_val<'a, 'new>(v: VacantEntry<'a, (), &'static ()>)
+   |                    ^^^^
+   = note: ...does not necessarily outlive the static lifetime
+
+error[E0308]: mismatched types
+  --> $DIR/variance-btree-invariant-types.rs:88:5
+   |
+LL |     v
+   |     ^ lifetime mismatch
+   |
+   = note: expected struct `std::collections::btree_map::VacantEntry<'_, &'static (), _>`
+              found struct `std::collections::btree_map::VacantEntry<'_, &'new (), _>`
+note: the lifetime `'new` as defined here...
+  --> $DIR/variance-btree-invariant-types.rs:86:23
+   |
+LL | fn vac_contra_key<'a, 'new>(v: VacantEntry<'a, &'new (), ()>)
+   |                       ^^^^
+   = note: ...does not necessarily outlive the static lifetime
+
+error[E0308]: mismatched types
+  --> $DIR/variance-btree-invariant-types.rs:94:5
+   |
+LL |     v
+   |     ^ lifetime mismatch
+   |
+   = note: expected struct `std::collections::btree_map::VacantEntry<'_, _, &'static ()>`
+              found struct `std::collections::btree_map::VacantEntry<'_, _, &'new ()>`
+note: the lifetime `'new` as defined here...
+  --> $DIR/variance-btree-invariant-types.rs:92:23
+   |
+LL | fn vac_contra_val<'a, 'new>(v: VacantEntry<'a, (), &'new ()>)
+   |                       ^^^^
+   = note: ...does not necessarily outlive the static lifetime
+
+error: aborting due to 16 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
index 867d9f8238a96feb73d502c18aabbc02d1f75aba..f24c2a8f7cdc57ca88ac08593ead02200801a790 100644 (file)
@@ -1,5 +1,5 @@
 error: lifetime may not live long enough
-  --> $DIR/variance-btree-invariant-types.rs:4:5
+  --> $DIR/variance-btree-invariant-types.rs:8:5
    |
 LL | fn iter_cov_key<'a, 'new>(v: IterMut<'a, &'static (), ()>) -> IterMut<'a, &'new (), ()> {
    |                     ---- lifetime `'new` defined here
@@ -11,7 +11,7 @@ LL |     v
    = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
 
 error: lifetime may not live long enough
-  --> $DIR/variance-btree-invariant-types.rs:7:5
+  --> $DIR/variance-btree-invariant-types.rs:13:5
    |
 LL | fn iter_cov_val<'a, 'new>(v: IterMut<'a, (), &'static ()>) -> IterMut<'a, (), &'new ()> {
    |                     ---- lifetime `'new` defined here
@@ -23,7 +23,7 @@ LL |     v
    = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
 
 error: lifetime may not live long enough
-  --> $DIR/variance-btree-invariant-types.rs:10:5
+  --> $DIR/variance-btree-invariant-types.rs:18:5
    |
 LL | fn iter_contra_key<'a, 'new>(v: IterMut<'a, &'new (), ()>) -> IterMut<'a, &'static (), ()> {
    |                        ---- lifetime `'new` defined here
@@ -35,7 +35,7 @@ LL |     v
    = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
 
 error: lifetime may not live long enough
-  --> $DIR/variance-btree-invariant-types.rs:13:5
+  --> $DIR/variance-btree-invariant-types.rs:23:5
    |
 LL | fn iter_contra_val<'a, 'new>(v: IterMut<'a, (), &'new ()>) -> IterMut<'a, (), &'static ()> {
    |                        ---- lifetime `'new` defined here
@@ -47,7 +47,7 @@ LL |     v
    = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
 
 error: lifetime may not live long enough
-  --> $DIR/variance-btree-invariant-types.rs:17:5
+  --> $DIR/variance-btree-invariant-types.rs:29:5
    |
 LL | fn range_cov_key<'a, 'new>(v: RangeMut<'a, &'static (), ()>) -> RangeMut<'a, &'new (), ()> {
    |                      ---- lifetime `'new` defined here
@@ -59,7 +59,7 @@ LL |     v
    = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
 
 error: lifetime may not live long enough
-  --> $DIR/variance-btree-invariant-types.rs:20:5
+  --> $DIR/variance-btree-invariant-types.rs:34:5
    |
 LL | fn range_cov_val<'a, 'new>(v: RangeMut<'a, (), &'static ()>) -> RangeMut<'a, (), &'new ()> {
    |                      ---- lifetime `'new` defined here
@@ -71,7 +71,7 @@ LL |     v
    = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
 
 error: lifetime may not live long enough
-  --> $DIR/variance-btree-invariant-types.rs:23:5
+  --> $DIR/variance-btree-invariant-types.rs:39:5
    |
 LL | fn range_contra_key<'a, 'new>(v: RangeMut<'a, &'new (), ()>) -> RangeMut<'a, &'static (), ()> {
    |                         ---- lifetime `'new` defined here
@@ -83,7 +83,7 @@ LL |     v
    = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
 
 error: lifetime may not live long enough
-  --> $DIR/variance-btree-invariant-types.rs:26:5
+  --> $DIR/variance-btree-invariant-types.rs:44:5
    |
 LL | fn range_contra_val<'a, 'new>(v: RangeMut<'a, (), &'new ()>) -> RangeMut<'a, (), &'static ()> {
    |                         ---- lifetime `'new` defined here
@@ -95,7 +95,7 @@ LL |     v
    = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
 
 error: lifetime may not live long enough
-  --> $DIR/variance-btree-invariant-types.rs:31:5
+  --> $DIR/variance-btree-invariant-types.rs:51:5
    |
 LL | fn occ_cov_key<'a, 'new>(v: OccupiedEntry<'a, &'static (), ()>)
    |                    ---- lifetime `'new` defined here
@@ -108,7 +108,7 @@ LL |     v
    = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
 
 error: lifetime may not live long enough
-  --> $DIR/variance-btree-invariant-types.rs:35:5
+  --> $DIR/variance-btree-invariant-types.rs:57:5
    |
 LL | fn occ_cov_val<'a, 'new>(v: OccupiedEntry<'a, (), &'static ()>)
    |                    ---- lifetime `'new` defined here
@@ -121,7 +121,7 @@ LL |     v
    = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
 
 error: lifetime may not live long enough
-  --> $DIR/variance-btree-invariant-types.rs:39:5
+  --> $DIR/variance-btree-invariant-types.rs:63:5
    |
 LL | fn occ_contra_key<'a, 'new>(v: OccupiedEntry<'a, &'new (), ()>)
    |                       ---- lifetime `'new` defined here
@@ -134,7 +134,7 @@ LL |     v
    = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
 
 error: lifetime may not live long enough
-  --> $DIR/variance-btree-invariant-types.rs:43:5
+  --> $DIR/variance-btree-invariant-types.rs:69:5
    |
 LL | fn occ_contra_val<'a, 'new>(v: OccupiedEntry<'a, (), &'new ()>)
    |                       ---- lifetime `'new` defined here
@@ -147,7 +147,7 @@ LL |     v
    = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
 
 error: lifetime may not live long enough
-  --> $DIR/variance-btree-invariant-types.rs:48:5
+  --> $DIR/variance-btree-invariant-types.rs:76:5
    |
 LL | fn vac_cov_key<'a, 'new>(v: VacantEntry<'a, &'static (), ()>)
    |                    ---- lifetime `'new` defined here
@@ -160,7 +160,7 @@ LL |     v
    = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
 
 error: lifetime may not live long enough
-  --> $DIR/variance-btree-invariant-types.rs:52:5
+  --> $DIR/variance-btree-invariant-types.rs:82:5
    |
 LL | fn vac_cov_val<'a, 'new>(v: VacantEntry<'a, (), &'static ()>)
    |                    ---- lifetime `'new` defined here
@@ -173,7 +173,7 @@ LL |     v
    = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
 
 error: lifetime may not live long enough
-  --> $DIR/variance-btree-invariant-types.rs:56:5
+  --> $DIR/variance-btree-invariant-types.rs:88:5
    |
 LL | fn vac_contra_key<'a, 'new>(v: VacantEntry<'a, &'new (), ()>)
    |                       ---- lifetime `'new` defined here
@@ -186,7 +186,7 @@ LL |     v
    = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
 
 error: lifetime may not live long enough
-  --> $DIR/variance-btree-invariant-types.rs:60:5
+  --> $DIR/variance-btree-invariant-types.rs:94:5
    |
 LL | fn vac_contra_val<'a, 'new>(v: VacantEntry<'a, (), &'new ()>)
    |                       ---- lifetime `'new` defined here
index 4549622f24ac3276710b150c2e0c4cda970bc6b2..7ddf6b294a5a19221c1c6f8d04f4b717ec677316 100644 (file)
@@ -1,63 +1,99 @@
 use std::collections::btree_map::{IterMut, OccupiedEntry, RangeMut, VacantEntry};
 
+// revisions: base nll
+// ignore-compare-mode-nll
+//[nll] compile-flags: -Z borrowck=mir
+
 fn iter_cov_key<'a, 'new>(v: IterMut<'a, &'static (), ()>) -> IterMut<'a, &'new (), ()> {
-    v //~ ERROR mismatched types
+    v
+    //[base]~^ ERROR mismatched types
+    //[nll]~^^ lifetime may not live long enough
 }
 fn iter_cov_val<'a, 'new>(v: IterMut<'a, (), &'static ()>) -> IterMut<'a, (), &'new ()> {
-    v //~ ERROR mismatched types
+    v
+    //[base]~^ ERROR mismatched types
+    //[nll]~^^ lifetime may not live long enough
 }
 fn iter_contra_key<'a, 'new>(v: IterMut<'a, &'new (), ()>) -> IterMut<'a, &'static (), ()> {
-    v //~ ERROR mismatched types
+    v
+    //[base]~^ ERROR mismatched types
+    //[nll]~^^ lifetime may not live long enough
 }
 fn iter_contra_val<'a, 'new>(v: IterMut<'a, (), &'new ()>) -> IterMut<'a, (), &'static ()> {
-    v //~ ERROR mismatched types
+    v
+    //[base]~^ ERROR mismatched types
+    //[nll]~^^ lifetime may not live long enough
 }
 
 fn range_cov_key<'a, 'new>(v: RangeMut<'a, &'static (), ()>) -> RangeMut<'a, &'new (), ()> {
-    v //~ ERROR mismatched types
+    v
+    //[base]~^ ERROR mismatched types
+    //[nll]~^^ lifetime may not live long enough
 }
 fn range_cov_val<'a, 'new>(v: RangeMut<'a, (), &'static ()>) -> RangeMut<'a, (), &'new ()> {
-    v //~ ERROR mismatched types
+    v
+    //[base]~^ ERROR mismatched types
+    //[nll]~^^ lifetime may not live long enough
 }
 fn range_contra_key<'a, 'new>(v: RangeMut<'a, &'new (), ()>) -> RangeMut<'a, &'static (), ()> {
-    v //~ ERROR mismatched types
+    v
+    //[base]~^ ERROR mismatched types
+    //[nll]~^^ lifetime may not live long enough
 }
 fn range_contra_val<'a, 'new>(v: RangeMut<'a, (), &'new ()>) -> RangeMut<'a, (), &'static ()> {
-    v //~ ERROR mismatched types
+    v
+    //[base]~^ ERROR mismatched types
+    //[nll]~^^ lifetime may not live long enough
 }
 
 fn occ_cov_key<'a, 'new>(v: OccupiedEntry<'a, &'static (), ()>)
                          -> OccupiedEntry<'a, &'new (), ()> {
-    v //~ ERROR mismatched types
+    v
+    //[base]~^ ERROR mismatched types
+    //[nll]~^^ lifetime may not live long enough
 }
 fn occ_cov_val<'a, 'new>(v: OccupiedEntry<'a, (), &'static ()>)
                          -> OccupiedEntry<'a, (), &'new ()> {
-    v //~ ERROR mismatched types
+    v
+    //[base]~^ ERROR mismatched types
+    //[nll]~^^ lifetime may not live long enough
 }
 fn occ_contra_key<'a, 'new>(v: OccupiedEntry<'a, &'new (), ()>)
                             -> OccupiedEntry<'a, &'static (), ()> {
-    v //~ ERROR mismatched types
+    v
+    //[base]~^ ERROR mismatched types
+    //[nll]~^^ lifetime may not live long enough
 }
 fn occ_contra_val<'a, 'new>(v: OccupiedEntry<'a, (), &'new ()>)
                             -> OccupiedEntry<'a, (), &'static ()> {
-    v //~ ERROR mismatched types
+    v
+    //[base]~^ ERROR mismatched types
+    //[nll]~^^ lifetime may not live long enough
 }
 
 fn vac_cov_key<'a, 'new>(v: VacantEntry<'a, &'static (), ()>)
                          -> VacantEntry<'a, &'new (), ()> {
-    v //~ ERROR mismatched types
+    v
+    //[base]~^ ERROR mismatched types
+    //[nll]~^^ lifetime may not live long enough
 }
 fn vac_cov_val<'a, 'new>(v: VacantEntry<'a, (), &'static ()>)
                          -> VacantEntry<'a, (), &'new ()> {
-    v //~ ERROR mismatched types
+    v
+    //[base]~^ ERROR mismatched types
+    //[nll]~^^ lifetime may not live long enough
 }
 fn vac_contra_key<'a, 'new>(v: VacantEntry<'a, &'new (), ()>)
                             -> VacantEntry<'a, &'static (), ()> {
-    v //~ ERROR mismatched types
+    v
+    //[base]~^ ERROR mismatched types
+    //[nll]~^^ lifetime may not live long enough
 }
 fn vac_contra_val<'a, 'new>(v: VacantEntry<'a, (), &'new ()>)
                             -> VacantEntry<'a, (), &'static ()> {
-    v //~ ERROR mismatched types
+    v
+    //[base]~^ ERROR mismatched types
+    //[nll]~^^ lifetime may not live long enough
 }
 
 
diff --git a/src/test/ui/variance/variance-btree-invariant-types.stderr b/src/test/ui/variance/variance-btree-invariant-types.stderr
deleted file mode 100644 (file)
index df519e2..0000000
+++ /dev/null
@@ -1,243 +0,0 @@
-error[E0308]: mismatched types
-  --> $DIR/variance-btree-invariant-types.rs:4:5
-   |
-LL |     v
-   |     ^ lifetime mismatch
-   |
-   = note: expected struct `std::collections::btree_map::IterMut<'_, &'new (), _>`
-              found struct `std::collections::btree_map::IterMut<'_, &'static (), _>`
-note: the lifetime `'new` as defined here...
-  --> $DIR/variance-btree-invariant-types.rs:3:21
-   |
-LL | fn iter_cov_key<'a, 'new>(v: IterMut<'a, &'static (), ()>) -> IterMut<'a, &'new (), ()> {
-   |                     ^^^^
-   = note: ...does not necessarily outlive the static lifetime
-
-error[E0308]: mismatched types
-  --> $DIR/variance-btree-invariant-types.rs:7:5
-   |
-LL |     v
-   |     ^ lifetime mismatch
-   |
-   = note: expected struct `std::collections::btree_map::IterMut<'_, _, &'new ()>`
-              found struct `std::collections::btree_map::IterMut<'_, _, &'static ()>`
-note: the lifetime `'new` as defined here...
-  --> $DIR/variance-btree-invariant-types.rs:6:21
-   |
-LL | fn iter_cov_val<'a, 'new>(v: IterMut<'a, (), &'static ()>) -> IterMut<'a, (), &'new ()> {
-   |                     ^^^^
-   = note: ...does not necessarily outlive the static lifetime
-
-error[E0308]: mismatched types
-  --> $DIR/variance-btree-invariant-types.rs:10:5
-   |
-LL |     v
-   |     ^ lifetime mismatch
-   |
-   = note: expected struct `std::collections::btree_map::IterMut<'_, &'static (), _>`
-              found struct `std::collections::btree_map::IterMut<'_, &'new (), _>`
-note: the lifetime `'new` as defined here...
-  --> $DIR/variance-btree-invariant-types.rs:9:24
-   |
-LL | fn iter_contra_key<'a, 'new>(v: IterMut<'a, &'new (), ()>) -> IterMut<'a, &'static (), ()> {
-   |                        ^^^^
-   = note: ...does not necessarily outlive the static lifetime
-
-error[E0308]: mismatched types
-  --> $DIR/variance-btree-invariant-types.rs:13:5
-   |
-LL |     v
-   |     ^ lifetime mismatch
-   |
-   = note: expected struct `std::collections::btree_map::IterMut<'_, _, &'static ()>`
-              found struct `std::collections::btree_map::IterMut<'_, _, &'new ()>`
-note: the lifetime `'new` as defined here...
-  --> $DIR/variance-btree-invariant-types.rs:12:24
-   |
-LL | fn iter_contra_val<'a, 'new>(v: IterMut<'a, (), &'new ()>) -> IterMut<'a, (), &'static ()> {
-   |                        ^^^^
-   = note: ...does not necessarily outlive the static lifetime
-
-error[E0308]: mismatched types
-  --> $DIR/variance-btree-invariant-types.rs:17:5
-   |
-LL |     v
-   |     ^ lifetime mismatch
-   |
-   = note: expected struct `RangeMut<'_, &'new (), _>`
-              found struct `RangeMut<'_, &'static (), _>`
-note: the lifetime `'new` as defined here...
-  --> $DIR/variance-btree-invariant-types.rs:16:22
-   |
-LL | fn range_cov_key<'a, 'new>(v: RangeMut<'a, &'static (), ()>) -> RangeMut<'a, &'new (), ()> {
-   |                      ^^^^
-   = note: ...does not necessarily outlive the static lifetime
-
-error[E0308]: mismatched types
-  --> $DIR/variance-btree-invariant-types.rs:20:5
-   |
-LL |     v
-   |     ^ lifetime mismatch
-   |
-   = note: expected struct `RangeMut<'_, _, &'new ()>`
-              found struct `RangeMut<'_, _, &'static ()>`
-note: the lifetime `'new` as defined here...
-  --> $DIR/variance-btree-invariant-types.rs:19:22
-   |
-LL | fn range_cov_val<'a, 'new>(v: RangeMut<'a, (), &'static ()>) -> RangeMut<'a, (), &'new ()> {
-   |                      ^^^^
-   = note: ...does not necessarily outlive the static lifetime
-
-error[E0308]: mismatched types
-  --> $DIR/variance-btree-invariant-types.rs:23:5
-   |
-LL |     v
-   |     ^ lifetime mismatch
-   |
-   = note: expected struct `RangeMut<'_, &'static (), _>`
-              found struct `RangeMut<'_, &'new (), _>`
-note: the lifetime `'new` as defined here...
-  --> $DIR/variance-btree-invariant-types.rs:22:25
-   |
-LL | fn range_contra_key<'a, 'new>(v: RangeMut<'a, &'new (), ()>) -> RangeMut<'a, &'static (), ()> {
-   |                         ^^^^
-   = note: ...does not necessarily outlive the static lifetime
-
-error[E0308]: mismatched types
-  --> $DIR/variance-btree-invariant-types.rs:26:5
-   |
-LL |     v
-   |     ^ lifetime mismatch
-   |
-   = note: expected struct `RangeMut<'_, _, &'static ()>`
-              found struct `RangeMut<'_, _, &'new ()>`
-note: the lifetime `'new` as defined here...
-  --> $DIR/variance-btree-invariant-types.rs:25:25
-   |
-LL | fn range_contra_val<'a, 'new>(v: RangeMut<'a, (), &'new ()>) -> RangeMut<'a, (), &'static ()> {
-   |                         ^^^^
-   = note: ...does not necessarily outlive the static lifetime
-
-error[E0308]: mismatched types
-  --> $DIR/variance-btree-invariant-types.rs:31:5
-   |
-LL |     v
-   |     ^ lifetime mismatch
-   |
-   = note: expected struct `std::collections::btree_map::OccupiedEntry<'_, &'new (), _>`
-              found struct `std::collections::btree_map::OccupiedEntry<'_, &'static (), _>`
-note: the lifetime `'new` as defined here...
-  --> $DIR/variance-btree-invariant-types.rs:29:20
-   |
-LL | fn occ_cov_key<'a, 'new>(v: OccupiedEntry<'a, &'static (), ()>)
-   |                    ^^^^
-   = note: ...does not necessarily outlive the static lifetime
-
-error[E0308]: mismatched types
-  --> $DIR/variance-btree-invariant-types.rs:35:5
-   |
-LL |     v
-   |     ^ lifetime mismatch
-   |
-   = note: expected struct `std::collections::btree_map::OccupiedEntry<'_, _, &'new ()>`
-              found struct `std::collections::btree_map::OccupiedEntry<'_, _, &'static ()>`
-note: the lifetime `'new` as defined here...
-  --> $DIR/variance-btree-invariant-types.rs:33:20
-   |
-LL | fn occ_cov_val<'a, 'new>(v: OccupiedEntry<'a, (), &'static ()>)
-   |                    ^^^^
-   = note: ...does not necessarily outlive the static lifetime
-
-error[E0308]: mismatched types
-  --> $DIR/variance-btree-invariant-types.rs:39:5
-   |
-LL |     v
-   |     ^ lifetime mismatch
-   |
-   = note: expected struct `std::collections::btree_map::OccupiedEntry<'_, &'static (), _>`
-              found struct `std::collections::btree_map::OccupiedEntry<'_, &'new (), _>`
-note: the lifetime `'new` as defined here...
-  --> $DIR/variance-btree-invariant-types.rs:37:23
-   |
-LL | fn occ_contra_key<'a, 'new>(v: OccupiedEntry<'a, &'new (), ()>)
-   |                       ^^^^
-   = note: ...does not necessarily outlive the static lifetime
-
-error[E0308]: mismatched types
-  --> $DIR/variance-btree-invariant-types.rs:43:5
-   |
-LL |     v
-   |     ^ lifetime mismatch
-   |
-   = note: expected struct `std::collections::btree_map::OccupiedEntry<'_, _, &'static ()>`
-              found struct `std::collections::btree_map::OccupiedEntry<'_, _, &'new ()>`
-note: the lifetime `'new` as defined here...
-  --> $DIR/variance-btree-invariant-types.rs:41:23
-   |
-LL | fn occ_contra_val<'a, 'new>(v: OccupiedEntry<'a, (), &'new ()>)
-   |                       ^^^^
-   = note: ...does not necessarily outlive the static lifetime
-
-error[E0308]: mismatched types
-  --> $DIR/variance-btree-invariant-types.rs:48:5
-   |
-LL |     v
-   |     ^ lifetime mismatch
-   |
-   = note: expected struct `std::collections::btree_map::VacantEntry<'_, &'new (), _>`
-              found struct `std::collections::btree_map::VacantEntry<'_, &'static (), _>`
-note: the lifetime `'new` as defined here...
-  --> $DIR/variance-btree-invariant-types.rs:46:20
-   |
-LL | fn vac_cov_key<'a, 'new>(v: VacantEntry<'a, &'static (), ()>)
-   |                    ^^^^
-   = note: ...does not necessarily outlive the static lifetime
-
-error[E0308]: mismatched types
-  --> $DIR/variance-btree-invariant-types.rs:52:5
-   |
-LL |     v
-   |     ^ lifetime mismatch
-   |
-   = note: expected struct `std::collections::btree_map::VacantEntry<'_, _, &'new ()>`
-              found struct `std::collections::btree_map::VacantEntry<'_, _, &'static ()>`
-note: the lifetime `'new` as defined here...
-  --> $DIR/variance-btree-invariant-types.rs:50:20
-   |
-LL | fn vac_cov_val<'a, 'new>(v: VacantEntry<'a, (), &'static ()>)
-   |                    ^^^^
-   = note: ...does not necessarily outlive the static lifetime
-
-error[E0308]: mismatched types
-  --> $DIR/variance-btree-invariant-types.rs:56:5
-   |
-LL |     v
-   |     ^ lifetime mismatch
-   |
-   = note: expected struct `std::collections::btree_map::VacantEntry<'_, &'static (), _>`
-              found struct `std::collections::btree_map::VacantEntry<'_, &'new (), _>`
-note: the lifetime `'new` as defined here...
-  --> $DIR/variance-btree-invariant-types.rs:54:23
-   |
-LL | fn vac_contra_key<'a, 'new>(v: VacantEntry<'a, &'new (), ()>)
-   |                       ^^^^
-   = note: ...does not necessarily outlive the static lifetime
-
-error[E0308]: mismatched types
-  --> $DIR/variance-btree-invariant-types.rs:60:5
-   |
-LL |     v
-   |     ^ lifetime mismatch
-   |
-   = note: expected struct `std::collections::btree_map::VacantEntry<'_, _, &'static ()>`
-              found struct `std::collections::btree_map::VacantEntry<'_, _, &'new ()>`
-note: the lifetime `'new` as defined here...
-  --> $DIR/variance-btree-invariant-types.rs:58:23
-   |
-LL | fn vac_contra_val<'a, 'new>(v: VacantEntry<'a, (), &'new ()>)
-   |                       ^^^^
-   = note: ...does not necessarily outlive the static lifetime
-
-error: aborting due to 16 previous errors
-
-For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/variance/variance-cell-is-invariant.base.stderr b/src/test/ui/variance/variance-cell-is-invariant.base.stderr
new file mode 100644 (file)
index 0000000..e3180b6
--- /dev/null
@@ -0,0 +1,15 @@
+error[E0623]: lifetime mismatch
+  --> $DIR/variance-cell-is-invariant.rs:18:25
+   |
+LL | fn use_<'short,'long>(c: Foo<'short>,
+   |                          ----------- these two types are declared with different lifetimes...
+LL |                       s: &'short isize,
+LL |                       l: &'long isize,
+   |                          ------------
+LL |                       _where:Option<&'short &'long ()>) {
+LL |     let _: Foo<'long> = c;
+   |                         ^ ...but data from `c` flows into `l` here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0623`.
index d6a85680141dc39096a15ef5a729030886ed288f..82ef94a19b23f50885fd9cbe14c857a1ff876f2d 100644 (file)
@@ -1,5 +1,5 @@
 error: lifetime may not live long enough
-  --> $DIR/variance-cell-is-invariant.rs:14:12
+  --> $DIR/variance-cell-is-invariant.rs:18:12
    |
 LL | fn use_<'short,'long>(c: Foo<'short>,
    |         ------ ----- lifetime `'long` defined here
index ff9ad66fb0bc2cc1224564d8d4f5d9c4bc4370d2..b8b73147d0eea58d5fa06e70b363acbbf75d01ae 100644 (file)
@@ -1,6 +1,10 @@
 // Test that Cell is considered invariant with respect to its
 // type.
 
+// revisions: base nll
+// ignore-compare-mode-nll
+//[nll] compile-flags: -Z borrowck=mir
+
 use std::cell::Cell;
 
 struct Foo<'a> {
@@ -11,7 +15,9 @@ fn use_<'short,'long>(c: Foo<'short>,
                       s: &'short isize,
                       l: &'long isize,
                       _where:Option<&'short &'long ()>) {
-    let _: Foo<'long> = c; //~ ERROR E0623
+    let _: Foo<'long> = c;
+    //[base]~^ ERROR E0623
+    //[nll]~^^ ERROR lifetime may not live long enough
 }
 
 fn main() {
diff --git a/src/test/ui/variance/variance-cell-is-invariant.stderr b/src/test/ui/variance/variance-cell-is-invariant.stderr
deleted file mode 100644 (file)
index 6fcd646..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-error[E0623]: lifetime mismatch
-  --> $DIR/variance-cell-is-invariant.rs:14:25
-   |
-LL | fn use_<'short,'long>(c: Foo<'short>,
-   |                          ----------- these two types are declared with different lifetimes...
-LL |                       s: &'short isize,
-LL |                       l: &'long isize,
-   |                          ------------
-LL |                       _where:Option<&'short &'long ()>) {
-LL |     let _: Foo<'long> = c;
-   |                         ^ ...but data from `c` flows into `l` here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0623`.
diff --git a/src/test/ui/variance/variance-contravariant-arg-object.base.stderr b/src/test/ui/variance/variance-contravariant-arg-object.base.stderr
new file mode 100644 (file)
index 0000000..19b8b9d
--- /dev/null
@@ -0,0 +1,41 @@
+error[E0308]: mismatched types
+  --> $DIR/variance-contravariant-arg-object.rs:18:5
+   |
+LL |     v
+   |     ^ lifetime mismatch
+   |
+   = note: expected trait object `dyn Get<&'min i32>`
+              found trait object `dyn Get<&'max i32>`
+note: the lifetime `'min` as defined here...
+  --> $DIR/variance-contravariant-arg-object.rs:14:21
+   |
+LL | fn get_min_from_max<'min, 'max>(v: Box<dyn Get<&'max i32>>)
+   |                     ^^^^
+note: ...does not necessarily outlive the lifetime `'max` as defined here
+  --> $DIR/variance-contravariant-arg-object.rs:14:27
+   |
+LL | fn get_min_from_max<'min, 'max>(v: Box<dyn Get<&'max i32>>)
+   |                           ^^^^
+
+error[E0308]: mismatched types
+  --> $DIR/variance-contravariant-arg-object.rs:28:5
+   |
+LL |     v
+   |     ^ lifetime mismatch
+   |
+   = note: expected trait object `dyn Get<&'max i32>`
+              found trait object `dyn Get<&'min i32>`
+note: the lifetime `'min` as defined here...
+  --> $DIR/variance-contravariant-arg-object.rs:23:21
+   |
+LL | fn get_max_from_min<'min, 'max, G>(v: Box<dyn Get<&'min i32>>)
+   |                     ^^^^
+note: ...does not necessarily outlive the lifetime `'max` as defined here
+  --> $DIR/variance-contravariant-arg-object.rs:23:27
+   |
+LL | fn get_max_from_min<'min, 'max, G>(v: Box<dyn Get<&'min i32>>)
+   |                           ^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
index 3315eaaf1c006e9788e0914c9435d183d3a8ee2f..4071a41703e2820f97a0f1ba0d3af33adbd2980c 100644 (file)
@@ -1,5 +1,5 @@
 error: lifetime may not live long enough
-  --> $DIR/variance-contravariant-arg-object.rs:14:5
+  --> $DIR/variance-contravariant-arg-object.rs:18:5
    |
 LL | fn get_min_from_max<'min, 'max>(v: Box<dyn Get<&'max i32>>)
    |                     ----  ---- lifetime `'max` defined here
@@ -12,7 +12,7 @@ LL |     v
    = help: consider adding the following bound: `'min: 'max`
 
 error: lifetime may not live long enough
-  --> $DIR/variance-contravariant-arg-object.rs:22:5
+  --> $DIR/variance-contravariant-arg-object.rs:28:5
    |
 LL | fn get_max_from_min<'min, 'max, G>(v: Box<dyn Get<&'min i32>>)
    |                     ----  ---- lifetime `'max` defined here
index 947f4cd8b8f4d0e886991d7e2a9842c2a2a4d976..dab42c35218bf6168392d888261404620eb01e9f 100644 (file)
@@ -3,6 +3,10 @@
 // Test that even when `T` is only used in contravariant position, it
 // is treated as invariant.
 
+// revisions: base nll
+// ignore-compare-mode-nll
+//[nll] compile-flags: -Z borrowck=mir
+
 trait Get<T> : 'static {
     fn get(&self, t: T);
 }
@@ -11,7 +15,9 @@ fn get_min_from_max<'min, 'max>(v: Box<dyn Get<&'max i32>>)
                                 -> Box<dyn Get<&'min i32>>
     where 'max : 'min
 {
-    v //~ ERROR mismatched types
+    v
+    //[base]~^ ERROR mismatched types
+    //[nll]~^^ ERROR lifetime may not live long enough
 }
 
 fn get_max_from_min<'min, 'max, G>(v: Box<dyn Get<&'min i32>>)
@@ -19,7 +25,9 @@ fn get_max_from_min<'min, 'max, G>(v: Box<dyn Get<&'min i32>>)
     where 'max : 'min
 {
     // Previously OK:
-    v //~ ERROR mismatched types
+    v
+    //[base]~^ ERROR mismatched types
+    //[nll]~^^ ERROR lifetime may not live long enough
 }
 
 fn main() { }
diff --git a/src/test/ui/variance/variance-contravariant-arg-object.stderr b/src/test/ui/variance/variance-contravariant-arg-object.stderr
deleted file mode 100644 (file)
index 16583fa..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-error[E0308]: mismatched types
-  --> $DIR/variance-contravariant-arg-object.rs:14:5
-   |
-LL |     v
-   |     ^ lifetime mismatch
-   |
-   = note: expected trait object `dyn Get<&'min i32>`
-              found trait object `dyn Get<&'max i32>`
-note: the lifetime `'min` as defined here...
-  --> $DIR/variance-contravariant-arg-object.rs:10:21
-   |
-LL | fn get_min_from_max<'min, 'max>(v: Box<dyn Get<&'max i32>>)
-   |                     ^^^^
-note: ...does not necessarily outlive the lifetime `'max` as defined here
-  --> $DIR/variance-contravariant-arg-object.rs:10:27
-   |
-LL | fn get_min_from_max<'min, 'max>(v: Box<dyn Get<&'max i32>>)
-   |                           ^^^^
-
-error[E0308]: mismatched types
-  --> $DIR/variance-contravariant-arg-object.rs:22:5
-   |
-LL |     v
-   |     ^ lifetime mismatch
-   |
-   = note: expected trait object `dyn Get<&'max i32>`
-              found trait object `dyn Get<&'min i32>`
-note: the lifetime `'min` as defined here...
-  --> $DIR/variance-contravariant-arg-object.rs:17:21
-   |
-LL | fn get_max_from_min<'min, 'max, G>(v: Box<dyn Get<&'min i32>>)
-   |                     ^^^^
-note: ...does not necessarily outlive the lifetime `'max` as defined here
-  --> $DIR/variance-contravariant-arg-object.rs:17:27
-   |
-LL | fn get_max_from_min<'min, 'max, G>(v: Box<dyn Get<&'min i32>>)
-   |                           ^^^^
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/variance/variance-contravariant-arg-trait-match.base.stderr b/src/test/ui/variance/variance-contravariant-arg-trait-match.base.stderr
new file mode 100644 (file)
index 0000000..56cf845
--- /dev/null
@@ -0,0 +1,41 @@
+error[E0308]: mismatched types
+  --> $DIR/variance-contravariant-arg-trait-match.rs:17:5
+   |
+LL |     impls_get::<G,&'min i32>()
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch
+   |
+   = note: expected type `Get<&'min i32>`
+              found type `Get<&'max i32>`
+note: the lifetime `'min` as defined here...
+  --> $DIR/variance-contravariant-arg-trait-match.rs:14:21
+   |
+LL | fn get_min_from_max<'min, 'max, G>()
+   |                     ^^^^
+note: ...does not necessarily outlive the lifetime `'max` as defined here
+  --> $DIR/variance-contravariant-arg-trait-match.rs:14:27
+   |
+LL | fn get_min_from_max<'min, 'max, G>()
+   |                           ^^^^
+
+error[E0308]: mismatched types
+  --> $DIR/variance-contravariant-arg-trait-match.rs:27:5
+   |
+LL |     impls_get::<G,&'max i32>()
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch
+   |
+   = note: expected type `Get<&'max i32>`
+              found type `Get<&'min i32>`
+note: the lifetime `'min` as defined here...
+  --> $DIR/variance-contravariant-arg-trait-match.rs:22:21
+   |
+LL | fn get_max_from_min<'min, 'max, G>()
+   |                     ^^^^
+note: ...does not necessarily outlive the lifetime `'max` as defined here
+  --> $DIR/variance-contravariant-arg-trait-match.rs:22:27
+   |
+LL | fn get_max_from_min<'min, 'max, G>()
+   |                           ^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
index 6f136750ee13df4c253d7f54cc59b4e018316642..6ca8f5ed4cce6581f2863e93628fa651fe8d9f80 100644 (file)
@@ -1,5 +1,5 @@
 error: lifetime may not live long enough
-  --> $DIR/variance-contravariant-arg-trait-match.rs:13:5
+  --> $DIR/variance-contravariant-arg-trait-match.rs:17:5
    |
 LL | fn get_min_from_max<'min, 'max, G>()
    |                     ----  ---- lifetime `'max` defined here
@@ -12,7 +12,7 @@ LL |     impls_get::<G,&'min i32>()
    = help: consider adding the following bound: `'min: 'max`
 
 error: lifetime may not live long enough
-  --> $DIR/variance-contravariant-arg-trait-match.rs:21:5
+  --> $DIR/variance-contravariant-arg-trait-match.rs:27:5
    |
 LL | fn get_max_from_min<'min, 'max, G>()
    |                     ----  ---- lifetime `'max` defined here
index 904d93124c98893fa7ac53751d6623926c06a6fd..11513d5411cfba8f8d269fe9ae16239725d33356 100644 (file)
@@ -3,6 +3,10 @@
 // Test that even when `T` is only used in contravariant position, it
 // is treated as invariant.
 
+// revisions: base nll
+// ignore-compare-mode-nll
+//[nll] compile-flags: -Z borrowck=mir
+
 trait Get<T> {
     fn get(&self, t: T);
 }
@@ -10,7 +14,9 @@ trait Get<T> {
 fn get_min_from_max<'min, 'max, G>()
     where 'max : 'min, G : Get<&'max i32>
 {
-    impls_get::<G,&'min i32>() //~ ERROR mismatched types
+    impls_get::<G,&'min i32>()
+    //[base]~^ ERROR mismatched types
+    //[nll]~^^ ERROR lifetime may not live long enough
 }
 
 fn get_max_from_min<'min, 'max, G>()
@@ -18,7 +24,9 @@ fn get_max_from_min<'min, 'max, G>()
 {
     // Previously OK, but now an error because traits are invariant:
 
-    impls_get::<G,&'max i32>() //~ ERROR mismatched types
+    impls_get::<G,&'max i32>()
+    //[base]~^ ERROR mismatched types
+    //[nll]~^^ ERROR lifetime may not live long enough
 }
 
 fn impls_get<G,T>() where G : Get<T> { }
diff --git a/src/test/ui/variance/variance-contravariant-arg-trait-match.stderr b/src/test/ui/variance/variance-contravariant-arg-trait-match.stderr
deleted file mode 100644 (file)
index 370e57f..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-error[E0308]: mismatched types
-  --> $DIR/variance-contravariant-arg-trait-match.rs:13:5
-   |
-LL |     impls_get::<G,&'min i32>()
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch
-   |
-   = note: expected type `Get<&'min i32>`
-              found type `Get<&'max i32>`
-note: the lifetime `'min` as defined here...
-  --> $DIR/variance-contravariant-arg-trait-match.rs:10:21
-   |
-LL | fn get_min_from_max<'min, 'max, G>()
-   |                     ^^^^
-note: ...does not necessarily outlive the lifetime `'max` as defined here
-  --> $DIR/variance-contravariant-arg-trait-match.rs:10:27
-   |
-LL | fn get_min_from_max<'min, 'max, G>()
-   |                           ^^^^
-
-error[E0308]: mismatched types
-  --> $DIR/variance-contravariant-arg-trait-match.rs:21:5
-   |
-LL |     impls_get::<G,&'max i32>()
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch
-   |
-   = note: expected type `Get<&'max i32>`
-              found type `Get<&'min i32>`
-note: the lifetime `'min` as defined here...
-  --> $DIR/variance-contravariant-arg-trait-match.rs:16:21
-   |
-LL | fn get_max_from_min<'min, 'max, G>()
-   |                     ^^^^
-note: ...does not necessarily outlive the lifetime `'max` as defined here
-  --> $DIR/variance-contravariant-arg-trait-match.rs:16:27
-   |
-LL | fn get_max_from_min<'min, 'max, G>()
-   |                           ^^^^
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/variance/variance-contravariant-self-trait-match.base.stderr b/src/test/ui/variance/variance-contravariant-self-trait-match.base.stderr
new file mode 100644 (file)
index 0000000..2ccab2e
--- /dev/null
@@ -0,0 +1,41 @@
+error[E0308]: mismatched types
+  --> $DIR/variance-contravariant-self-trait-match.rs:17:5
+   |
+LL |     impls_get::<&'min G>();
+   |     ^^^^^^^^^^^^^^^^^^^^ lifetime mismatch
+   |
+   = note: expected type `<&'min G as Get>`
+              found type `<&'max G as Get>`
+note: the lifetime `'min` as defined here...
+  --> $DIR/variance-contravariant-self-trait-match.rs:14:21
+   |
+LL | fn get_min_from_max<'min, 'max, G>()
+   |                     ^^^^
+note: ...does not necessarily outlive the lifetime `'max` as defined here
+  --> $DIR/variance-contravariant-self-trait-match.rs:14:27
+   |
+LL | fn get_min_from_max<'min, 'max, G>()
+   |                           ^^^^
+
+error[E0308]: mismatched types
+  --> $DIR/variance-contravariant-self-trait-match.rs:28:5
+   |
+LL |     impls_get::<&'max G>();
+   |     ^^^^^^^^^^^^^^^^^^^^ lifetime mismatch
+   |
+   = note: expected type `<&'max G as Get>`
+              found type `<&'min G as Get>`
+note: the lifetime `'min` as defined here...
+  --> $DIR/variance-contravariant-self-trait-match.rs:22:21
+   |
+LL | fn get_max_from_min<'min, 'max, G>()
+   |                     ^^^^
+note: ...does not necessarily outlive the lifetime `'max` as defined here
+  --> $DIR/variance-contravariant-self-trait-match.rs:22:27
+   |
+LL | fn get_max_from_min<'min, 'max, G>()
+   |                           ^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
index fe08ce0b84d218e08a3c38c6feec48bf74d52493..d2c549b1f715daa85c5c18657f188f32597836a7 100644 (file)
@@ -1,5 +1,5 @@
 error: lifetime may not live long enough
-  --> $DIR/variance-contravariant-self-trait-match.rs:13:5
+  --> $DIR/variance-contravariant-self-trait-match.rs:17:5
    |
 LL | fn get_min_from_max<'min, 'max, G>()
    |                     ----  ---- lifetime `'max` defined here
@@ -12,7 +12,7 @@ LL |     impls_get::<&'min G>();
    = help: consider adding the following bound: `'min: 'max`
 
 error: lifetime may not live long enough
-  --> $DIR/variance-contravariant-self-trait-match.rs:22:5
+  --> $DIR/variance-contravariant-self-trait-match.rs:28:5
    |
 LL | fn get_max_from_min<'min, 'max, G>()
    |                     ----  ---- lifetime `'max` defined here
index e17375841b81c385ea10e370885636b64100c32f..f8d7c68fafe73a13d8418940b59abfce4c7d3807 100644 (file)
@@ -3,6 +3,10 @@
 // Test that even when `Self` is only used in contravariant position, it
 // is treated as invariant.
 
+// revisions: base nll
+// ignore-compare-mode-nll
+//[nll] compile-flags: -Z borrowck=mir
+
 trait Get {
     fn get(&self);
 }
@@ -10,7 +14,9 @@ trait Get {
 fn get_min_from_max<'min, 'max, G>()
     where 'max : 'min, G : 'max, &'max G : Get
 {
-    impls_get::<&'min G>(); //~ ERROR mismatched types
+    impls_get::<&'min G>();
+    //[base]~^ ERROR mismatched types
+    //[nll]~^^ ERROR lifetime may not live long enough
 }
 
 fn get_max_from_min<'min, 'max, G>()
@@ -19,7 +25,9 @@ fn get_max_from_min<'min, 'max, G>()
     // Previously OK, but now error because traits are invariant with
     // respect to all inputs.
 
-    impls_get::<&'max G>(); //~ ERROR mismatched types
+    impls_get::<&'max G>();
+    //[base]~^ ERROR mismatched types
+    //[nll]~^^ ERROR lifetime may not live long enough
 }
 
 fn impls_get<G>() where G : Get { }
diff --git a/src/test/ui/variance/variance-contravariant-self-trait-match.stderr b/src/test/ui/variance/variance-contravariant-self-trait-match.stderr
deleted file mode 100644 (file)
index ab14faa..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-error[E0308]: mismatched types
-  --> $DIR/variance-contravariant-self-trait-match.rs:13:5
-   |
-LL |     impls_get::<&'min G>();
-   |     ^^^^^^^^^^^^^^^^^^^^ lifetime mismatch
-   |
-   = note: expected type `<&'min G as Get>`
-              found type `<&'max G as Get>`
-note: the lifetime `'min` as defined here...
-  --> $DIR/variance-contravariant-self-trait-match.rs:10:21
-   |
-LL | fn get_min_from_max<'min, 'max, G>()
-   |                     ^^^^
-note: ...does not necessarily outlive the lifetime `'max` as defined here
-  --> $DIR/variance-contravariant-self-trait-match.rs:10:27
-   |
-LL | fn get_min_from_max<'min, 'max, G>()
-   |                           ^^^^
-
-error[E0308]: mismatched types
-  --> $DIR/variance-contravariant-self-trait-match.rs:22:5
-   |
-LL |     impls_get::<&'max G>();
-   |     ^^^^^^^^^^^^^^^^^^^^ lifetime mismatch
-   |
-   = note: expected type `<&'max G as Get>`
-              found type `<&'min G as Get>`
-note: the lifetime `'min` as defined here...
-  --> $DIR/variance-contravariant-self-trait-match.rs:16:21
-   |
-LL | fn get_max_from_min<'min, 'max, G>()
-   |                     ^^^^
-note: ...does not necessarily outlive the lifetime `'max` as defined here
-  --> $DIR/variance-contravariant-self-trait-match.rs:16:27
-   |
-LL | fn get_max_from_min<'min, 'max, G>()
-   |                           ^^^^
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/variance/variance-covariant-arg-object.base.stderr b/src/test/ui/variance/variance-covariant-arg-object.base.stderr
new file mode 100644 (file)
index 0000000..3a97875
--- /dev/null
@@ -0,0 +1,41 @@
+error[E0308]: mismatched types
+  --> $DIR/variance-covariant-arg-object.rs:19:5
+   |
+LL |     v
+   |     ^ lifetime mismatch
+   |
+   = note: expected trait object `dyn Get<&'min i32>`
+              found trait object `dyn Get<&'max i32>`
+note: the lifetime `'min` as defined here...
+  --> $DIR/variance-covariant-arg-object.rs:14:21
+   |
+LL | fn get_min_from_max<'min, 'max>(v: Box<dyn Get<&'max i32>>)
+   |                     ^^^^
+note: ...does not necessarily outlive the lifetime `'max` as defined here
+  --> $DIR/variance-covariant-arg-object.rs:14:27
+   |
+LL | fn get_min_from_max<'min, 'max>(v: Box<dyn Get<&'max i32>>)
+   |                           ^^^^
+
+error[E0308]: mismatched types
+  --> $DIR/variance-covariant-arg-object.rs:28:5
+   |
+LL |     v
+   |     ^ lifetime mismatch
+   |
+   = note: expected trait object `dyn Get<&'max i32>`
+              found trait object `dyn Get<&'min i32>`
+note: the lifetime `'min` as defined here...
+  --> $DIR/variance-covariant-arg-object.rs:24:21
+   |
+LL | fn get_max_from_min<'min, 'max, G>(v: Box<dyn Get<&'min i32>>)
+   |                     ^^^^
+note: ...does not necessarily outlive the lifetime `'max` as defined here
+  --> $DIR/variance-covariant-arg-object.rs:24:27
+   |
+LL | fn get_max_from_min<'min, 'max, G>(v: Box<dyn Get<&'min i32>>)
+   |                           ^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
index b116b8e263fd2917bf18bf8149c94cc88376c932..1b2ec61825f8f75001f799c946996464bd1d3c13 100644 (file)
@@ -1,5 +1,5 @@
 error: lifetime may not live long enough
-  --> $DIR/variance-covariant-arg-object.rs:15:5
+  --> $DIR/variance-covariant-arg-object.rs:19:5
    |
 LL | fn get_min_from_max<'min, 'max>(v: Box<dyn Get<&'max i32>>)
    |                     ----  ---- lifetime `'max` defined here
@@ -12,7 +12,7 @@ LL |     v
    = help: consider adding the following bound: `'min: 'max`
 
 error: lifetime may not live long enough
-  --> $DIR/variance-covariant-arg-object.rs:22:5
+  --> $DIR/variance-covariant-arg-object.rs:28:5
    |
 LL | fn get_max_from_min<'min, 'max, G>(v: Box<dyn Get<&'min i32>>)
    |                     ----  ---- lifetime `'max` defined here
index 7cbf65ae3d924be9a5d21ebf525f6c1cc0c7c708..20f74a3987e126c3ae36c22f66792f817367f532 100644 (file)
@@ -3,6 +3,10 @@
 // Test that even when `T` is only used in covariant position, it
 // is treated as invariant.
 
+// revisions: base nll
+// ignore-compare-mode-nll
+//[nll] compile-flags: -Z borrowck=mir
+
 trait Get<T> : 'static {
     fn get(&self) -> T;
 }
@@ -12,14 +16,18 @@ fn get_min_from_max<'min, 'max>(v: Box<dyn Get<&'max i32>>)
     where 'max : 'min
 {
     // Previously OK, now an error as traits are invariant.
-    v //~ ERROR mismatched types
+    v
+    //[base]~^ ERROR mismatched types
+    //[nll]~^^ ERROR lifetime may not live long enough
 }
 
 fn get_max_from_min<'min, 'max, G>(v: Box<dyn Get<&'min i32>>)
                                    -> Box<dyn Get<&'max i32>>
     where 'max : 'min
 {
-    v //~ ERROR mismatched types
+    v
+    //[base]~^ ERROR mismatched types
+    //[nll]~^^ ERROR lifetime may not live long enough
 }
 
 fn main() { }
diff --git a/src/test/ui/variance/variance-covariant-arg-object.stderr b/src/test/ui/variance/variance-covariant-arg-object.stderr
deleted file mode 100644 (file)
index d590a4d..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-error[E0308]: mismatched types
-  --> $DIR/variance-covariant-arg-object.rs:15:5
-   |
-LL |     v
-   |     ^ lifetime mismatch
-   |
-   = note: expected trait object `dyn Get<&'min i32>`
-              found trait object `dyn Get<&'max i32>`
-note: the lifetime `'min` as defined here...
-  --> $DIR/variance-covariant-arg-object.rs:10:21
-   |
-LL | fn get_min_from_max<'min, 'max>(v: Box<dyn Get<&'max i32>>)
-   |                     ^^^^
-note: ...does not necessarily outlive the lifetime `'max` as defined here
-  --> $DIR/variance-covariant-arg-object.rs:10:27
-   |
-LL | fn get_min_from_max<'min, 'max>(v: Box<dyn Get<&'max i32>>)
-   |                           ^^^^
-
-error[E0308]: mismatched types
-  --> $DIR/variance-covariant-arg-object.rs:22:5
-   |
-LL |     v
-   |     ^ lifetime mismatch
-   |
-   = note: expected trait object `dyn Get<&'max i32>`
-              found trait object `dyn Get<&'min i32>`
-note: the lifetime `'min` as defined here...
-  --> $DIR/variance-covariant-arg-object.rs:18:21
-   |
-LL | fn get_max_from_min<'min, 'max, G>(v: Box<dyn Get<&'min i32>>)
-   |                     ^^^^
-note: ...does not necessarily outlive the lifetime `'max` as defined here
-  --> $DIR/variance-covariant-arg-object.rs:18:27
-   |
-LL | fn get_max_from_min<'min, 'max, G>(v: Box<dyn Get<&'min i32>>)
-   |                           ^^^^
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/variance/variance-covariant-arg-trait-match.base.stderr b/src/test/ui/variance/variance-covariant-arg-trait-match.base.stderr
new file mode 100644 (file)
index 0000000..1749a87
--- /dev/null
@@ -0,0 +1,41 @@
+error[E0308]: mismatched types
+  --> $DIR/variance-covariant-arg-trait-match.rs:18:5
+   |
+LL |     impls_get::<G,&'min i32>()
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch
+   |
+   = note: expected type `Get<&'min i32>`
+              found type `Get<&'max i32>`
+note: the lifetime `'min` as defined here...
+  --> $DIR/variance-covariant-arg-trait-match.rs:14:21
+   |
+LL | fn get_min_from_max<'min, 'max, G>()
+   |                     ^^^^
+note: ...does not necessarily outlive the lifetime `'max` as defined here
+  --> $DIR/variance-covariant-arg-trait-match.rs:14:27
+   |
+LL | fn get_min_from_max<'min, 'max, G>()
+   |                           ^^^^
+
+error[E0308]: mismatched types
+  --> $DIR/variance-covariant-arg-trait-match.rs:26:5
+   |
+LL |     impls_get::<G,&'max i32>()
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch
+   |
+   = note: expected type `Get<&'max i32>`
+              found type `Get<&'min i32>`
+note: the lifetime `'min` as defined here...
+  --> $DIR/variance-covariant-arg-trait-match.rs:23:21
+   |
+LL | fn get_max_from_min<'min, 'max, G>()
+   |                     ^^^^
+note: ...does not necessarily outlive the lifetime `'max` as defined here
+  --> $DIR/variance-covariant-arg-trait-match.rs:23:27
+   |
+LL | fn get_max_from_min<'min, 'max, G>()
+   |                           ^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
index a982a29d499c4f07672b1f27894ba5769fc24427..870af48b3e92ac8961af73950d3ffb5b84ac4870 100644 (file)
@@ -1,5 +1,5 @@
 error: lifetime may not live long enough
-  --> $DIR/variance-covariant-arg-trait-match.rs:14:5
+  --> $DIR/variance-covariant-arg-trait-match.rs:18:5
    |
 LL | fn get_min_from_max<'min, 'max, G>()
    |                     ----  ---- lifetime `'max` defined here
@@ -12,7 +12,7 @@ LL |     impls_get::<G,&'min i32>()
    = help: consider adding the following bound: `'min: 'max`
 
 error: lifetime may not live long enough
-  --> $DIR/variance-covariant-arg-trait-match.rs:20:5
+  --> $DIR/variance-covariant-arg-trait-match.rs:26:5
    |
 LL | fn get_max_from_min<'min, 'max, G>()
    |                     ----  ---- lifetime `'max` defined here
index 2d4f0ea158273713138f7c58e8d32007b82dd262..d3d66d3fc4ba13820d203628bcacd6ddf23f7102 100644 (file)
@@ -3,6 +3,10 @@
 // Test that even when `T` is only used in covariant position, it
 // is treated as invariant.
 
+// revisions: base nll
+// ignore-compare-mode-nll
+//[nll] compile-flags: -Z borrowck=mir
+
 trait Get<T> {
     fn get(&self) -> T;
 }
@@ -11,13 +15,17 @@ fn get_min_from_max<'min, 'max, G>()
     where 'max : 'min, G : Get<&'max i32>
 {
     // Previously OK, now an error as traits are invariant.
-    impls_get::<G,&'min i32>() //~ ERROR mismatched types
+    impls_get::<G,&'min i32>()
+    //[base]~^ ERROR mismatched types
+    //[nll]~^^ ERROR lifetime may not live long enough
 }
 
 fn get_max_from_min<'min, 'max, G>()
     where 'max : 'min, G : Get<&'min i32>
 {
-    impls_get::<G,&'max i32>() //~ ERROR mismatched types
+    impls_get::<G,&'max i32>()
+    //[base]~^ ERROR mismatched types
+    //[nll]~^^ ERROR lifetime may not live long enough
 }
 
 fn impls_get<G,T>() where G : Get<T> { }
diff --git a/src/test/ui/variance/variance-covariant-arg-trait-match.stderr b/src/test/ui/variance/variance-covariant-arg-trait-match.stderr
deleted file mode 100644 (file)
index eb1766b..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-error[E0308]: mismatched types
-  --> $DIR/variance-covariant-arg-trait-match.rs:14:5
-   |
-LL |     impls_get::<G,&'min i32>()
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch
-   |
-   = note: expected type `Get<&'min i32>`
-              found type `Get<&'max i32>`
-note: the lifetime `'min` as defined here...
-  --> $DIR/variance-covariant-arg-trait-match.rs:10:21
-   |
-LL | fn get_min_from_max<'min, 'max, G>()
-   |                     ^^^^
-note: ...does not necessarily outlive the lifetime `'max` as defined here
-  --> $DIR/variance-covariant-arg-trait-match.rs:10:27
-   |
-LL | fn get_min_from_max<'min, 'max, G>()
-   |                           ^^^^
-
-error[E0308]: mismatched types
-  --> $DIR/variance-covariant-arg-trait-match.rs:20:5
-   |
-LL |     impls_get::<G,&'max i32>()
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch
-   |
-   = note: expected type `Get<&'max i32>`
-              found type `Get<&'min i32>`
-note: the lifetime `'min` as defined here...
-  --> $DIR/variance-covariant-arg-trait-match.rs:17:21
-   |
-LL | fn get_max_from_min<'min, 'max, G>()
-   |                     ^^^^
-note: ...does not necessarily outlive the lifetime `'max` as defined here
-  --> $DIR/variance-covariant-arg-trait-match.rs:17:27
-   |
-LL | fn get_max_from_min<'min, 'max, G>()
-   |                           ^^^^
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/variance/variance-covariant-self-trait-match.base.stderr b/src/test/ui/variance/variance-covariant-self-trait-match.base.stderr
new file mode 100644 (file)
index 0000000..94afc01
--- /dev/null
@@ -0,0 +1,41 @@
+error[E0308]: mismatched types
+  --> $DIR/variance-covariant-self-trait-match.rs:18:5
+   |
+LL |     impls_get::<&'min G>();
+   |     ^^^^^^^^^^^^^^^^^^^^ lifetime mismatch
+   |
+   = note: expected type `<&'min G as Get>`
+              found type `<&'max G as Get>`
+note: the lifetime `'min` as defined here...
+  --> $DIR/variance-covariant-self-trait-match.rs:14:21
+   |
+LL | fn get_min_from_max<'min, 'max, G>()
+   |                     ^^^^
+note: ...does not necessarily outlive the lifetime `'max` as defined here
+  --> $DIR/variance-covariant-self-trait-match.rs:14:27
+   |
+LL | fn get_min_from_max<'min, 'max, G>()
+   |                           ^^^^
+
+error[E0308]: mismatched types
+  --> $DIR/variance-covariant-self-trait-match.rs:26:5
+   |
+LL |     impls_get::<&'max G>();
+   |     ^^^^^^^^^^^^^^^^^^^^ lifetime mismatch
+   |
+   = note: expected type `<&'max G as Get>`
+              found type `<&'min G as Get>`
+note: the lifetime `'min` as defined here...
+  --> $DIR/variance-covariant-self-trait-match.rs:23:21
+   |
+LL | fn get_max_from_min<'min, 'max, G>()
+   |                     ^^^^
+note: ...does not necessarily outlive the lifetime `'max` as defined here
+  --> $DIR/variance-covariant-self-trait-match.rs:23:27
+   |
+LL | fn get_max_from_min<'min, 'max, G>()
+   |                           ^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
index 81b25e38ec6d85729ca38674e8eeee121281dc4f..14da2d2a552dbdce957cd08a21a5ca68f09d0d60 100644 (file)
@@ -1,5 +1,5 @@
 error: lifetime may not live long enough
-  --> $DIR/variance-covariant-self-trait-match.rs:14:5
+  --> $DIR/variance-covariant-self-trait-match.rs:18:5
    |
 LL | fn get_min_from_max<'min, 'max, G>()
    |                     ----  ---- lifetime `'max` defined here
@@ -12,7 +12,7 @@ LL |     impls_get::<&'min G>();
    = help: consider adding the following bound: `'min: 'max`
 
 error: lifetime may not live long enough
-  --> $DIR/variance-covariant-self-trait-match.rs:20:5
+  --> $DIR/variance-covariant-self-trait-match.rs:26:5
    |
 LL | fn get_max_from_min<'min, 'max, G>()
    |                     ----  ---- lifetime `'max` defined here
index e86a5fc630bd5d88f6f052bc6d1738568b07e9a0..ece450173ca8d553750608cdf4171124db494ec8 100644 (file)
@@ -3,6 +3,10 @@
 // Test that even when `Self` is only used in covariant position, it
 // is treated as invariant.
 
+// revisions: base nll
+// ignore-compare-mode-nll
+//[nll] compile-flags: -Z borrowck=mir
+
 trait Get {
     fn get() -> Self;
 }
@@ -11,13 +15,17 @@ fn get_min_from_max<'min, 'max, G>()
     where 'max : 'min, G : 'max, &'max G : Get
 {
     // Previously OK, now an error as traits are invariant.
-    impls_get::<&'min G>(); //~ ERROR mismatched types
+    impls_get::<&'min G>();
+    //[base]~^ ERROR mismatched types
+    //[nll]~^^ ERROR lifetime may not live long enough
 }
 
 fn get_max_from_min<'min, 'max, G>()
     where 'max : 'min, G : 'max, &'min G : Get
 {
-    impls_get::<&'max G>(); //~ ERROR mismatched types
+    impls_get::<&'max G>();
+    //[base]~^ ERROR mismatched types
+    //[nll]~^^ ERROR lifetime may not live long enough
 }
 
 fn impls_get<G>() where G : Get { }
diff --git a/src/test/ui/variance/variance-covariant-self-trait-match.stderr b/src/test/ui/variance/variance-covariant-self-trait-match.stderr
deleted file mode 100644 (file)
index b0bcb2e..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-error[E0308]: mismatched types
-  --> $DIR/variance-covariant-self-trait-match.rs:14:5
-   |
-LL |     impls_get::<&'min G>();
-   |     ^^^^^^^^^^^^^^^^^^^^ lifetime mismatch
-   |
-   = note: expected type `<&'min G as Get>`
-              found type `<&'max G as Get>`
-note: the lifetime `'min` as defined here...
-  --> $DIR/variance-covariant-self-trait-match.rs:10:21
-   |
-LL | fn get_min_from_max<'min, 'max, G>()
-   |                     ^^^^
-note: ...does not necessarily outlive the lifetime `'max` as defined here
-  --> $DIR/variance-covariant-self-trait-match.rs:10:27
-   |
-LL | fn get_min_from_max<'min, 'max, G>()
-   |                           ^^^^
-
-error[E0308]: mismatched types
-  --> $DIR/variance-covariant-self-trait-match.rs:20:5
-   |
-LL |     impls_get::<&'max G>();
-   |     ^^^^^^^^^^^^^^^^^^^^ lifetime mismatch
-   |
-   = note: expected type `<&'max G as Get>`
-              found type `<&'min G as Get>`
-note: the lifetime `'min` as defined here...
-  --> $DIR/variance-covariant-self-trait-match.rs:17:21
-   |
-LL | fn get_max_from_min<'min, 'max, G>()
-   |                     ^^^^
-note: ...does not necessarily outlive the lifetime `'max` as defined here
-  --> $DIR/variance-covariant-self-trait-match.rs:17:27
-   |
-LL | fn get_max_from_min<'min, 'max, G>()
-   |                           ^^^^
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/variance/variance-invariant-arg-object.base.stderr b/src/test/ui/variance/variance-invariant-arg-object.base.stderr
new file mode 100644 (file)
index 0000000..ec9271e
--- /dev/null
@@ -0,0 +1,41 @@
+error[E0308]: mismatched types
+  --> $DIR/variance-invariant-arg-object.rs:15:5
+   |
+LL |     v
+   |     ^ lifetime mismatch
+   |
+   = note: expected trait object `dyn Get<&'min i32>`
+              found trait object `dyn Get<&'max i32>`
+note: the lifetime `'min` as defined here...
+  --> $DIR/variance-invariant-arg-object.rs:11:21
+   |
+LL | fn get_min_from_max<'min, 'max>(v: Box<dyn Get<&'max i32>>)
+   |                     ^^^^
+note: ...does not necessarily outlive the lifetime `'max` as defined here
+  --> $DIR/variance-invariant-arg-object.rs:11:27
+   |
+LL | fn get_min_from_max<'min, 'max>(v: Box<dyn Get<&'max i32>>)
+   |                           ^^^^
+
+error[E0308]: mismatched types
+  --> $DIR/variance-invariant-arg-object.rs:24:5
+   |
+LL |     v
+   |     ^ lifetime mismatch
+   |
+   = note: expected trait object `dyn Get<&'max i32>`
+              found trait object `dyn Get<&'min i32>`
+note: the lifetime `'min` as defined here...
+  --> $DIR/variance-invariant-arg-object.rs:20:21
+   |
+LL | fn get_max_from_min<'min, 'max, G>(v: Box<dyn Get<&'min i32>>)
+   |                     ^^^^
+note: ...does not necessarily outlive the lifetime `'max` as defined here
+  --> $DIR/variance-invariant-arg-object.rs:20:27
+   |
+LL | fn get_max_from_min<'min, 'max, G>(v: Box<dyn Get<&'min i32>>)
+   |                           ^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
index 303c7f3388a7426bfa25c2596c5d18fbdca2003d..47364f426566346eac6e67feb313e83da291616d 100644 (file)
@@ -1,5 +1,5 @@
 error: lifetime may not live long enough
-  --> $DIR/variance-invariant-arg-object.rs:11:5
+  --> $DIR/variance-invariant-arg-object.rs:15:5
    |
 LL | fn get_min_from_max<'min, 'max>(v: Box<dyn Get<&'max i32>>)
    |                     ----  ---- lifetime `'max` defined here
@@ -12,7 +12,7 @@ LL |     v
    = help: consider adding the following bound: `'min: 'max`
 
 error: lifetime may not live long enough
-  --> $DIR/variance-invariant-arg-object.rs:18:5
+  --> $DIR/variance-invariant-arg-object.rs:24:5
    |
 LL | fn get_max_from_min<'min, 'max, G>(v: Box<dyn Get<&'min i32>>)
    |                     ----  ---- lifetime `'max` defined here
index 886d263c45768652ae9b5cf3aa67dfd17984c150..cc8820fbac69e97b79edda9118611cb8e36a638f 100644 (file)
@@ -1,5 +1,9 @@
 #![allow(dead_code)]
 
+// revisions: base nll
+// ignore-compare-mode-nll
+//[nll] compile-flags: -Z borrowck=mir
+
 trait Get<T> : 'static {
     fn get(&self, t: T) -> T;
 }
@@ -8,14 +12,18 @@ fn get_min_from_max<'min, 'max>(v: Box<dyn Get<&'max i32>>)
                                 -> Box<dyn Get<&'min i32>>
     where 'max : 'min
 {
-    v //~ ERROR mismatched types
+    v
+    //[base]~^ ERROR mismatched types
+    //[nll]~^^ ERROR lifetime may not live long enough
 }
 
 fn get_max_from_min<'min, 'max, G>(v: Box<dyn Get<&'min i32>>)
                                    -> Box<dyn Get<&'max i32>>
     where 'max : 'min
 {
-    v //~ ERROR mismatched types
+    v
+    //[base]~^ ERROR mismatched types
+    //[nll]~^^ ERROR lifetime may not live long enough
 }
 
 fn main() { }
diff --git a/src/test/ui/variance/variance-invariant-arg-object.stderr b/src/test/ui/variance/variance-invariant-arg-object.stderr
deleted file mode 100644 (file)
index 6c1b07e..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-error[E0308]: mismatched types
-  --> $DIR/variance-invariant-arg-object.rs:11:5
-   |
-LL |     v
-   |     ^ lifetime mismatch
-   |
-   = note: expected trait object `dyn Get<&'min i32>`
-              found trait object `dyn Get<&'max i32>`
-note: the lifetime `'min` as defined here...
-  --> $DIR/variance-invariant-arg-object.rs:7:21
-   |
-LL | fn get_min_from_max<'min, 'max>(v: Box<dyn Get<&'max i32>>)
-   |                     ^^^^
-note: ...does not necessarily outlive the lifetime `'max` as defined here
-  --> $DIR/variance-invariant-arg-object.rs:7:27
-   |
-LL | fn get_min_from_max<'min, 'max>(v: Box<dyn Get<&'max i32>>)
-   |                           ^^^^
-
-error[E0308]: mismatched types
-  --> $DIR/variance-invariant-arg-object.rs:18:5
-   |
-LL |     v
-   |     ^ lifetime mismatch
-   |
-   = note: expected trait object `dyn Get<&'max i32>`
-              found trait object `dyn Get<&'min i32>`
-note: the lifetime `'min` as defined here...
-  --> $DIR/variance-invariant-arg-object.rs:14:21
-   |
-LL | fn get_max_from_min<'min, 'max, G>(v: Box<dyn Get<&'min i32>>)
-   |                     ^^^^
-note: ...does not necessarily outlive the lifetime `'max` as defined here
-  --> $DIR/variance-invariant-arg-object.rs:14:27
-   |
-LL | fn get_max_from_min<'min, 'max, G>(v: Box<dyn Get<&'min i32>>)
-   |                           ^^^^
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/variance/variance-invariant-arg-trait-match.base.stderr b/src/test/ui/variance/variance-invariant-arg-trait-match.base.stderr
new file mode 100644 (file)
index 0000000..fe28468
--- /dev/null
@@ -0,0 +1,41 @@
+error[E0308]: mismatched types
+  --> $DIR/variance-invariant-arg-trait-match.rs:14:5
+   |
+LL |     impls_get::<G,&'min i32>()
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch
+   |
+   = note: expected type `Get<&'min i32>`
+              found type `Get<&'max i32>`
+note: the lifetime `'min` as defined here...
+  --> $DIR/variance-invariant-arg-trait-match.rs:11:21
+   |
+LL | fn get_min_from_max<'min, 'max, G>()
+   |                     ^^^^
+note: ...does not necessarily outlive the lifetime `'max` as defined here
+  --> $DIR/variance-invariant-arg-trait-match.rs:11:27
+   |
+LL | fn get_min_from_max<'min, 'max, G>()
+   |                           ^^^^
+
+error[E0308]: mismatched types
+  --> $DIR/variance-invariant-arg-trait-match.rs:22:5
+   |
+LL |     impls_get::<G,&'max i32>()
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch
+   |
+   = note: expected type `Get<&'max i32>`
+              found type `Get<&'min i32>`
+note: the lifetime `'min` as defined here...
+  --> $DIR/variance-invariant-arg-trait-match.rs:19:21
+   |
+LL | fn get_max_from_min<'min, 'max, G>()
+   |                     ^^^^
+note: ...does not necessarily outlive the lifetime `'max` as defined here
+  --> $DIR/variance-invariant-arg-trait-match.rs:19:27
+   |
+LL | fn get_max_from_min<'min, 'max, G>()
+   |                           ^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
index 2909e81fcbf767e5c6793c3c43be90377b9b03bf..74d2745cbbea8916179030ba2b67e77d57a0f311 100644 (file)
@@ -1,5 +1,5 @@
 error: lifetime may not live long enough
-  --> $DIR/variance-invariant-arg-trait-match.rs:10:5
+  --> $DIR/variance-invariant-arg-trait-match.rs:14:5
    |
 LL | fn get_min_from_max<'min, 'max, G>()
    |                     ----  ---- lifetime `'max` defined here
@@ -12,7 +12,7 @@ LL |     impls_get::<G,&'min i32>()
    = help: consider adding the following bound: `'min: 'max`
 
 error: lifetime may not live long enough
-  --> $DIR/variance-invariant-arg-trait-match.rs:16:5
+  --> $DIR/variance-invariant-arg-trait-match.rs:22:5
    |
 LL | fn get_max_from_min<'min, 'max, G>()
    |                     ----  ---- lifetime `'max` defined here
index 97d0fdd98e460ae476374a2fc16e06332ee63d61..498dd574bb38148374711d60a846440372fdac2e 100644 (file)
@@ -1,5 +1,9 @@
 #![allow(dead_code)]
 
+// revisions: base nll
+// ignore-compare-mode-nll
+//[nll] compile-flags: -Z borrowck=mir
+
 trait Get<T> {
     fn get(&self, t: T) -> T;
 }
@@ -7,13 +11,17 @@ trait Get<T> {
 fn get_min_from_max<'min, 'max, G>()
     where 'max : 'min, G : Get<&'max i32>
 {
-    impls_get::<G,&'min i32>() //~ ERROR mismatched types
+    impls_get::<G,&'min i32>()
+    //[base]~^ ERROR mismatched types
+    //[nll]~^^ ERROR lifetime may not live long enough
 }
 
 fn get_max_from_min<'min, 'max, G>()
     where 'max : 'min, G : Get<&'min i32>
 {
-    impls_get::<G,&'max i32>() //~ ERROR mismatched types
+    impls_get::<G,&'max i32>()
+    //[base]~^ ERROR mismatched types
+    //[nll]~^^ ERROR lifetime may not live long enough
 }
 
 fn impls_get<G,T>() where G : Get<T> { }
diff --git a/src/test/ui/variance/variance-invariant-arg-trait-match.stderr b/src/test/ui/variance/variance-invariant-arg-trait-match.stderr
deleted file mode 100644 (file)
index 0328496..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-error[E0308]: mismatched types
-  --> $DIR/variance-invariant-arg-trait-match.rs:10:5
-   |
-LL |     impls_get::<G,&'min i32>()
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch
-   |
-   = note: expected type `Get<&'min i32>`
-              found type `Get<&'max i32>`
-note: the lifetime `'min` as defined here...
-  --> $DIR/variance-invariant-arg-trait-match.rs:7:21
-   |
-LL | fn get_min_from_max<'min, 'max, G>()
-   |                     ^^^^
-note: ...does not necessarily outlive the lifetime `'max` as defined here
-  --> $DIR/variance-invariant-arg-trait-match.rs:7:27
-   |
-LL | fn get_min_from_max<'min, 'max, G>()
-   |                           ^^^^
-
-error[E0308]: mismatched types
-  --> $DIR/variance-invariant-arg-trait-match.rs:16:5
-   |
-LL |     impls_get::<G,&'max i32>()
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch
-   |
-   = note: expected type `Get<&'max i32>`
-              found type `Get<&'min i32>`
-note: the lifetime `'min` as defined here...
-  --> $DIR/variance-invariant-arg-trait-match.rs:13:21
-   |
-LL | fn get_max_from_min<'min, 'max, G>()
-   |                     ^^^^
-note: ...does not necessarily outlive the lifetime `'max` as defined here
-  --> $DIR/variance-invariant-arg-trait-match.rs:13:27
-   |
-LL | fn get_max_from_min<'min, 'max, G>()
-   |                           ^^^^
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/variance/variance-invariant-self-trait-match.base.stderr b/src/test/ui/variance/variance-invariant-self-trait-match.base.stderr
new file mode 100644 (file)
index 0000000..a2589f0
--- /dev/null
@@ -0,0 +1,41 @@
+error[E0308]: mismatched types
+  --> $DIR/variance-invariant-self-trait-match.rs:14:5
+   |
+LL |     impls_get::<&'min G>();
+   |     ^^^^^^^^^^^^^^^^^^^^ lifetime mismatch
+   |
+   = note: expected type `<&'min G as Get>`
+              found type `<&'max G as Get>`
+note: the lifetime `'min` as defined here...
+  --> $DIR/variance-invariant-self-trait-match.rs:11:21
+   |
+LL | fn get_min_from_max<'min, 'max, G>()
+   |                     ^^^^
+note: ...does not necessarily outlive the lifetime `'max` as defined here
+  --> $DIR/variance-invariant-self-trait-match.rs:11:27
+   |
+LL | fn get_min_from_max<'min, 'max, G>()
+   |                           ^^^^
+
+error[E0308]: mismatched types
+  --> $DIR/variance-invariant-self-trait-match.rs:22:5
+   |
+LL |     impls_get::<&'max G>();
+   |     ^^^^^^^^^^^^^^^^^^^^ lifetime mismatch
+   |
+   = note: expected type `<&'max G as Get>`
+              found type `<&'min G as Get>`
+note: the lifetime `'min` as defined here...
+  --> $DIR/variance-invariant-self-trait-match.rs:19:21
+   |
+LL | fn get_max_from_min<'min, 'max, G>()
+   |                     ^^^^
+note: ...does not necessarily outlive the lifetime `'max` as defined here
+  --> $DIR/variance-invariant-self-trait-match.rs:19:27
+   |
+LL | fn get_max_from_min<'min, 'max, G>()
+   |                           ^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
index 01b2c8803ae7248a5af1f19e01ab5806a5f33aaf..9d16e89450d786ff7189e40e5f443ad9a8ded6c9 100644 (file)
@@ -1,5 +1,5 @@
 error: lifetime may not live long enough
-  --> $DIR/variance-invariant-self-trait-match.rs:10:5
+  --> $DIR/variance-invariant-self-trait-match.rs:14:5
    |
 LL | fn get_min_from_max<'min, 'max, G>()
    |                     ----  ---- lifetime `'max` defined here
@@ -12,7 +12,7 @@ LL |     impls_get::<&'min G>();
    = help: consider adding the following bound: `'min: 'max`
 
 error: lifetime may not live long enough
-  --> $DIR/variance-invariant-self-trait-match.rs:16:5
+  --> $DIR/variance-invariant-self-trait-match.rs:22:5
    |
 LL | fn get_max_from_min<'min, 'max, G>()
    |                     ----  ---- lifetime `'max` defined here
index 678eefa634bbde480b55794f556b58fa12dd3b14..0f3176b14b44d1f3fae2cdf1ca4d84a859bbafef 100644 (file)
@@ -1,5 +1,9 @@
 #![allow(dead_code)]
 
+// revisions: base nll
+// ignore-compare-mode-nll
+//[nll] compile-flags: -Z borrowck=mir
+
 trait Get {
     fn get(&self) -> Self;
 }
@@ -7,13 +11,17 @@ trait Get {
 fn get_min_from_max<'min, 'max, G>()
     where 'max : 'min, &'max G : Get, G : 'max
 {
-    impls_get::<&'min G>(); //~ ERROR mismatched types
+    impls_get::<&'min G>();
+    //[base]~^ ERROR mismatched types
+    //[nll]~^^ ERROR lifetime may not live long enough
 }
 
 fn get_max_from_min<'min, 'max, G>()
     where 'max : 'min, &'min G : Get, G : 'min
 {
-    impls_get::<&'max G>(); //~ ERROR mismatched types
+    impls_get::<&'max G>();
+    //[base]~^ ERROR mismatched types
+    //[nll]~^^ ERROR lifetime may not live long enough
 }
 
 fn impls_get<G>() where G : Get { }
diff --git a/src/test/ui/variance/variance-invariant-self-trait-match.stderr b/src/test/ui/variance/variance-invariant-self-trait-match.stderr
deleted file mode 100644 (file)
index c553581..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-error[E0308]: mismatched types
-  --> $DIR/variance-invariant-self-trait-match.rs:10:5
-   |
-LL |     impls_get::<&'min G>();
-   |     ^^^^^^^^^^^^^^^^^^^^ lifetime mismatch
-   |
-   = note: expected type `<&'min G as Get>`
-              found type `<&'max G as Get>`
-note: the lifetime `'min` as defined here...
-  --> $DIR/variance-invariant-self-trait-match.rs:7:21
-   |
-LL | fn get_min_from_max<'min, 'max, G>()
-   |                     ^^^^
-note: ...does not necessarily outlive the lifetime `'max` as defined here
-  --> $DIR/variance-invariant-self-trait-match.rs:7:27
-   |
-LL | fn get_min_from_max<'min, 'max, G>()
-   |                           ^^^^
-
-error[E0308]: mismatched types
-  --> $DIR/variance-invariant-self-trait-match.rs:16:5
-   |
-LL |     impls_get::<&'max G>();
-   |     ^^^^^^^^^^^^^^^^^^^^ lifetime mismatch
-   |
-   = note: expected type `<&'max G as Get>`
-              found type `<&'min G as Get>`
-note: the lifetime `'min` as defined here...
-  --> $DIR/variance-invariant-self-trait-match.rs:13:21
-   |
-LL | fn get_max_from_min<'min, 'max, G>()
-   |                     ^^^^
-note: ...does not necessarily outlive the lifetime `'max` as defined here
-  --> $DIR/variance-invariant-self-trait-match.rs:13:27
-   |
-LL | fn get_max_from_min<'min, 'max, G>()
-   |                           ^^^^
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/variance/variance-trait-matching.base.stderr b/src/test/ui/variance/variance-trait-matching.base.stderr
new file mode 100644 (file)
index 0000000..8872620
--- /dev/null
@@ -0,0 +1,12 @@
+error[E0621]: explicit lifetime required in the type of `get`
+  --> $DIR/variance-trait-matching.rs:28:5
+   |
+LL | fn get<'a, G>(get: &G) -> i32
+   |                    -- help: add explicit lifetime `'a` to the type of `get`: `&'a G`
+...
+LL |     pick(get, &22)
+   |     ^^^^ lifetime `'a` required
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0621`.
index 3308cc6d2501643c19669f1b2bae0fe41c488fc9..52c5eed3167cd31aa46eb06f5bdec680700e9b4d 100644 (file)
@@ -1,5 +1,5 @@
 error[E0621]: explicit lifetime required in the type of `get`
-  --> $DIR/variance-trait-matching.rs:24:5
+  --> $DIR/variance-trait-matching.rs:28:5
    |
 LL | fn get<'a, G>(get: &G) -> i32
    |                    -- help: add explicit lifetime `'a` to the type of `get`: `&'a G`
index b4efee7d6040fa75433c92032914442e398f3128..993db93533e2746eefc83b41475b8b92703e6c27 100644 (file)
@@ -1,5 +1,9 @@
 #![allow(dead_code)]
 
+// revisions: base nll
+// ignore-compare-mode-nll
+//[nll] compile-flags: -Z borrowck=mir
+
 // Get<T> is covariant in T
 trait Get<T> {
     fn get(&self) -> T;
diff --git a/src/test/ui/variance/variance-trait-matching.stderr b/src/test/ui/variance/variance-trait-matching.stderr
deleted file mode 100644 (file)
index 5141531..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0621]: explicit lifetime required in the type of `get`
-  --> $DIR/variance-trait-matching.rs:24:5
-   |
-LL | fn get<'a, G>(get: &G) -> i32
-   |                    -- help: add explicit lifetime `'a` to the type of `get`: `&'a G`
-...
-LL |     pick(get, &22)
-   |     ^^^^ lifetime `'a` required
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0621`.
diff --git a/src/test/ui/variance/variance-use-contravariant-struct-1.base.stderr b/src/test/ui/variance/variance-use-contravariant-struct-1.base.stderr
new file mode 100644 (file)
index 0000000..a354aa5
--- /dev/null
@@ -0,0 +1,22 @@
+error[E0308]: mismatched types
+  --> $DIR/variance-use-contravariant-struct-1.rs:14:5
+   |
+LL |     v
+   |     ^ lifetime mismatch
+   |
+   = note: expected struct `SomeStruct<&'min ()>`
+              found struct `SomeStruct<&'max ()>`
+note: the lifetime `'min` as defined here...
+  --> $DIR/variance-use-contravariant-struct-1.rs:10:8
+   |
+LL | fn foo<'min,'max>(v: SomeStruct<&'max ()>)
+   |        ^^^^
+note: ...does not necessarily outlive the lifetime `'max` as defined here
+  --> $DIR/variance-use-contravariant-struct-1.rs:10:13
+   |
+LL | fn foo<'min,'max>(v: SomeStruct<&'max ()>)
+   |             ^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
index 837c70ca3136733190c6e619ca03334e47f6b517..9549a8c08af615cac99b894268b123cb671d9dff 100644 (file)
@@ -1,5 +1,5 @@
 error: lifetime may not live long enough
-  --> $DIR/variance-use-contravariant-struct-1.rs:12:5
+  --> $DIR/variance-use-contravariant-struct-1.rs:14:5
    |
 LL | fn foo<'min,'max>(v: SomeStruct<&'max ()>)
    |        ---- ---- lifetime `'max` defined here
index 8a02ef4ec85fda53877f23bf23a1e567542ccf22..b55f5e76775ef4330c8ea8bec1ef4aaf8e193477 100644 (file)
@@ -1,7 +1,9 @@
 // Test various uses of structs with distint variances to make sure
 // they permit lifetimes to be approximated as expected.
 
-
+// revisions: base nll
+// ignore-compare-mode-nll
+//[nll] compile-flags: -Z borrowck=mir
 
 struct SomeStruct<T>(fn(T));
 
@@ -9,7 +11,9 @@ fn foo<'min,'max>(v: SomeStruct<&'max ()>)
                   -> SomeStruct<&'min ()>
     where 'max : 'min
 {
-    v //~ ERROR mismatched types
+    v
+    //[base]~^ ERROR mismatched types
+    //[nll]~^^ ERROR lifetime may not live long enough
 }
 
 
diff --git a/src/test/ui/variance/variance-use-contravariant-struct-1.stderr b/src/test/ui/variance/variance-use-contravariant-struct-1.stderr
deleted file mode 100644 (file)
index ec0cb22..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-error[E0308]: mismatched types
-  --> $DIR/variance-use-contravariant-struct-1.rs:12:5
-   |
-LL |     v
-   |     ^ lifetime mismatch
-   |
-   = note: expected struct `SomeStruct<&'min ()>`
-              found struct `SomeStruct<&'max ()>`
-note: the lifetime `'min` as defined here...
-  --> $DIR/variance-use-contravariant-struct-1.rs:8:8
-   |
-LL | fn foo<'min,'max>(v: SomeStruct<&'max ()>)
-   |        ^^^^
-note: ...does not necessarily outlive the lifetime `'max` as defined here
-  --> $DIR/variance-use-contravariant-struct-1.rs:8:13
-   |
-LL | fn foo<'min,'max>(v: SomeStruct<&'max ()>)
-   |             ^^^^
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/variance/variance-use-covariant-struct-1.base.stderr b/src/test/ui/variance/variance-use-covariant-struct-1.base.stderr
new file mode 100644 (file)
index 0000000..542d44c
--- /dev/null
@@ -0,0 +1,22 @@
+error[E0308]: mismatched types
+  --> $DIR/variance-use-covariant-struct-1.rs:14:5
+   |
+LL |     v
+   |     ^ lifetime mismatch
+   |
+   = note: expected struct `SomeStruct<&'max ()>`
+              found struct `SomeStruct<&'min ()>`
+note: the lifetime `'min` as defined here...
+  --> $DIR/variance-use-covariant-struct-1.rs:10:8
+   |
+LL | fn foo<'min,'max>(v: SomeStruct<&'min ()>)
+   |        ^^^^
+note: ...does not necessarily outlive the lifetime `'max` as defined here
+  --> $DIR/variance-use-covariant-struct-1.rs:10:13
+   |
+LL | fn foo<'min,'max>(v: SomeStruct<&'min ()>)
+   |             ^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
index bab858c5acb37ac71f4607c29908293cd40fbaca..2fac827a0fb1f68ea00a52712dac982c989c1e97 100644 (file)
@@ -1,5 +1,5 @@
 error: lifetime may not live long enough
-  --> $DIR/variance-use-covariant-struct-1.rs:10:5
+  --> $DIR/variance-use-covariant-struct-1.rs:14:5
    |
 LL | fn foo<'min,'max>(v: SomeStruct<&'min ()>)
    |        ---- ---- lifetime `'max` defined here
index e19a35bdfacfe7a049019db90faf08f7ca1a7484..3e3e76d9792c29f88ab2ab06ff5d3134eba934a8 100644 (file)
@@ -1,13 +1,19 @@
 // Test that a covariant struct does not permit the lifetime of a
 // reference to be enlarged.
 
+// revisions: base nll
+// ignore-compare-mode-nll
+//[nll] compile-flags: -Z borrowck=mir
+
 struct SomeStruct<T>(T);
 
 fn foo<'min,'max>(v: SomeStruct<&'min ()>)
                   -> SomeStruct<&'max ()>
     where 'max : 'min
 {
-    v //~ ERROR mismatched types
+    v
+    //[base]~^ ERROR mismatched types
+    //[nll]~^^ ERROR lifetime may not live long enough
 }
 
 fn main() { }
diff --git a/src/test/ui/variance/variance-use-covariant-struct-1.stderr b/src/test/ui/variance/variance-use-covariant-struct-1.stderr
deleted file mode 100644 (file)
index 0c0071c..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-error[E0308]: mismatched types
-  --> $DIR/variance-use-covariant-struct-1.rs:10:5
-   |
-LL |     v
-   |     ^ lifetime mismatch
-   |
-   = note: expected struct `SomeStruct<&'max ()>`
-              found struct `SomeStruct<&'min ()>`
-note: the lifetime `'min` as defined here...
-  --> $DIR/variance-use-covariant-struct-1.rs:6:8
-   |
-LL | fn foo<'min,'max>(v: SomeStruct<&'min ()>)
-   |        ^^^^
-note: ...does not necessarily outlive the lifetime `'max` as defined here
-  --> $DIR/variance-use-covariant-struct-1.rs:6:13
-   |
-LL | fn foo<'min,'max>(v: SomeStruct<&'min ()>)
-   |             ^^^^
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/variance/variance-use-invariant-struct-1.base.stderr b/src/test/ui/variance/variance-use-invariant-struct-1.base.stderr
new file mode 100644 (file)
index 0000000..02b4e91
--- /dev/null
@@ -0,0 +1,41 @@
+error[E0308]: mismatched types
+  --> $DIR/variance-use-invariant-struct-1.rs:14:5
+   |
+LL |     v
+   |     ^ lifetime mismatch
+   |
+   = note: expected struct `SomeStruct<&'min ()>`
+              found struct `SomeStruct<&'max ()>`
+note: the lifetime `'min` as defined here...
+  --> $DIR/variance-use-invariant-struct-1.rs:10:8
+   |
+LL | fn foo<'min,'max>(v: SomeStruct<&'max ()>)
+   |        ^^^^
+note: ...does not necessarily outlive the lifetime `'max` as defined here
+  --> $DIR/variance-use-invariant-struct-1.rs:10:13
+   |
+LL | fn foo<'min,'max>(v: SomeStruct<&'max ()>)
+   |             ^^^^
+
+error[E0308]: mismatched types
+  --> $DIR/variance-use-invariant-struct-1.rs:23:5
+   |
+LL |     v
+   |     ^ lifetime mismatch
+   |
+   = note: expected struct `SomeStruct<&'max ()>`
+              found struct `SomeStruct<&'min ()>`
+note: the lifetime `'min` as defined here...
+  --> $DIR/variance-use-invariant-struct-1.rs:19:8
+   |
+LL | fn bar<'min,'max>(v: SomeStruct<&'min ()>)
+   |        ^^^^
+note: ...does not necessarily outlive the lifetime `'max` as defined here
+  --> $DIR/variance-use-invariant-struct-1.rs:19:13
+   |
+LL | fn bar<'min,'max>(v: SomeStruct<&'min ()>)
+   |             ^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
index f1df2a88b6bab354de860837c7727b389edf90fc..429919c8de1bca67c08c2e7b0c124b5af26219e0 100644 (file)
@@ -1,5 +1,5 @@
 error: lifetime may not live long enough
-  --> $DIR/variance-use-invariant-struct-1.rs:12:5
+  --> $DIR/variance-use-invariant-struct-1.rs:14:5
    |
 LL | fn foo<'min,'max>(v: SomeStruct<&'max ()>)
    |        ---- ---- lifetime `'max` defined here
@@ -15,7 +15,7 @@ LL |     v
    = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
 
 error: lifetime may not live long enough
-  --> $DIR/variance-use-invariant-struct-1.rs:19:5
+  --> $DIR/variance-use-invariant-struct-1.rs:23:5
    |
 LL | fn bar<'min,'max>(v: SomeStruct<&'min ()>)
    |        ---- ---- lifetime `'max` defined here
index 4772a9fb87829e98c08f119e7b1cc300257dcaf4..7be03514e01a9bbb20ae3dfb88bb476a7b3a0ba6 100644 (file)
@@ -1,7 +1,9 @@
 // Test various uses of structs with distint variances to make sure
 // they permit lifetimes to be approximated as expected.
 
-
+// revisions: base nll
+// ignore-compare-mode-nll
+//[nll] compile-flags: -Z borrowck=mir
 
 struct SomeStruct<T>(*mut T);
 
@@ -9,14 +11,18 @@ fn foo<'min,'max>(v: SomeStruct<&'max ()>)
                   -> SomeStruct<&'min ()>
     where 'max : 'min
 {
-    v //~ ERROR mismatched types
+    v
+    //[base]~^ ERROR mismatched types
+    //[nll]~^^ ERROR lifetime may not live long enough
 }
 
 fn bar<'min,'max>(v: SomeStruct<&'min ()>)
                   -> SomeStruct<&'max ()>
     where 'max : 'min
 {
-    v //~ ERROR mismatched types
+    v
+    //[base]~^ ERROR mismatched types
+    //[nll]~^^ ERROR lifetime may not live long enough
 }
 
 
diff --git a/src/test/ui/variance/variance-use-invariant-struct-1.stderr b/src/test/ui/variance/variance-use-invariant-struct-1.stderr
deleted file mode 100644 (file)
index 76e4bd7..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-error[E0308]: mismatched types
-  --> $DIR/variance-use-invariant-struct-1.rs:12:5
-   |
-LL |     v
-   |     ^ lifetime mismatch
-   |
-   = note: expected struct `SomeStruct<&'min ()>`
-              found struct `SomeStruct<&'max ()>`
-note: the lifetime `'min` as defined here...
-  --> $DIR/variance-use-invariant-struct-1.rs:8:8
-   |
-LL | fn foo<'min,'max>(v: SomeStruct<&'max ()>)
-   |        ^^^^
-note: ...does not necessarily outlive the lifetime `'max` as defined here
-  --> $DIR/variance-use-invariant-struct-1.rs:8:13
-   |
-LL | fn foo<'min,'max>(v: SomeStruct<&'max ()>)
-   |             ^^^^
-
-error[E0308]: mismatched types
-  --> $DIR/variance-use-invariant-struct-1.rs:19:5
-   |
-LL |     v
-   |     ^ lifetime mismatch
-   |
-   = note: expected struct `SomeStruct<&'max ()>`
-              found struct `SomeStruct<&'min ()>`
-note: the lifetime `'min` as defined here...
-  --> $DIR/variance-use-invariant-struct-1.rs:15:8
-   |
-LL | fn bar<'min,'max>(v: SomeStruct<&'min ()>)
-   |        ^^^^
-note: ...does not necessarily outlive the lifetime `'max` as defined here
-  --> $DIR/variance-use-invariant-struct-1.rs:15:13
-   |
-LL | fn bar<'min,'max>(v: SomeStruct<&'min ()>)
-   |             ^^^^
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/wf/wf-static-method.base.stderr b/src/test/ui/wf/wf-static-method.base.stderr
new file mode 100644 (file)
index 0000000..186ab27
--- /dev/null
@@ -0,0 +1,136 @@
+error[E0312]: lifetime of reference outlives lifetime of borrowed content...
+  --> $DIR/wf-static-method.rs:21:9
+   |
+LL |         u
+   |         ^
+   |
+note: ...the reference is valid for the lifetime `'a` as defined here...
+  --> $DIR/wf-static-method.rs:18:6
+   |
+LL | impl<'a, 'b> Foo<'a, 'b, Evil<'a, 'b>> for () {
+   |      ^^
+note: ...but the borrowed content is only valid for the lifetime `'b` as defined here
+  --> $DIR/wf-static-method.rs:18:10
+   |
+LL | impl<'a, 'b> Foo<'a, 'b, Evil<'a, 'b>> for () {
+   |          ^^
+
+error[E0478]: lifetime bound not satisfied
+  --> $DIR/wf-static-method.rs:32:18
+   |
+LL |         let me = Self::make_me();
+   |                  ^^^^
+   |
+note: lifetime parameter instantiated with the lifetime `'b` as defined here
+  --> $DIR/wf-static-method.rs:29:10
+   |
+LL | impl<'a, 'b> Foo<'a, 'b, ()> for IndirectEvil<'a, 'b> {
+   |          ^^
+note: but lifetime parameter must outlive the lifetime `'a` as defined here
+  --> $DIR/wf-static-method.rs:29:6
+   |
+LL | impl<'a, 'b> Foo<'a, 'b, ()> for IndirectEvil<'a, 'b> {
+   |      ^^
+
+error[E0312]: lifetime of reference outlives lifetime of borrowed content...
+  --> $DIR/wf-static-method.rs:41:9
+   |
+LL |         u
+   |         ^
+   |
+note: ...the reference is valid for the lifetime `'a` as defined here...
+  --> $DIR/wf-static-method.rs:39:6
+   |
+LL | impl<'a, 'b> Evil<'a, 'b> {
+   |      ^^
+note: ...but the borrowed content is only valid for the lifetime `'b` as defined here
+  --> $DIR/wf-static-method.rs:39:10
+   |
+LL | impl<'a, 'b> Evil<'a, 'b> {
+   |          ^^
+
+error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'b` due to conflicting requirements
+  --> $DIR/wf-static-method.rs:51:5
+   |
+LL |     <()>::static_evil(b)
+   |     ^^^^^^^^^^^^^^^^^
+   |
+note: first, the lifetime cannot outlive the lifetime `'b` as defined here...
+  --> $DIR/wf-static-method.rs:50:13
+   |
+LL | fn evil<'a, 'b>(b: &'b u32) -> &'a u32 {
+   |             ^^
+note: ...so that reference does not outlive borrowed content
+  --> $DIR/wf-static-method.rs:51:23
+   |
+LL |     <()>::static_evil(b)
+   |                       ^
+note: but, the lifetime must be valid for the lifetime `'a` as defined here...
+  --> $DIR/wf-static-method.rs:50:9
+   |
+LL | fn evil<'a, 'b>(b: &'b u32) -> &'a u32 {
+   |         ^^
+note: ...so that reference does not outlive borrowed content
+  --> $DIR/wf-static-method.rs:51:5
+   |
+LL |     <()>::static_evil(b)
+   |     ^^^^^^^^^^^^^^^^^^^^
+
+error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'b` due to conflicting requirements
+  --> $DIR/wf-static-method.rs:57:5
+   |
+LL |     <IndirectEvil>::static_evil(b)
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+note: first, the lifetime cannot outlive the lifetime `'b` as defined here...
+  --> $DIR/wf-static-method.rs:56:22
+   |
+LL | fn indirect_evil<'a, 'b>(b: &'b u32) -> &'a u32 {
+   |                      ^^
+note: ...so that reference does not outlive borrowed content
+  --> $DIR/wf-static-method.rs:57:33
+   |
+LL |     <IndirectEvil>::static_evil(b)
+   |                                 ^
+note: but, the lifetime must be valid for the lifetime `'a` as defined here...
+  --> $DIR/wf-static-method.rs:56:18
+   |
+LL | fn indirect_evil<'a, 'b>(b: &'b u32) -> &'a u32 {
+   |                  ^^
+note: ...so that reference does not outlive borrowed content
+  --> $DIR/wf-static-method.rs:57:5
+   |
+LL |     <IndirectEvil>::static_evil(b)
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'b` due to conflicting requirements
+  --> $DIR/wf-static-method.rs:63:5
+   |
+LL |     <Evil>::inherent_evil(b)
+   |     ^^^^^^^^^^^^^^^^^^^^^
+   |
+note: first, the lifetime cannot outlive the lifetime `'b` as defined here...
+  --> $DIR/wf-static-method.rs:62:22
+   |
+LL | fn inherent_evil<'a, 'b>(b: &'b u32) -> &'a u32 {
+   |                      ^^
+note: ...so that reference does not outlive borrowed content
+  --> $DIR/wf-static-method.rs:63:27
+   |
+LL |     <Evil>::inherent_evil(b)
+   |                           ^
+note: but, the lifetime must be valid for the lifetime `'a` as defined here...
+  --> $DIR/wf-static-method.rs:62:18
+   |
+LL | fn inherent_evil<'a, 'b>(b: &'b u32) -> &'a u32 {
+   |                  ^^
+note: ...so that reference does not outlive borrowed content
+  --> $DIR/wf-static-method.rs:63:5
+   |
+LL |     <Evil>::inherent_evil(b)
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 6 previous errors
+
+Some errors have detailed explanations: E0312, E0478, E0495.
+For more information about an error, try `rustc --explain E0312`.
index 265043111956a6888f91c03db3bfddbd4fac9324..7556d8e694d5a26ae981bc86956dff4e32719e44 100644 (file)
@@ -1,5 +1,5 @@
 error: lifetime may not live long enough
-  --> $DIR/wf-static-method.rs:17:9
+  --> $DIR/wf-static-method.rs:21:9
    |
 LL | impl<'a, 'b> Foo<'a, 'b, Evil<'a, 'b>> for () {
    |      --  -- lifetime `'b` defined here
@@ -12,7 +12,7 @@ LL |         u
    = help: consider adding the following bound: `'b: 'a`
 
 error: lifetime may not live long enough
-  --> $DIR/wf-static-method.rs:26:18
+  --> $DIR/wf-static-method.rs:32:18
    |
 LL | impl<'a, 'b> Foo<'a, 'b, ()> for IndirectEvil<'a, 'b> {
    |      --  -- lifetime `'b` defined here
@@ -25,7 +25,7 @@ LL |         let me = Self::make_me();
    = help: consider adding the following bound: `'b: 'a`
 
 error: lifetime may not live long enough
-  --> $DIR/wf-static-method.rs:33:9
+  --> $DIR/wf-static-method.rs:41:9
    |
 LL | impl<'a, 'b> Evil<'a, 'b> {
    |      --  -- lifetime `'b` defined here
@@ -38,7 +38,7 @@ LL |         u
    = help: consider adding the following bound: `'b: 'a`
 
 error: lifetime may not live long enough
-  --> $DIR/wf-static-method.rs:41:5
+  --> $DIR/wf-static-method.rs:51:5
    |
 LL | fn evil<'a, 'b>(b: &'b u32) -> &'a u32 {
    |         --  -- lifetime `'b` defined here
@@ -50,7 +50,7 @@ LL |     <()>::static_evil(b)
    = help: consider adding the following bound: `'b: 'a`
 
 error: lifetime may not live long enough
-  --> $DIR/wf-static-method.rs:45:5
+  --> $DIR/wf-static-method.rs:57:5
    |
 LL | fn indirect_evil<'a, 'b>(b: &'b u32) -> &'a u32 {
    |                  --  -- lifetime `'b` defined here
@@ -62,7 +62,7 @@ LL |     <IndirectEvil>::static_evil(b)
    = help: consider adding the following bound: `'b: 'a`
 
 error: lifetime may not live long enough
-  --> $DIR/wf-static-method.rs:50:5
+  --> $DIR/wf-static-method.rs:63:5
    |
 LL | fn inherent_evil<'a, 'b>(b: &'b u32) -> &'a u32 {
    |                  --  -- lifetime `'b` defined here
index 6e805d61265ac18c7a92e9e1f236b0fae36a207b..83557ce667bf6964bee0f7155d75700c107164af 100644 (file)
@@ -4,6 +4,10 @@
 // static inherent methods isn't quite working - need to
 // fix that before removing the check.
 
+// revisions: base nll
+// ignore-compare-mode-nll
+//[nll] compile-flags: -Z borrowck=mir
+
 trait Foo<'a, 'b, T>: Sized {
     fn make_me() -> Self { loop {} }
     fn static_evil(u: &'b u32) -> &'a u32;
@@ -14,7 +18,9 @@ fn make_me() -> Self { loop {} }
 impl<'a, 'b> Foo<'a, 'b, Evil<'a, 'b>> for () {
     fn make_me() -> Self { }
     fn static_evil(u: &'b u32) -> &'a u32 {
-        u //~ ERROR E0312
+        u
+        //[base]~^ ERROR E0312
+        //[nll]~^^ ERROR lifetime may not live long enough
     }
 }
 
@@ -23,14 +29,18 @@ fn static_evil(u: &'b u32) -> &'a u32 {
 impl<'a, 'b> Foo<'a, 'b, ()> for IndirectEvil<'a, 'b> {
     fn make_me() -> Self { IndirectEvil(None) }
     fn static_evil(u: &'b u32) -> &'a u32 {
-        let me = Self::make_me(); //~ ERROR lifetime bound not satisfied
+        let me = Self::make_me();
+        //[base]~^ ERROR lifetime bound not satisfied
+        //[nll]~^^ ERROR lifetime may not live long enough
         loop {} // (`me` could be used for the lifetime transmute).
     }
 }
 
 impl<'a, 'b> Evil<'a, 'b> {
     fn inherent_evil(u: &'b u32) -> &'a u32 {
-        u //~ ERROR E0312
+        u
+        //[base]~^ ERROR E0312
+        //[nll]~^^ ERROR lifetime may not live long enough
     }
 }
 
@@ -38,17 +48,21 @@ fn inherent_evil(u: &'b u32) -> &'a u32 {
 // *check* that they hold.
 
 fn evil<'a, 'b>(b: &'b u32) -> &'a u32 {
-    <()>::static_evil(b) //~ ERROR cannot infer an appropriate lifetime
+    <()>::static_evil(b)
+    //[base]~^ ERROR cannot infer an appropriate lifetime
+    //[nll]~^^ ERROR lifetime may not live long enough
 }
 
 fn indirect_evil<'a, 'b>(b: &'b u32) -> &'a u32 {
     <IndirectEvil>::static_evil(b)
-    //~^ ERROR cannot infer an appropriate lifetime
+    //[base]~^ ERROR cannot infer an appropriate lifetime
+    //[nll]~^^ ERROR lifetime may not live long enough
 }
 
 fn inherent_evil<'a, 'b>(b: &'b u32) -> &'a u32 {
     <Evil>::inherent_evil(b)
-    //~^ ERROR cannot infer an appropriate lifetime
+    //[base]~^ ERROR cannot infer an appropriate lifetime
+    //[nll]~^^ ERROR lifetime may not live long enough
 }
 
 
diff --git a/src/test/ui/wf/wf-static-method.stderr b/src/test/ui/wf/wf-static-method.stderr
deleted file mode 100644 (file)
index c663931..0000000
+++ /dev/null
@@ -1,136 +0,0 @@
-error[E0312]: lifetime of reference outlives lifetime of borrowed content...
-  --> $DIR/wf-static-method.rs:17:9
-   |
-LL |         u
-   |         ^
-   |
-note: ...the reference is valid for the lifetime `'a` as defined here...
-  --> $DIR/wf-static-method.rs:14:6
-   |
-LL | impl<'a, 'b> Foo<'a, 'b, Evil<'a, 'b>> for () {
-   |      ^^
-note: ...but the borrowed content is only valid for the lifetime `'b` as defined here
-  --> $DIR/wf-static-method.rs:14:10
-   |
-LL | impl<'a, 'b> Foo<'a, 'b, Evil<'a, 'b>> for () {
-   |          ^^
-
-error[E0478]: lifetime bound not satisfied
-  --> $DIR/wf-static-method.rs:26:18
-   |
-LL |         let me = Self::make_me();
-   |                  ^^^^
-   |
-note: lifetime parameter instantiated with the lifetime `'b` as defined here
-  --> $DIR/wf-static-method.rs:23:10
-   |
-LL | impl<'a, 'b> Foo<'a, 'b, ()> for IndirectEvil<'a, 'b> {
-   |          ^^
-note: but lifetime parameter must outlive the lifetime `'a` as defined here
-  --> $DIR/wf-static-method.rs:23:6
-   |
-LL | impl<'a, 'b> Foo<'a, 'b, ()> for IndirectEvil<'a, 'b> {
-   |      ^^
-
-error[E0312]: lifetime of reference outlives lifetime of borrowed content...
-  --> $DIR/wf-static-method.rs:33:9
-   |
-LL |         u
-   |         ^
-   |
-note: ...the reference is valid for the lifetime `'a` as defined here...
-  --> $DIR/wf-static-method.rs:31:6
-   |
-LL | impl<'a, 'b> Evil<'a, 'b> {
-   |      ^^
-note: ...but the borrowed content is only valid for the lifetime `'b` as defined here
-  --> $DIR/wf-static-method.rs:31:10
-   |
-LL | impl<'a, 'b> Evil<'a, 'b> {
-   |          ^^
-
-error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'b` due to conflicting requirements
-  --> $DIR/wf-static-method.rs:41:5
-   |
-LL |     <()>::static_evil(b)
-   |     ^^^^^^^^^^^^^^^^^
-   |
-note: first, the lifetime cannot outlive the lifetime `'b` as defined here...
-  --> $DIR/wf-static-method.rs:40:13
-   |
-LL | fn evil<'a, 'b>(b: &'b u32) -> &'a u32 {
-   |             ^^
-note: ...so that reference does not outlive borrowed content
-  --> $DIR/wf-static-method.rs:41:23
-   |
-LL |     <()>::static_evil(b)
-   |                       ^
-note: but, the lifetime must be valid for the lifetime `'a` as defined here...
-  --> $DIR/wf-static-method.rs:40:9
-   |
-LL | fn evil<'a, 'b>(b: &'b u32) -> &'a u32 {
-   |         ^^
-note: ...so that reference does not outlive borrowed content
-  --> $DIR/wf-static-method.rs:41:5
-   |
-LL |     <()>::static_evil(b)
-   |     ^^^^^^^^^^^^^^^^^^^^
-
-error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'b` due to conflicting requirements
-  --> $DIR/wf-static-method.rs:45:5
-   |
-LL |     <IndirectEvil>::static_evil(b)
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-note: first, the lifetime cannot outlive the lifetime `'b` as defined here...
-  --> $DIR/wf-static-method.rs:44:22
-   |
-LL | fn indirect_evil<'a, 'b>(b: &'b u32) -> &'a u32 {
-   |                      ^^
-note: ...so that reference does not outlive borrowed content
-  --> $DIR/wf-static-method.rs:45:33
-   |
-LL |     <IndirectEvil>::static_evil(b)
-   |                                 ^
-note: but, the lifetime must be valid for the lifetime `'a` as defined here...
-  --> $DIR/wf-static-method.rs:44:18
-   |
-LL | fn indirect_evil<'a, 'b>(b: &'b u32) -> &'a u32 {
-   |                  ^^
-note: ...so that reference does not outlive borrowed content
-  --> $DIR/wf-static-method.rs:45:5
-   |
-LL |     <IndirectEvil>::static_evil(b)
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'b` due to conflicting requirements
-  --> $DIR/wf-static-method.rs:50:5
-   |
-LL |     <Evil>::inherent_evil(b)
-   |     ^^^^^^^^^^^^^^^^^^^^^
-   |
-note: first, the lifetime cannot outlive the lifetime `'b` as defined here...
-  --> $DIR/wf-static-method.rs:49:22
-   |
-LL | fn inherent_evil<'a, 'b>(b: &'b u32) -> &'a u32 {
-   |                      ^^
-note: ...so that reference does not outlive borrowed content
-  --> $DIR/wf-static-method.rs:50:27
-   |
-LL |     <Evil>::inherent_evil(b)
-   |                           ^
-note: but, the lifetime must be valid for the lifetime `'a` as defined here...
-  --> $DIR/wf-static-method.rs:49:18
-   |
-LL | fn inherent_evil<'a, 'b>(b: &'b u32) -> &'a u32 {
-   |                  ^^
-note: ...so that reference does not outlive borrowed content
-  --> $DIR/wf-static-method.rs:50:5
-   |
-LL |     <Evil>::inherent_evil(b)
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^
-
-error: aborting due to 6 previous errors
-
-Some errors have detailed explanations: E0312, E0478, E0495.
-For more information about an error, try `rustc --explain E0312`.
diff --git a/src/test/ui/where-clauses/where-for-self-2.base.stderr b/src/test/ui/where-clauses/where-for-self-2.base.stderr
new file mode 100644 (file)
index 0000000..c09610c
--- /dev/null
@@ -0,0 +1,11 @@
+error: implementation of `Bar` is not general enough
+  --> $DIR/where-for-self-2.rs:27:5
+   |
+LL |     foo(&X);
+   |     ^^^ implementation of `Bar` is not general enough
+   |
+   = note: `&'0 u32` must implement `Bar`, for any lifetime `'0`...
+   = note: ...but `Bar` is actually implemented for the type `&'static u32`
+
+error: aborting due to previous error
+
index f65db78fc8993b55753ab7bfdd463e57c014d20b..92d1b2121a6b254c90a535efdf8cecc269deaeed 100644 (file)
@@ -1,5 +1,5 @@
 error: implementation of `Bar` is not general enough
-  --> $DIR/where-for-self-2.rs:23:5
+  --> $DIR/where-for-self-2.rs:27:5
    |
 LL |     foo(&X);
    |     ^^^^^^^ implementation of `Bar` is not general enough
index 37c6954fd52ee1d49c4fe7b46d2f934ab2786eb1..4e4e0ec912ea1f43f350011d97093c7a16daa58c 100644 (file)
@@ -3,6 +3,10 @@
 // specific lifetime is not enough to satisfy the `for<'a> ...` constraint, which
 // should require *all* lifetimes.
 
+// revisions: base nll
+// ignore-compare-mode-nll
+//[nll] compile-flags: -Z borrowck=mir
+
 static X: &'static u32 = &42;
 
 trait Bar {
diff --git a/src/test/ui/where-clauses/where-for-self-2.stderr b/src/test/ui/where-clauses/where-for-self-2.stderr
deleted file mode 100644 (file)
index 6da46e2..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-error: implementation of `Bar` is not general enough
-  --> $DIR/where-for-self-2.rs:23:5
-   |
-LL |     foo(&X);
-   |     ^^^ implementation of `Bar` is not general enough
-   |
-   = note: `&'0 u32` must implement `Bar`, for any lifetime `'0`...
-   = note: ...but `Bar` is actually implemented for the type `&'static u32`
-
-error: aborting due to previous error
-