Updated new UI tests to pass with NLL compare-mode

These tests need a review to ensure that those marked as
ignore-compare-mode-nll should be ignored and that this isn't a bug in NLL.
This commit is contained in:
David Wood 2018-08-08 18:01:04 +02:00
parent b16a30677f
commit 3e0a407988
No known key found for this signature in database
GPG Key ID: 01760B4F9F53F154
98 changed files with 273 additions and 175 deletions

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// ignore-compare-mode-nll
#![allow(unused_variables)]
trait Trait<'a> {

View File

@ -1,5 +1,5 @@
error[E0623]: lifetime mismatch
--> $DIR/associated-types-subtyping-1.rs:34:37
--> $DIR/associated-types-subtyping-1.rs:36:37
|
LL | fn method2<'a,'b,T>(x: &'a T, y: &'b T)
| ----- ----- these two types are declared with different lifetimes...
@ -8,7 +8,7 @@ LL | let _: <T as Trait<'b>>::Type = a; //~ ERROR E0623
| ^ ...but data from `y` flows into `x` here
error[E0623]: lifetime mismatch
--> $DIR/associated-types-subtyping-1.rs:43:37
--> $DIR/associated-types-subtyping-1.rs:45:37
|
LL | fn method3<'a,'b,T>(x: &'a T, y: &'b T)
| ----- ----- these two types are declared with different lifetimes...

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// ignore-compare-mode-nll
#![feature(box_syntax)]
struct Foo(Box<isize>, isize);

View File

@ -1,5 +1,5 @@
error[E0505]: cannot move out of `x` because it is borrowed
--> $DIR/borrow-tuple-fields.rs:20:9
--> $DIR/borrow-tuple-fields.rs:22:9
|
LL | let r = &x.0;
| --- borrow of `x.0` occurs here
@ -7,7 +7,7 @@ LL | let y = x; //~ ERROR cannot move out of `x` because it is borrowed
| ^ move out of `x` occurs here
error[E0502]: cannot borrow `x.0` as mutable because it is also borrowed as immutable
--> $DIR/borrow-tuple-fields.rs:24:18
--> $DIR/borrow-tuple-fields.rs:26:18
|
LL | let a = &x.0;
| --- immutable borrow occurs here
@ -18,7 +18,7 @@ LL | }
| - immutable borrow ends here
error[E0499]: cannot borrow `x.0` as mutable more than once at a time
--> $DIR/borrow-tuple-fields.rs:28:18
--> $DIR/borrow-tuple-fields.rs:30:18
|
LL | let a = &mut x.0;
| --- first mutable borrow occurs here
@ -29,7 +29,7 @@ LL | }
| - first borrow ends here
error[E0505]: cannot move out of `x` because it is borrowed
--> $DIR/borrow-tuple-fields.rs:33:9
--> $DIR/borrow-tuple-fields.rs:35:9
|
LL | let r = &x.0;
| --- borrow of `x.0` occurs here
@ -37,7 +37,7 @@ LL | let y = x; //~ ERROR cannot move out of `x` because it is borrowed
| ^ move out of `x` occurs here
error[E0502]: cannot borrow `x.0` as mutable because it is also borrowed as immutable
--> $DIR/borrow-tuple-fields.rs:37:18
--> $DIR/borrow-tuple-fields.rs:39:18
|
LL | let a = &x.0;
| --- immutable borrow occurs here
@ -48,7 +48,7 @@ LL | }
| - immutable borrow ends here
error[E0499]: cannot borrow `x.0` as mutable more than once at a time
--> $DIR/borrow-tuple-fields.rs:41:18
--> $DIR/borrow-tuple-fields.rs:43:18
|
LL | let a = &mut x.0;
| --- first mutable borrow occurs here

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// ignore-compare-mode-nll
// Check that `&mut` objects cannot be borrowed twice, just like
// other `&mut` pointers.

View File

@ -1,5 +1,5 @@
error[E0499]: cannot borrow `*x` as mutable more than once at a time
--> $DIR/borrowck-borrow-mut-object-twice.rs:21:5
--> $DIR/borrowck-borrow-mut-object-twice.rs:23:5
|
LL | let _y = x.f1();
| - first mutable borrow occurs here

View File

@ -12,6 +12,8 @@
// access to the variable, whether that mutable access be used
// for direct assignment or for taking mutable ref. Issue #6801.
// ignore-compare-mode-nll
#![feature(box_syntax)]
fn to_fn_mut<F: FnMut()>(f: F) -> F { f }

View File

@ -1,5 +1,5 @@
error[E0499]: cannot borrow `x` as mutable more than once at a time
--> $DIR/borrowck-closures-two-mut.rs:22:24
--> $DIR/borrowck-closures-two-mut.rs:24:24
|
LL | let c1 = to_fn_mut(|| x = 4);
| -- - previous borrow occurs due to use of `x` in closure
@ -13,7 +13,7 @@ LL | }
| - first borrow ends here
error[E0499]: cannot borrow `x` as mutable more than once at a time
--> $DIR/borrowck-closures-two-mut.rs:32:24
--> $DIR/borrowck-closures-two-mut.rs:34:24
|
LL | let c1 = to_fn_mut(|| set(&mut x));
| -- - previous borrow occurs due to use of `x` in closure
@ -27,7 +27,7 @@ LL | }
| - first borrow ends here
error[E0499]: cannot borrow `x` as mutable more than once at a time
--> $DIR/borrowck-closures-two-mut.rs:38:24
--> $DIR/borrowck-closures-two-mut.rs:40:24
|
LL | let c1 = to_fn_mut(|| x = 5);
| -- - previous borrow occurs due to use of `x` in closure
@ -41,7 +41,7 @@ LL | }
| - first borrow ends here
error[E0499]: cannot borrow `x` as mutable more than once at a time
--> $DIR/borrowck-closures-two-mut.rs:44:24
--> $DIR/borrowck-closures-two-mut.rs:46:24
|
LL | let c1 = to_fn_mut(|| x = 5);
| -- - previous borrow occurs due to use of `x` in closure
@ -56,7 +56,7 @@ LL | }
| - first borrow ends here
error[E0499]: cannot borrow `x` as mutable more than once at a time
--> $DIR/borrowck-closures-two-mut.rs:55:24
--> $DIR/borrowck-closures-two-mut.rs:57:24
|
LL | let c1 = to_fn_mut(|| set(&mut *x.f));
| -- - previous borrow occurs due to use of `x` in closure

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// ignore-compare-mode-nll
struct Foo {
x: isize,
}

View File

@ -1,5 +1,5 @@
error[E0502]: cannot borrow `this.x` as mutable because it is also borrowed as immutable
--> $DIR/borrowck-closures-unique-imm.rs:21:14
--> $DIR/borrowck-closures-unique-imm.rs:23:14
|
LL | let p = &this.x;
| ------ immutable borrow occurs here

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// ignore-compare-mode-nll
// Tests that a closure which requires mutable access to the referent
// of an `&mut` requires a "unique" borrow -- that is, the variable to
// be borrowed (here, `x`) will not be borrowed *mutably*, but

View File

@ -1,5 +1,5 @@
error[E0500]: closure requires unique access to `x` but it is already borrowed
--> $DIR/borrowck-closures-unique.rs:32:14
--> $DIR/borrowck-closures-unique.rs:34:14
|
LL | let c1 = || get(x);
| -- - previous borrow occurs due to use of `x` in closure
@ -13,7 +13,7 @@ LL | }
| - borrow ends here
error[E0500]: closure requires unique access to `x` but it is already borrowed
--> $DIR/borrowck-closures-unique.rs:37:14
--> $DIR/borrowck-closures-unique.rs:39:14
|
LL | let c1 = || get(x);
| -- - previous borrow occurs due to use of `x` in closure
@ -27,7 +27,7 @@ LL | }
| - borrow ends here
error[E0524]: two closures require unique access to `x` at the same time
--> $DIR/borrowck-closures-unique.rs:42:14
--> $DIR/borrowck-closures-unique.rs:44:14
|
LL | let c1 = || set(x);
| -- - previous borrow occurs due to use of `x` in closure
@ -41,7 +41,7 @@ LL | }
| - borrow from first closure ends here
error[E0595]: closure cannot assign to immutable argument `x`
--> $DIR/borrowck-closures-unique.rs:46:14
--> $DIR/borrowck-closures-unique.rs:48:14
|
LL | let c1 = || x = panic!(); //~ ERROR closure cannot assign to immutable argument
| ^^ cannot borrow mutably

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// ignore-compare-mode-nll
#![feature(box_syntax)]
fn main() {

View File

@ -1,5 +1,5 @@
error[E0505]: cannot move out of `x` because it is borrowed
--> $DIR/borrowck-issue-2657-1.rs:17:13
--> $DIR/borrowck-issue-2657-1.rs:19:13
|
LL | Some(ref _y) => {
| ------ borrow of `x.0` occurs here

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// ignore-compare-mode-nll
// Note: the borrowck analysis is currently flow-insensitive.
// Therefore, some of these errors are marked as spurious and could be
// corrected by a simple change to the analysis. The others are

View File

@ -1,5 +1,5 @@
error[E0502]: cannot borrow `*v` as mutable because `v` is also borrowed as immutable
--> $DIR/borrowck-lend-flow-if.rs:38:21
--> $DIR/borrowck-lend-flow-if.rs:40:21
|
LL | _w = &v;
| - immutable borrow occurs here

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// ignore-compare-mode-nll
// Note: the borrowck analysis is currently flow-insensitive.
// Therefore, some of these errors are marked as spurious and could be
// corrected by a simple change to the analysis. The others are

View File

@ -1,5 +1,5 @@
error[E0502]: cannot borrow `*v` as mutable because `v` is also borrowed as immutable
--> $DIR/borrowck-lend-flow.rs:34:21
--> $DIR/borrowck-lend-flow.rs:36:21
|
LL | let _w = &v;
| - immutable borrow occurs here

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// ignore-compare-mode-nll
#![feature(box_syntax)]
use std::thread;

View File

@ -1,5 +1,5 @@
error[E0504]: cannot move `v` into closure because it is borrowed
--> $DIR/borrowck-loan-blocks-move-cc.rs:23:27
--> $DIR/borrowck-loan-blocks-move-cc.rs:25:27
|
LL | let _w = &v;
| - borrow of `v` occurs here
@ -8,7 +8,7 @@ LL | println!("v={}", *v);
| ^ move into closure occurs here
error[E0504]: cannot move `v` into closure because it is borrowed
--> $DIR/borrowck-loan-blocks-move-cc.rs:32:27
--> $DIR/borrowck-loan-blocks-move-cc.rs:34:27
|
LL | let _w = &v;
| - borrow of `v` occurs here

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// ignore-compare-mode-nll
#![feature(box_syntax)]
fn take(_v: Box<isize>) {

View File

@ -1,5 +1,5 @@
error[E0505]: cannot move out of `v` because it is borrowed
--> $DIR/borrowck-loan-blocks-move.rs:19:10
--> $DIR/borrowck-loan-blocks-move.rs:21:10
|
LL | let _w = &v;
| - borrow of `v` occurs here

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// ignore-compare-mode-nll
// verify that an error is raised when trying to move out of a
// borrowed path.

View File

@ -1,5 +1,5 @@
error[E0505]: cannot move out of `*a` because it is borrowed
--> $DIR/borrowck-move-from-subpath-of-borrowed-path.rs:20:9
--> $DIR/borrowck-move-from-subpath-of-borrowed-path.rs:22:9
|
LL | let b = &a;
| - borrow of `a` occurs here

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// ignore-compare-mode-nll
// Test that attempt to move `&mut` pointer while pointee is borrowed
// yields an error.
//

View File

@ -1,5 +1,5 @@
error[E0505]: cannot move out of `t0` because it is borrowed
--> $DIR/borrowck-move-mut-base-ptr.rs:18:9
--> $DIR/borrowck-move-mut-base-ptr.rs:20:9
|
LL | let p: &isize = &*t0; // Freezes `*t0`
| --- borrow of `*t0` occurs here

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// ignore-compare-mode-nll
// Test that attempt to mutably borrow `&mut` pointer while pointee is
// borrowed yields an error.
//

View File

@ -1,5 +1,5 @@
error[E0502]: cannot borrow `t0` as mutable because `*t0` is also borrowed as immutable
--> $DIR/borrowck-mut-borrow-of-mut-base-ptr.rs:19:23
--> $DIR/borrowck-mut-borrow-of-mut-base-ptr.rs:21:23
|
LL | let p: &isize = &*t0; // Freezes `*t0`
| --- immutable borrow occurs here
@ -10,7 +10,7 @@ LL | }
| - immutable borrow ends here
error[E0499]: cannot borrow `t0` as mutable more than once at a time
--> $DIR/borrowck-mut-borrow-of-mut-base-ptr.rs:26:23
--> $DIR/borrowck-mut-borrow-of-mut-base-ptr.rs:28:23
|
LL | let p: &mut isize = &mut *t0; // Claims `*t0`
| --- first mutable borrow occurs here

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// ignore-compare-mode-nll
// Test that borrows that occur due to calls to object methods
// properly "claim" the object path.

View File

@ -1,5 +1,5 @@
error[E0502]: cannot borrow `*x` as mutable because it is also borrowed as immutable
--> $DIR/borrowck-object-lifetime.rs:26:14
--> $DIR/borrowck-object-lifetime.rs:28:14
|
LL | let _y = x.borrowed();
| - immutable borrow occurs here
@ -9,7 +9,7 @@ LL | }
| - immutable borrow ends here
error[E0502]: cannot borrow `x` as mutable because `*x` is also borrowed as immutable
--> $DIR/borrowck-object-lifetime.rs:31:19
--> $DIR/borrowck-object-lifetime.rs:33:19
|
LL | let _y = x.borrowed();
| - immutable borrow occurs here

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// ignore-compare-mode-nll
// Test that we still see borrowck errors of various kinds when using
// indexing and autoderef in combination.

View File

@ -1,5 +1,5 @@
error[E0502]: cannot borrow `*f` as immutable because it is also borrowed as mutable
--> $DIR/borrowck-overloaded-index-autoderef.rs:45:15
--> $DIR/borrowck-overloaded-index-autoderef.rs:47:15
|
LL | let _p = &mut f[&s];
| - mutable borrow occurs here
@ -9,7 +9,7 @@ LL | }
| - mutable borrow ends here
error[E0499]: cannot borrow `*f` as mutable more than once at a time
--> $DIR/borrowck-overloaded-index-autoderef.rs:50:19
--> $DIR/borrowck-overloaded-index-autoderef.rs:52:19
|
LL | let _p = &mut f[&s];
| - first mutable borrow occurs here
@ -19,7 +19,7 @@ LL | }
| - first borrow ends here
error[E0499]: cannot borrow `f.foo` as mutable more than once at a time
--> $DIR/borrowck-overloaded-index-autoderef.rs:59:19
--> $DIR/borrowck-overloaded-index-autoderef.rs:61:19
|
LL | let _p = &mut f.foo[&s];
| ----- first mutable borrow occurs here
@ -29,7 +29,7 @@ LL | }
| - first borrow ends here
error[E0502]: cannot borrow `f.foo` as mutable because it is also borrowed as immutable
--> $DIR/borrowck-overloaded-index-autoderef.rs:69:19
--> $DIR/borrowck-overloaded-index-autoderef.rs:71:19
|
LL | let _p = &f.foo[&s];
| ----- immutable borrow occurs here
@ -39,7 +39,7 @@ LL | }
| - immutable borrow ends here
error[E0506]: cannot assign to `f.foo` because it is borrowed
--> $DIR/borrowck-overloaded-index-autoderef.rs:74:5
--> $DIR/borrowck-overloaded-index-autoderef.rs:76:5
|
LL | let _p = &f.foo[&s];
| ----- borrow of `f.foo` occurs here
@ -47,7 +47,7 @@ LL | f.foo = g; //~ ERROR cannot assign
| ^^^^^^^^^ assignment to borrowed `f.foo` occurs here
error[E0506]: cannot assign to `*f` because it is borrowed
--> $DIR/borrowck-overloaded-index-autoderef.rs:79:5
--> $DIR/borrowck-overloaded-index-autoderef.rs:81:5
|
LL | let _p = &f.foo[&s];
| ----- borrow of `*f` occurs here
@ -55,7 +55,7 @@ LL | *f = g; //~ ERROR cannot assign
| ^^^^^^ assignment to borrowed `*f` occurs here
error[E0506]: cannot assign to `f.foo` because it is borrowed
--> $DIR/borrowck-overloaded-index-autoderef.rs:84:5
--> $DIR/borrowck-overloaded-index-autoderef.rs:86:5
|
LL | let _p = &mut f.foo[&s];
| ----- borrow of `f.foo` occurs here
@ -63,7 +63,7 @@ LL | f.foo = g; //~ ERROR cannot assign
| ^^^^^^^^^ assignment to borrowed `f.foo` occurs here
error[E0506]: cannot assign to `*f` because it is borrowed
--> $DIR/borrowck-overloaded-index-autoderef.rs:89:5
--> $DIR/borrowck-overloaded-index-autoderef.rs:91:5
|
LL | let _p = &mut f.foo[&s];
| ----- borrow of `*f` occurs here

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// ignore-compare-mode-nll
// Test that attempt to swap `&mut` pointer while pointee is borrowed
// yields an error.
//

View File

@ -1,5 +1,5 @@
error[E0502]: cannot borrow `t0` as mutable because `*t0` is also borrowed as immutable
--> $DIR/borrowck-swap-mut-base-ptr.rs:21:15
--> $DIR/borrowck-swap-mut-base-ptr.rs:23:15
|
LL | let p: &isize = &*t0; // Freezes `*t0`
| --- immutable borrow occurs here

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// ignore-compare-mode-nll
#[derive(Clone, Copy)]
struct S {
a: u8,

View File

@ -1,5 +1,5 @@
error[E0503]: cannot use `u.c` because it was mutably borrowed
--> $DIR/borrowck-union-borrow-nested.rs:33:17
--> $DIR/borrowck-union-borrow-nested.rs:35:17
|
LL | let ra = &mut u.s.a;
| ----- borrow of `u.s.a` occurs here

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// ignore-compare-mode-nll
#![feature(box_syntax)]
fn borrow(_v: &isize) {}

View File

@ -1,5 +1,5 @@
error[E0502]: cannot borrow `*v` as immutable because `v` is also borrowed as mutable
--> $DIR/borrowck-uniq-via-lend.rs:43:13
--> $DIR/borrowck-uniq-via-lend.rs:45:13
|
LL | let _w = &mut v;
| - mutable borrow occurs here
@ -9,7 +9,7 @@ LL | }
| - mutable borrow ends here
error[E0502]: cannot borrow `*v` as immutable because `v` is also borrowed as mutable
--> $DIR/borrowck-uniq-via-lend.rs:58:13
--> $DIR/borrowck-uniq-via-lend.rs:60:13
|
LL | _x = &mut v;
| - mutable borrow occurs here

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// ignore-compare-mode-nll
// Test that the borrow checker prevents pointers to temporaries
// with statement lifetimes from escaping.

View File

@ -1,5 +1,5 @@
error[E0597]: borrowed value does not live long enough
--> $DIR/cleanup-rvalue-scopes-cf.rs:36:19
--> $DIR/cleanup-rvalue-scopes-cf.rs:38:19
|
LL | let _x = arg(&AddFlags(1)); //~ ERROR value does not live long enough
| ^^^^^^^^^^^ - temporary value dropped here while still borrowed
@ -12,7 +12,7 @@ LL | }
= note: consider using a `let` binding to increase its lifetime
error[E0597]: borrowed value does not live long enough
--> $DIR/cleanup-rvalue-scopes-cf.rs:37:14
--> $DIR/cleanup-rvalue-scopes-cf.rs:39:14
|
LL | let _x = AddFlags(1).get(); //~ ERROR value does not live long enough
| ^^^^^^^^^^^ - temporary value dropped here while still borrowed
@ -25,7 +25,7 @@ LL | }
= note: consider using a `let` binding to increase its lifetime
error[E0597]: borrowed value does not live long enough
--> $DIR/cleanup-rvalue-scopes-cf.rs:38:21
--> $DIR/cleanup-rvalue-scopes-cf.rs:40:21
|
LL | let _x = &*arg(&AddFlags(1)); //~ ERROR value does not live long enough
| ^^^^^^^^^^^ - temporary value dropped here while still borrowed
@ -38,7 +38,7 @@ LL | }
= note: consider using a `let` binding to increase its lifetime
error[E0597]: borrowed value does not live long enough
--> $DIR/cleanup-rvalue-scopes-cf.rs:39:24
--> $DIR/cleanup-rvalue-scopes-cf.rs:41:24
|
LL | let ref _x = *arg(&AddFlags(1)); //~ ERROR value does not live long enough
| ^^^^^^^^^^^ - temporary value dropped here while still borrowed
@ -51,7 +51,7 @@ LL | }
= note: consider using a `let` binding to increase its lifetime
error[E0597]: borrowed value does not live long enough
--> $DIR/cleanup-rvalue-scopes-cf.rs:40:24
--> $DIR/cleanup-rvalue-scopes-cf.rs:42:24
|
LL | let &ref _x = arg(&AddFlags(1)); //~ ERROR value does not live long enough
| ^^^^^^^^^^^ - temporary value dropped here while still borrowed
@ -64,7 +64,7 @@ LL | }
= note: consider using a `let` binding to increase its lifetime
error[E0597]: borrowed value does not live long enough
--> $DIR/cleanup-rvalue-scopes-cf.rs:41:14
--> $DIR/cleanup-rvalue-scopes-cf.rs:43:14
|
LL | let _x = AddFlags(1).get(); //~ ERROR value does not live long enough
| ^^^^^^^^^^^ - temporary value dropped here while still borrowed
@ -77,7 +77,7 @@ LL | }
= note: consider using a `let` binding to increase its lifetime
error[E0597]: borrowed value does not live long enough
--> $DIR/cleanup-rvalue-scopes-cf.rs:42:34
--> $DIR/cleanup-rvalue-scopes-cf.rs:44:34
|
LL | let Box { f: _x } = Box { f: AddFlags(1).get() }; //~ ERROR value does not live long enough
| ^^^^^^^^^^^ - temporary value dropped here while still borrowed

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// ignore-compare-mode-nll
#![allow(const_err)]
// nll successfully compiles this. It is a bug.

View File

@ -1,5 +1,5 @@
error[E0597]: borrowed value does not live long enough
--> $DIR/closure_promotion.rs:16:26
--> $DIR/closure_promotion.rs:18:26
|
LL | let x: &'static _ = &|| { let z = 3; z }; //~ ERROR does not live long enough
| ^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// ignore-compare-mode-nll
fn main() {
let mut my_stuff = std::collections::HashMap::new();
my_stuff.insert(0, 42);

View File

@ -1,5 +1,5 @@
error[E0502]: cannot borrow `my_stuff` as mutable because it is also borrowed as immutable
--> $DIR/hashmap-lifetimes.rs:16:5
--> $DIR/hashmap-lifetimes.rs:18:5
|
LL | let mut it = my_stuff.iter();
| -------- immutable borrow occurs here

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// ignore-compare-mode-nll
struct Foo<'a, 'b: 'a>(&'a &'b ());
impl<'a, 'b> Foo<'a, 'b> {

View File

@ -1,16 +1,16 @@
error[E0478]: lifetime bound not satisfied
--> $DIR/issue-28848.rs:20:5
--> $DIR/issue-28848.rs:22:5
|
LL | Foo::<'a, 'b>::xmute(u) //~ ERROR lifetime bound not satisfied
| ^^^^^^^^^^^^^^^^^^^^
|
note: lifetime parameter instantiated with the lifetime 'b as defined on the function body at 19:16
--> $DIR/issue-28848.rs:19:16
note: lifetime parameter instantiated with the lifetime 'b as defined on the function body at 21:16
--> $DIR/issue-28848.rs:21:16
|
LL | pub fn foo<'a, 'b>(u: &'b ()) -> &'a () {
| ^^
note: but lifetime parameter must outlive the lifetime 'a as defined on the function body at 19:12
--> $DIR/issue-28848.rs:19:12
note: but lifetime parameter must outlive the lifetime 'a as defined on the function body at 21:12
--> $DIR/issue-28848.rs:21:12
|
LL | pub fn foo<'a, 'b>(u: &'b ()) -> &'a () {
| ^^

View File

@ -1,5 +1,5 @@
error[E0308]: mismatched types
--> $DIR/meta-expected-error-wrong-rev.rs:21:18
--> $DIR/meta-expected-error-wrong-rev.rs:23:18
|
LL | let x: u32 = 22_usize; //[b]~ ERROR mismatched types
| ^^^^^^^^ expected u32, found usize

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// ignore-compare-mode-nll
// revisions: a
// should-fail

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// ignore-compare-mode-nll
// Test method calls with self as an argument cannot subvert borrow checking.
struct Foo;

View File

@ -1,5 +1,5 @@
error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable
--> $DIR/method-self-arg-2.rs:23:15
--> $DIR/method-self-arg-2.rs:25:15
|
LL | let y = &mut x;
| - mutable borrow occurs here
@ -10,7 +10,7 @@ LL | }
| - mutable borrow ends here
error[E0499]: cannot borrow `x` as mutable more than once at a time
--> $DIR/method-self-arg-2.rs:27:19
--> $DIR/method-self-arg-2.rs:29:19
|
LL | let y = &mut x;
| - first mutable borrow occurs here

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// ignore-compare-mode-nll
use std::cell::RefCell;
fn main() {

View File

@ -1,5 +1,5 @@
error[E0499]: cannot borrow `b` as mutable more than once at a time
--> $DIR/mut-cant-alias.rs:17:20
--> $DIR/mut-cant-alias.rs:19:20
|
LL | let b1 = &mut *b;
| - first mutable borrow occurs here

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// ignore-compare-mode-nll
// Test that we are imposing the requirement that every associated
// type of a bound that appears in the where clause on a struct must
// outlive the location in which the type appears, even when the

View File

@ -1,16 +1,16 @@
error[E0491]: in type `&'a WithAssoc<TheType<'b>>`, reference has a longer lifetime than the data it references
--> $DIR/regions-assoc-type-in-supertrait-outlives-container.rs:50:12
--> $DIR/regions-assoc-type-in-supertrait-outlives-container.rs:52:12
|
LL | let _: &'a WithAssoc<TheType<'b>> = loop { }; //~ ERROR reference has a longer lifetime
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: the pointer is valid for the lifetime 'a as defined on the function body at 44:15
--> $DIR/regions-assoc-type-in-supertrait-outlives-container.rs:44:15
note: the pointer is valid for the lifetime 'a as defined on the function body at 46:15
--> $DIR/regions-assoc-type-in-supertrait-outlives-container.rs:46:15
|
LL | fn with_assoc<'a,'b>() {
| ^^
note: but the referenced data is only valid for the lifetime 'b as defined on the function body at 44:18
--> $DIR/regions-assoc-type-in-supertrait-outlives-container.rs:44:18
note: but the referenced data is only valid for the lifetime 'b as defined on the function body at 46:18
--> $DIR/regions-assoc-type-in-supertrait-outlives-container.rs:46:18
|
LL | fn with_assoc<'a,'b>() {
| ^^

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// ignore-compare-mode-nll
// Test which of the builtin types are considered sendable. The tests
// in this file all test region bound and lifetime violations that are
// detected during type check.

View File

@ -1,5 +1,5 @@
error[E0477]: the type `&'a isize` does not fulfill the required lifetime
--> $DIR/regions-bounded-by-trait-requiring-static.rs:32:5
--> $DIR/regions-bounded-by-trait-requiring-static.rs:34:5
|
LL | assert_send::<&'a isize>(); //~ ERROR does not fulfill the required lifetime
| ^^^^^^^^^^^^^^^^^^^^^^^^
@ -7,7 +7,7 @@ LL | assert_send::<&'a isize>(); //~ ERROR does not fulfill the required lif
= note: type must satisfy the static lifetime
error[E0477]: the type `&'a str` does not fulfill the required lifetime
--> $DIR/regions-bounded-by-trait-requiring-static.rs:36:5
--> $DIR/regions-bounded-by-trait-requiring-static.rs:38:5
|
LL | assert_send::<&'a str>(); //~ ERROR does not fulfill the required lifetime
| ^^^^^^^^^^^^^^^^^^^^^^
@ -15,7 +15,7 @@ LL | assert_send::<&'a str>(); //~ ERROR does not fulfill the required lifet
= note: type must satisfy the static lifetime
error[E0477]: the type `&'a [isize]` does not fulfill the required lifetime
--> $DIR/regions-bounded-by-trait-requiring-static.rs:40:5
--> $DIR/regions-bounded-by-trait-requiring-static.rs:42:5
|
LL | assert_send::<&'a [isize]>(); //~ ERROR does not fulfill the required lifetime
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -23,7 +23,7 @@ LL | assert_send::<&'a [isize]>(); //~ ERROR does not fulfill the required l
= note: type must satisfy the static lifetime
error[E0477]: the type `std::boxed::Box<&'a isize>` does not fulfill the required lifetime
--> $DIR/regions-bounded-by-trait-requiring-static.rs:54:5
--> $DIR/regions-bounded-by-trait-requiring-static.rs:56:5
|
LL | assert_send::<Box<&'a isize>>(); //~ ERROR does not fulfill the required lifetime
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -31,7 +31,7 @@ LL | assert_send::<Box<&'a isize>>(); //~ ERROR does not fulfill the require
= note: type must satisfy the static lifetime
error[E0477]: the type `*const &'a isize` does not fulfill the required lifetime
--> $DIR/regions-bounded-by-trait-requiring-static.rs:65:5
--> $DIR/regions-bounded-by-trait-requiring-static.rs:67:5
|
LL | assert_send::<*const &'a isize>(); //~ ERROR does not fulfill the required lifetime
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -39,7 +39,7 @@ LL | assert_send::<*const &'a isize>(); //~ ERROR does not fulfill the requi
= note: type must satisfy the static lifetime
error[E0477]: the type `*mut &'a isize` does not fulfill the required lifetime
--> $DIR/regions-bounded-by-trait-requiring-static.rs:69:5
--> $DIR/regions-bounded-by-trait-requiring-static.rs:71:5
|
LL | assert_send::<*mut &'a isize>(); //~ ERROR does not fulfill the required lifetime
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// ignore-compare-mode-nll
// Check that explicit region bounds are allowed on the various
// nominal types (but not on other types) and that they are type
// checked.

View File

@ -1,5 +1,5 @@
error[E0477]: the type `&'a isize` does not fulfill the required lifetime
--> $DIR/regions-bounded-method-type-parameters.rs:22:9
--> $DIR/regions-bounded-method-type-parameters.rs:24:9
|
LL | Foo.some_method::<&'a isize>();
| ^^^^^^^^^^^

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// ignore-compare-mode-nll
// Test various ways to construct a pointer with a longer lifetime
// than the thing it points at and ensure that they result in
// errors. See also regions-free-region-ordering-callee.rs

View File

@ -1,5 +1,5 @@
error[E0623]: lifetime mismatch
--> $DIR/regions-free-region-ordering-caller.rs:18:12
--> $DIR/regions-free-region-ordering-caller.rs:20:12
|
LL | fn call2<'a, 'b>(a: &'a usize, b: &'b usize) {
| --------- ---------
@ -9,7 +9,7 @@ LL | let z: Option<&'b &'a usize> = None;//~ ERROR E0623
| ^^^^^^^^^^^^^^^^^^^^^ ...but data from `a` flows into `b` here
error[E0623]: lifetime mismatch
--> $DIR/regions-free-region-ordering-caller.rs:23:12
--> $DIR/regions-free-region-ordering-caller.rs:25:12
|
LL | fn call3<'a, 'b>(a: &'a usize, b: &'b usize) {
| --------- ---------
@ -20,7 +20,7 @@ LL | let z: Option<&'b Paramd<'a>> = None;//~ ERROR E0623
| ^^^^^^^^^^^^^^^^^^^^^^ ...but data from `a` flows into `b` here
error[E0623]: lifetime mismatch
--> $DIR/regions-free-region-ordering-caller.rs:27:12
--> $DIR/regions-free-region-ordering-caller.rs:29:12
|
LL | fn call4<'a, 'b>(a: &'a usize, b: &'b usize) {
| --------- --------- these two types are declared with different lifetimes...

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// ignore-compare-mode-nll
// Illustrates the "projection gap": in this test, even though we know
// that `T::Foo: 'x`, that does not tell us that `T: 'x`, because
// there might be other ways for the caller of `func` to show that

View File

@ -1,5 +1,5 @@
error[E0309]: the parameter type `T` may not live long enough
--> $DIR/regions-implied-bounds-projection-gap-1.rs:26:10
--> $DIR/regions-implied-bounds-projection-gap-1.rs:28:10
|
LL | fn func<'x, T:Trait1<'x>>(t: &'x T::Foo)
| -- help: consider adding an explicit lifetime bound `T: 'x`...
@ -8,7 +8,7 @@ LL | wf::<&'x T>();
| ^^^^^
|
note: ...so that the reference type `&'x T` does not outlive the data it points at
--> $DIR/regions-implied-bounds-projection-gap-1.rs:26:10
--> $DIR/regions-implied-bounds-projection-gap-1.rs:28:10
|
LL | wf::<&'x T>();
| ^^^^^

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// ignore-compare-mode-nll
// Test that a type which is contravariant with respect to its region
// parameter yields an error when used in a covariant way.
//

View File

@ -1,5 +1,5 @@
error[E0623]: lifetime mismatch
--> $DIR/regions-infer-contravariance-due-to-decl.rs:35:35
--> $DIR/regions-infer-contravariance-due-to-decl.rs:37:35
|
LL | fn use_<'short,'long>(c: Contravariant<'short>,
| --------------------- these two types are declared with different lifetimes...

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// ignore-compare-mode-nll
// Test that a type which is covariant with respect to its region
// parameter yields an error when used in a contravariant way.
//

View File

@ -1,5 +1,5 @@
error[E0623]: lifetime mismatch
--> $DIR/regions-infer-covariance-due-to-decl.rs:32:32
--> $DIR/regions-infer-covariance-due-to-decl.rs:34:32
|
LL | fn use_<'short,'long>(c: Covariant<'long>,
| ----------------

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// ignore-compare-mode-nll
// Test that we are imposing the requirement that every associated
// type of a bound that appears in the where clause on a struct must
// outlive the location in which the type appears, even when the

View File

@ -1,16 +1,16 @@
error[E0491]: in type `&'a WithAssoc<TheType<'b>>`, reference has a longer lifetime than the data it references
--> $DIR/regions-outlives-projection-container-wc.rs:44:12
--> $DIR/regions-outlives-projection-container-wc.rs:46:12
|
LL | let _: &'a WithAssoc<TheType<'b>> = loop { };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: the pointer is valid for the lifetime 'a as defined on the function body at 38:15
--> $DIR/regions-outlives-projection-container-wc.rs:38:15
note: the pointer is valid for the lifetime 'a as defined on the function body at 40:15
--> $DIR/regions-outlives-projection-container-wc.rs:40:15
|
LL | fn with_assoc<'a,'b>() {
| ^^
note: but the referenced data is only valid for the lifetime 'b as defined on the function body at 38:18
--> $DIR/regions-outlives-projection-container-wc.rs:38:18
note: but the referenced data is only valid for the lifetime 'b as defined on the function body at 40:18
--> $DIR/regions-outlives-projection-container-wc.rs:40:18
|
LL | fn with_assoc<'a,'b>() {
| ^^

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// ignore-compare-mode-nll
// Test that we are imposing the requirement that every associated
// type of a bound that appears in the where clause on a struct must
// outlive the location in which the type appears. Issue #22246.

View File

@ -1,67 +1,67 @@
error[E0491]: in type `&'a WithAssoc<TheType<'b>>`, reference has a longer lifetime than the data it references
--> $DIR/regions-outlives-projection-container.rs:48:12
--> $DIR/regions-outlives-projection-container.rs:50:12
|
LL | let _: &'a WithAssoc<TheType<'b>> = loop { }; //~ ERROR reference has a longer lifetime
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: the pointer is valid for the lifetime 'a as defined on the function body at 42:15
--> $DIR/regions-outlives-projection-container.rs:42:15
note: the pointer is valid for the lifetime 'a as defined on the function body at 44:15
--> $DIR/regions-outlives-projection-container.rs:44:15
|
LL | fn with_assoc<'a,'b>() {
| ^^
note: but the referenced data is only valid for the lifetime 'b as defined on the function body at 42:18
--> $DIR/regions-outlives-projection-container.rs:42:18
note: but the referenced data is only valid for the lifetime 'b as defined on the function body at 44:18
--> $DIR/regions-outlives-projection-container.rs:44:18
|
LL | fn with_assoc<'a,'b>() {
| ^^
error[E0491]: in type `&'a WithoutAssoc<TheType<'b>>`, reference has a longer lifetime than the data it references
--> $DIR/regions-outlives-projection-container.rs:65:12
--> $DIR/regions-outlives-projection-container.rs:67:12
|
LL | let _: &'a WithoutAssoc<TheType<'b>> = loop { }; //~ ERROR reference has a longer lifetime
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: the pointer is valid for the lifetime 'a as defined on the function body at 61:18
--> $DIR/regions-outlives-projection-container.rs:61:18
note: the pointer is valid for the lifetime 'a as defined on the function body at 63:18
--> $DIR/regions-outlives-projection-container.rs:63:18
|
LL | fn without_assoc<'a,'b>() {
| ^^
note: but the referenced data is only valid for the lifetime 'b as defined on the function body at 61:21
--> $DIR/regions-outlives-projection-container.rs:61:21
note: but the referenced data is only valid for the lifetime 'b as defined on the function body at 63:21
--> $DIR/regions-outlives-projection-container.rs:63:21
|
LL | fn without_assoc<'a,'b>() {
| ^^
error[E0491]: in type `&'a WithAssoc<TheType<'b>>`, reference has a longer lifetime than the data it references
--> $DIR/regions-outlives-projection-container.rs:73:12
--> $DIR/regions-outlives-projection-container.rs:75:12
|
LL | call::<&'a WithAssoc<TheType<'b>>>();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: the pointer is valid for the lifetime 'a as defined on the function body at 68:20
--> $DIR/regions-outlives-projection-container.rs:68:20
note: the pointer is valid for the lifetime 'a as defined on the function body at 70:20
--> $DIR/regions-outlives-projection-container.rs:70:20
|
LL | fn call_with_assoc<'a,'b>() {
| ^^
note: but the referenced data is only valid for the lifetime 'b as defined on the function body at 68:23
--> $DIR/regions-outlives-projection-container.rs:68:23
note: but the referenced data is only valid for the lifetime 'b as defined on the function body at 70:23
--> $DIR/regions-outlives-projection-container.rs:70:23
|
LL | fn call_with_assoc<'a,'b>() {
| ^^
error[E0491]: in type `&'a WithoutAssoc<TheType<'b>>`, reference has a longer lifetime than the data it references
--> $DIR/regions-outlives-projection-container.rs:80:12
--> $DIR/regions-outlives-projection-container.rs:82:12
|
LL | call::<&'a WithoutAssoc<TheType<'b>>>(); //~ ERROR reference has a longer lifetime
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: the pointer is valid for the lifetime 'a as defined on the function body at 77:23
--> $DIR/regions-outlives-projection-container.rs:77:23
note: the pointer is valid for the lifetime 'a as defined on the function body at 79:23
--> $DIR/regions-outlives-projection-container.rs:79:23
|
LL | fn call_without_assoc<'a,'b>() {
| ^^
note: but the referenced data is only valid for the lifetime 'b as defined on the function body at 77:26
--> $DIR/regions-outlives-projection-container.rs:77:26
note: but the referenced data is only valid for the lifetime 'b as defined on the function body at 79:26
--> $DIR/regions-outlives-projection-container.rs:79:26
|
LL | fn call_without_assoc<'a,'b>() {
| ^^

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// ignore-compare-mode-nll
// Test that a type which is covariant with respect to its region
// parameter yields an error when used in a contravariant way.
//

View File

@ -1,5 +1,5 @@
error[E0623]: lifetime mismatch
--> $DIR/regions-variance-contravariant-use-covariant-in-second-position.rs:35:30
--> $DIR/regions-variance-contravariant-use-covariant-in-second-position.rs:37:30
|
LL | fn use_<'short,'long>(c: S<'long, 'short>,
| ----------------

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// ignore-compare-mode-nll
// Test that a type which is covariant with respect to its region
// parameter yields an error when used in a contravariant way.
//

View File

@ -1,5 +1,5 @@
error[E0623]: lifetime mismatch
--> $DIR/regions-variance-contravariant-use-covariant.rs:33:35
--> $DIR/regions-variance-contravariant-use-covariant.rs:35:35
|
LL | fn use_<'short,'long>(c: Contravariant<'short>,
| --------------------- these two types are declared with different lifetimes...

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// ignore-compare-mode-nll
// Test that a type which is covariant with respect to its region
// parameter yields an error when used in a contravariant way.
//

View File

@ -1,5 +1,5 @@
error[E0623]: lifetime mismatch
--> $DIR/regions-variance-covariant-use-contravariant.rs:33:32
--> $DIR/regions-variance-covariant-use-contravariant.rs:35:32
|
LL | fn use_<'short,'long>(c: Covariant<'long>,
| ----------------

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// ignore-compare-mode-nll
// Test that an invariant region parameter used in a contravariant way
// yields an error.
//

View File

@ -1,5 +1,5 @@
error[E0623]: lifetime mismatch
--> $DIR/regions-variance-invariant-use-contravariant.rs:30:32
--> $DIR/regions-variance-invariant-use-contravariant.rs:32:32
|
LL | fn use_<'short,'long>(c: Invariant<'long>,
| ----------------

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// ignore-compare-mode-nll
// Test that a type which is invariant with respect to its region
// parameter used in a covariant way yields an error.
//

View File

@ -1,13 +1,13 @@
error[E0308]: mismatched types
--> $DIR/regions-variance-invariant-use-covariant.rs:27:33
--> $DIR/regions-variance-invariant-use-covariant.rs:29:33
|
LL | let _: Invariant<'static> = c; //~ ERROR mismatched types
| ^ lifetime mismatch
|
= note: expected type `Invariant<'static>`
found type `Invariant<'b>`
note: the lifetime 'b as defined on the function body at 21:9...
--> $DIR/regions-variance-invariant-use-covariant.rs:21:9
note: the lifetime 'b as defined on the function body at 23:9...
--> $DIR/regions-variance-invariant-use-covariant.rs:23:9
|
LL | fn use_<'b>(c: Invariant<'b>) {
| ^^

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// ignore-compare-mode-nll
// Test that an unboxed closure that captures a free variable by
// reference cannot escape the region of that variable.
fn main() {

View File

@ -1,5 +1,5 @@
error[E0597]: `x` does not live long enough
--> $DIR/unboxed-closure-region.rs:16:12
--> $DIR/unboxed-closure-region.rs:18:12
|
LL | || x //~ ERROR `x` does not live long enough
| -- ^ borrowed value does not live long enough

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// ignore-compare-mode-nll
// Test that an unboxed closure that mutates a free variable will
// cause borrow conflicts.

View File

@ -1,5 +1,5 @@
error[E0503]: cannot use `x` because it was mutably borrowed
--> $DIR/unboxed-closures-borrow-conflict.rs:17:9
--> $DIR/unboxed-closures-borrow-conflict.rs:19:9
|
LL | let f = || x += 1;
| -- borrow of `x` occurs here

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// ignore-compare-mode-nll
// Test that Cell is considered invariant with respect to its
// type.

View File

@ -1,5 +1,5 @@
error[E0623]: lifetime mismatch
--> $DIR/variance-cell-is-invariant.rs:24:25
--> $DIR/variance-cell-is-invariant.rs:26:25
|
LL | fn use_<'short,'long>(c: Foo<'short>,
| ----------- these two types are declared with different lifetimes...

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// ignore-compare-mode-nll
#![allow(dead_code)]
// Test that even when `T` is only used in contravariant position, it

View File

@ -1,37 +1,37 @@
error[E0308]: mismatched types
--> $DIR/variance-contravariant-arg-trait-match.rs:23:5
--> $DIR/variance-contravariant-arg-trait-match.rs:25:5
|
LL | impls_get::<G,&'min i32>() //~ ERROR mismatched types
| ^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch
|
= note: expected type `Get<&'min i32>`
found type `Get<&'max i32>`
note: the lifetime 'min as defined on the function body at 20:21...
--> $DIR/variance-contravariant-arg-trait-match.rs:20:21
note: the lifetime 'min as defined on the function body at 22:21...
--> $DIR/variance-contravariant-arg-trait-match.rs:22:21
|
LL | fn get_min_from_max<'min, 'max, G>()
| ^^^^
note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 20:27
--> $DIR/variance-contravariant-arg-trait-match.rs:20:27
note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 22:27
--> $DIR/variance-contravariant-arg-trait-match.rs:22:27
|
LL | fn get_min_from_max<'min, 'max, G>()
| ^^^^
error[E0308]: mismatched types
--> $DIR/variance-contravariant-arg-trait-match.rs:31:5
--> $DIR/variance-contravariant-arg-trait-match.rs:33:5
|
LL | impls_get::<G,&'max i32>() //~ ERROR mismatched types
| ^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch
|
= note: expected type `Get<&'max i32>`
found type `Get<&'min i32>`
note: the lifetime 'min as defined on the function body at 26:21...
--> $DIR/variance-contravariant-arg-trait-match.rs:26:21
note: the lifetime 'min as defined on the function body at 28:21...
--> $DIR/variance-contravariant-arg-trait-match.rs:28:21
|
LL | fn get_max_from_min<'min, 'max, G>()
| ^^^^
note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 26:27
--> $DIR/variance-contravariant-arg-trait-match.rs:26:27
note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 28:27
--> $DIR/variance-contravariant-arg-trait-match.rs:28:27
|
LL | fn get_max_from_min<'min, 'max, G>()
| ^^^^

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// ignore-compare-mode-nll
#![allow(dead_code)]
// Test that even when `Self` is only used in contravariant position, it

View File

@ -1,37 +1,37 @@
error[E0308]: mismatched types
--> $DIR/variance-contravariant-self-trait-match.rs:23:5
--> $DIR/variance-contravariant-self-trait-match.rs:25:5
|
LL | impls_get::<&'min G>(); //~ ERROR mismatched types
| ^^^^^^^^^^^^^^^^^^^^ lifetime mismatch
|
= note: expected type `Get`
found type `Get`
note: the lifetime 'min as defined on the function body at 20:21...
--> $DIR/variance-contravariant-self-trait-match.rs:20:21
note: the lifetime 'min as defined on the function body at 22:21...
--> $DIR/variance-contravariant-self-trait-match.rs:22:21
|
LL | fn get_min_from_max<'min, 'max, G>()
| ^^^^
note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 20:27
--> $DIR/variance-contravariant-self-trait-match.rs:20:27
note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 22:27
--> $DIR/variance-contravariant-self-trait-match.rs:22:27
|
LL | fn get_min_from_max<'min, 'max, G>()
| ^^^^
error[E0308]: mismatched types
--> $DIR/variance-contravariant-self-trait-match.rs:32:5
--> $DIR/variance-contravariant-self-trait-match.rs:34:5
|
LL | impls_get::<&'max G>(); //~ ERROR mismatched types
| ^^^^^^^^^^^^^^^^^^^^ lifetime mismatch
|
= note: expected type `Get`
found type `Get`
note: the lifetime 'min as defined on the function body at 26:21...
--> $DIR/variance-contravariant-self-trait-match.rs:26:21
note: the lifetime 'min as defined on the function body at 28:21...
--> $DIR/variance-contravariant-self-trait-match.rs:28:21
|
LL | fn get_max_from_min<'min, 'max, G>()
| ^^^^
note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 26:27
--> $DIR/variance-contravariant-self-trait-match.rs:26:27
note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 28:27
--> $DIR/variance-contravariant-self-trait-match.rs:28:27
|
LL | fn get_max_from_min<'min, 'max, G>()
| ^^^^

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// ignore-compare-mode-nll
#![allow(dead_code)]
// Test that even when `T` is only used in covariant position, it

View File

@ -1,37 +1,37 @@
error[E0308]: mismatched types
--> $DIR/variance-covariant-arg-trait-match.rs:24:5
--> $DIR/variance-covariant-arg-trait-match.rs:26:5
|
LL | impls_get::<G,&'min i32>() //~ ERROR mismatched types
| ^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch
|
= note: expected type `Get<&'min i32>`
found type `Get<&'max i32>`
note: the lifetime 'min as defined on the function body at 20:21...
--> $DIR/variance-covariant-arg-trait-match.rs:20:21
note: the lifetime 'min as defined on the function body at 22:21...
--> $DIR/variance-covariant-arg-trait-match.rs:22:21
|
LL | fn get_min_from_max<'min, 'max, G>()
| ^^^^
note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 20:27
--> $DIR/variance-covariant-arg-trait-match.rs:20:27
note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 22:27
--> $DIR/variance-covariant-arg-trait-match.rs:22:27
|
LL | fn get_min_from_max<'min, 'max, G>()
| ^^^^
error[E0308]: mismatched types
--> $DIR/variance-covariant-arg-trait-match.rs:30:5
--> $DIR/variance-covariant-arg-trait-match.rs:32:5
|
LL | impls_get::<G,&'max i32>() //~ ERROR mismatched types
| ^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch
|
= note: expected type `Get<&'max i32>`
found type `Get<&'min i32>`
note: the lifetime 'min as defined on the function body at 27:21...
--> $DIR/variance-covariant-arg-trait-match.rs:27:21
note: the lifetime 'min as defined on the function body at 29:21...
--> $DIR/variance-covariant-arg-trait-match.rs:29:21
|
LL | fn get_max_from_min<'min, 'max, G>()
| ^^^^
note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 27:27
--> $DIR/variance-covariant-arg-trait-match.rs:27:27
note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 29:27
--> $DIR/variance-covariant-arg-trait-match.rs:29:27
|
LL | fn get_max_from_min<'min, 'max, G>()
| ^^^^

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// ignore-compare-mode-nll
#![allow(dead_code)]
// Test that even when `Self` is only used in covariant position, it

View File

@ -1,37 +1,37 @@
error[E0308]: mismatched types
--> $DIR/variance-covariant-self-trait-match.rs:24:5
--> $DIR/variance-covariant-self-trait-match.rs:26:5
|
LL | impls_get::<&'min G>(); //~ ERROR mismatched types
| ^^^^^^^^^^^^^^^^^^^^ lifetime mismatch
|
= note: expected type `Get`
found type `Get`
note: the lifetime 'min as defined on the function body at 20:21...
--> $DIR/variance-covariant-self-trait-match.rs:20:21
note: the lifetime 'min as defined on the function body at 22:21...
--> $DIR/variance-covariant-self-trait-match.rs:22:21
|
LL | fn get_min_from_max<'min, 'max, G>()
| ^^^^
note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 20:27
--> $DIR/variance-covariant-self-trait-match.rs:20:27
note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 22:27
--> $DIR/variance-covariant-self-trait-match.rs:22:27
|
LL | fn get_min_from_max<'min, 'max, G>()
| ^^^^
error[E0308]: mismatched types
--> $DIR/variance-covariant-self-trait-match.rs:30:5
--> $DIR/variance-covariant-self-trait-match.rs:32:5
|
LL | impls_get::<&'max G>(); //~ ERROR mismatched types
| ^^^^^^^^^^^^^^^^^^^^ lifetime mismatch
|
= note: expected type `Get`
found type `Get`
note: the lifetime 'min as defined on the function body at 27:21...
--> $DIR/variance-covariant-self-trait-match.rs:27:21
note: the lifetime 'min as defined on the function body at 29:21...
--> $DIR/variance-covariant-self-trait-match.rs:29:21
|
LL | fn get_max_from_min<'min, 'max, G>()
| ^^^^
note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 27:27
--> $DIR/variance-covariant-self-trait-match.rs:27:27
note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 29:27
--> $DIR/variance-covariant-self-trait-match.rs:29:27
|
LL | fn get_max_from_min<'min, 'max, G>()
| ^^^^

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// ignore-compare-mode-nll
#![allow(dead_code)]
trait Get<T> {

View File

@ -1,37 +1,37 @@
error[E0308]: mismatched types
--> $DIR/variance-invariant-arg-trait-match.rs:20:5
--> $DIR/variance-invariant-arg-trait-match.rs:22:5
|
LL | impls_get::<G,&'min i32>() //~ ERROR mismatched types
| ^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch
|
= note: expected type `Get<&'min i32>`
found type `Get<&'max i32>`
note: the lifetime 'min as defined on the function body at 17:21...
--> $DIR/variance-invariant-arg-trait-match.rs:17:21
note: the lifetime 'min as defined on the function body at 19:21...
--> $DIR/variance-invariant-arg-trait-match.rs:19:21
|
LL | fn get_min_from_max<'min, 'max, G>()
| ^^^^
note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 17:27
--> $DIR/variance-invariant-arg-trait-match.rs:17:27
note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 19:27
--> $DIR/variance-invariant-arg-trait-match.rs:19:27
|
LL | fn get_min_from_max<'min, 'max, G>()
| ^^^^
error[E0308]: mismatched types
--> $DIR/variance-invariant-arg-trait-match.rs:26:5
--> $DIR/variance-invariant-arg-trait-match.rs:28:5
|
LL | impls_get::<G,&'max i32>() //~ ERROR mismatched types
| ^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch
|
= note: expected type `Get<&'max i32>`
found type `Get<&'min i32>`
note: the lifetime 'min as defined on the function body at 23:21...
--> $DIR/variance-invariant-arg-trait-match.rs:23:21
note: the lifetime 'min as defined on the function body at 25:21...
--> $DIR/variance-invariant-arg-trait-match.rs:25:21
|
LL | fn get_max_from_min<'min, 'max, G>()
| ^^^^
note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 23:27
--> $DIR/variance-invariant-arg-trait-match.rs:23:27
note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 25:27
--> $DIR/variance-invariant-arg-trait-match.rs:25:27
|
LL | fn get_max_from_min<'min, 'max, G>()
| ^^^^

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// ignore-compare-mode-nll
#![allow(dead_code)]
trait Get {

View File

@ -1,37 +1,37 @@
error[E0308]: mismatched types
--> $DIR/variance-invariant-self-trait-match.rs:20:5
--> $DIR/variance-invariant-self-trait-match.rs:22:5
|
LL | impls_get::<&'min G>(); //~ ERROR mismatched types
| ^^^^^^^^^^^^^^^^^^^^ lifetime mismatch
|
= note: expected type `Get`
found type `Get`
note: the lifetime 'min as defined on the function body at 17:21...
--> $DIR/variance-invariant-self-trait-match.rs:17:21
note: the lifetime 'min as defined on the function body at 19:21...
--> $DIR/variance-invariant-self-trait-match.rs:19:21
|
LL | fn get_min_from_max<'min, 'max, G>()
| ^^^^
note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 17:27
--> $DIR/variance-invariant-self-trait-match.rs:17:27
note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 19:27
--> $DIR/variance-invariant-self-trait-match.rs:19:27
|
LL | fn get_min_from_max<'min, 'max, G>()
| ^^^^
error[E0308]: mismatched types
--> $DIR/variance-invariant-self-trait-match.rs:26:5
--> $DIR/variance-invariant-self-trait-match.rs:28:5
|
LL | impls_get::<&'max G>(); //~ ERROR mismatched types
| ^^^^^^^^^^^^^^^^^^^^ lifetime mismatch
|
= note: expected type `Get`
found type `Get`
note: the lifetime 'min as defined on the function body at 23:21...
--> $DIR/variance-invariant-self-trait-match.rs:23:21
note: the lifetime 'min as defined on the function body at 25:21...
--> $DIR/variance-invariant-self-trait-match.rs:25:21
|
LL | fn get_max_from_min<'min, 'max, G>()
| ^^^^
note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 23:27
--> $DIR/variance-invariant-self-trait-match.rs:23:27
note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 25:27
--> $DIR/variance-invariant-self-trait-match.rs:25:27
|
LL | fn get_max_from_min<'min, 'max, G>()
| ^^^^