Skip to content

Commit ba8be83

Browse files
committed
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.
1 parent e5011b9 commit ba8be83

File tree

98 files changed

+273
-175
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+273
-175
lines changed

src/test/ui/compile-fail-migration/associated-types-subtyping-1.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// ignore-compare-mode-nll
12+
1113
#![allow(unused_variables)]
1214

1315
trait Trait<'a> {

src/test/ui/compile-fail-migration/associated-types-subtyping-1.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0623]: lifetime mismatch
2-
--> $DIR/associated-types-subtyping-1.rs:34:37
2+
--> $DIR/associated-types-subtyping-1.rs:36:37
33
|
44
LL | fn method2<'a,'b,T>(x: &'a T, y: &'b T)
55
| ----- ----- these two types are declared with different lifetimes...
@@ -8,7 +8,7 @@ LL | let _: <T as Trait<'b>>::Type = a; //~ ERROR E0623
88
| ^ ...but data from `y` flows into `x` here
99

1010
error[E0623]: lifetime mismatch
11-
--> $DIR/associated-types-subtyping-1.rs:43:37
11+
--> $DIR/associated-types-subtyping-1.rs:45:37
1212
|
1313
LL | fn method3<'a,'b,T>(x: &'a T, y: &'b T)
1414
| ----- ----- these two types are declared with different lifetimes...

src/test/ui/compile-fail-migration/borrow-tuple-fields.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// ignore-compare-mode-nll
12+
1113
#![feature(box_syntax)]
1214

1315
struct Foo(Box<isize>, isize);

src/test/ui/compile-fail-migration/borrow-tuple-fields.stderr

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
error[E0505]: cannot move out of `x` because it is borrowed
2-
--> $DIR/borrow-tuple-fields.rs:20:9
2+
--> $DIR/borrow-tuple-fields.rs:22:9
33
|
44
LL | let r = &x.0;
55
| --- borrow of `x.0` occurs here
66
LL | let y = x; //~ ERROR cannot move out of `x` because it is borrowed
77
| ^ move out of `x` occurs here
88

99
error[E0502]: cannot borrow `x.0` as mutable because it is also borrowed as immutable
10-
--> $DIR/borrow-tuple-fields.rs:24:18
10+
--> $DIR/borrow-tuple-fields.rs:26:18
1111
|
1212
LL | let a = &x.0;
1313
| --- immutable borrow occurs here
@@ -18,7 +18,7 @@ LL | }
1818
| - immutable borrow ends here
1919

2020
error[E0499]: cannot borrow `x.0` as mutable more than once at a time
21-
--> $DIR/borrow-tuple-fields.rs:28:18
21+
--> $DIR/borrow-tuple-fields.rs:30:18
2222
|
2323
LL | let a = &mut x.0;
2424
| --- first mutable borrow occurs here
@@ -29,15 +29,15 @@ LL | }
2929
| - first borrow ends here
3030

3131
error[E0505]: cannot move out of `x` because it is borrowed
32-
--> $DIR/borrow-tuple-fields.rs:33:9
32+
--> $DIR/borrow-tuple-fields.rs:35:9
3333
|
3434
LL | let r = &x.0;
3535
| --- borrow of `x.0` occurs here
3636
LL | let y = x; //~ ERROR cannot move out of `x` because it is borrowed
3737
| ^ move out of `x` occurs here
3838

3939
error[E0502]: cannot borrow `x.0` as mutable because it is also borrowed as immutable
40-
--> $DIR/borrow-tuple-fields.rs:37:18
40+
--> $DIR/borrow-tuple-fields.rs:39:18
4141
|
4242
LL | let a = &x.0;
4343
| --- immutable borrow occurs here
@@ -48,7 +48,7 @@ LL | }
4848
| - immutable borrow ends here
4949

5050
error[E0499]: cannot borrow `x.0` as mutable more than once at a time
51-
--> $DIR/borrow-tuple-fields.rs:41:18
51+
--> $DIR/borrow-tuple-fields.rs:43:18
5252
|
5353
LL | let a = &mut x.0;
5454
| --- first mutable borrow occurs here

src/test/ui/compile-fail-migration/borrowck/borrowck-borrow-mut-object-twice.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// ignore-compare-mode-nll
12+
1113
// Check that `&mut` objects cannot be borrowed twice, just like
1214
// other `&mut` pointers.
1315

src/test/ui/compile-fail-migration/borrowck/borrowck-borrow-mut-object-twice.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0499]: cannot borrow `*x` as mutable more than once at a time
2-
--> $DIR/borrowck-borrow-mut-object-twice.rs:21:5
2+
--> $DIR/borrowck-borrow-mut-object-twice.rs:23:5
33
|
44
LL | let _y = x.f1();
55
| - first mutable borrow occurs here

src/test/ui/compile-fail-migration/borrowck/borrowck-closures-two-mut.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
// access to the variable, whether that mutable access be used
1313
// for direct assignment or for taking mutable ref. Issue #6801.
1414

15+
// ignore-compare-mode-nll
16+
1517
#![feature(box_syntax)]
1618

1719
fn to_fn_mut<F: FnMut()>(f: F) -> F { f }

src/test/ui/compile-fail-migration/borrowck/borrowck-closures-two-mut.stderr

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0499]: cannot borrow `x` as mutable more than once at a time
2-
--> $DIR/borrowck-closures-two-mut.rs:22:24
2+
--> $DIR/borrowck-closures-two-mut.rs:24:24
33
|
44
LL | let c1 = to_fn_mut(|| x = 4);
55
| -- - previous borrow occurs due to use of `x` in closure
@@ -13,7 +13,7 @@ LL | }
1313
| - first borrow ends here
1414

1515
error[E0499]: cannot borrow `x` as mutable more than once at a time
16-
--> $DIR/borrowck-closures-two-mut.rs:32:24
16+
--> $DIR/borrowck-closures-two-mut.rs:34:24
1717
|
1818
LL | let c1 = to_fn_mut(|| set(&mut x));
1919
| -- - previous borrow occurs due to use of `x` in closure
@@ -27,7 +27,7 @@ LL | }
2727
| - first borrow ends here
2828

2929
error[E0499]: cannot borrow `x` as mutable more than once at a time
30-
--> $DIR/borrowck-closures-two-mut.rs:38:24
30+
--> $DIR/borrowck-closures-two-mut.rs:40:24
3131
|
3232
LL | let c1 = to_fn_mut(|| x = 5);
3333
| -- - previous borrow occurs due to use of `x` in closure
@@ -41,7 +41,7 @@ LL | }
4141
| - first borrow ends here
4242

4343
error[E0499]: cannot borrow `x` as mutable more than once at a time
44-
--> $DIR/borrowck-closures-two-mut.rs:44:24
44+
--> $DIR/borrowck-closures-two-mut.rs:46:24
4545
|
4646
LL | let c1 = to_fn_mut(|| x = 5);
4747
| -- - previous borrow occurs due to use of `x` in closure
@@ -56,7 +56,7 @@ LL | }
5656
| - first borrow ends here
5757

5858
error[E0499]: cannot borrow `x` as mutable more than once at a time
59-
--> $DIR/borrowck-closures-two-mut.rs:55:24
59+
--> $DIR/borrowck-closures-two-mut.rs:57:24
6060
|
6161
LL | let c1 = to_fn_mut(|| set(&mut *x.f));
6262
| -- - previous borrow occurs due to use of `x` in closure

src/test/ui/compile-fail-migration/borrowck/borrowck-closures-unique-imm.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// ignore-compare-mode-nll
12+
1113
struct Foo {
1214
x: isize,
1315
}

src/test/ui/compile-fail-migration/borrowck/borrowck-closures-unique-imm.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0502]: cannot borrow `this.x` as mutable because it is also borrowed as immutable
2-
--> $DIR/borrowck-closures-unique-imm.rs:21:14
2+
--> $DIR/borrowck-closures-unique-imm.rs:23:14
33
|
44
LL | let p = &this.x;
55
| ------ immutable borrow occurs here

src/test/ui/compile-fail-migration/borrowck/borrowck-closures-unique.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// ignore-compare-mode-nll
12+
1113
// Tests that a closure which requires mutable access to the referent
1214
// of an `&mut` requires a "unique" borrow -- that is, the variable to
1315
// be borrowed (here, `x`) will not be borrowed *mutably*, but

src/test/ui/compile-fail-migration/borrowck/borrowck-closures-unique.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0500]: closure requires unique access to `x` but it is already borrowed
2-
--> $DIR/borrowck-closures-unique.rs:32:14
2+
--> $DIR/borrowck-closures-unique.rs:34:14
33
|
44
LL | let c1 = || get(x);
55
| -- - previous borrow occurs due to use of `x` in closure
@@ -13,7 +13,7 @@ LL | }
1313
| - borrow ends here
1414

1515
error[E0500]: closure requires unique access to `x` but it is already borrowed
16-
--> $DIR/borrowck-closures-unique.rs:37:14
16+
--> $DIR/borrowck-closures-unique.rs:39:14
1717
|
1818
LL | let c1 = || get(x);
1919
| -- - previous borrow occurs due to use of `x` in closure
@@ -27,7 +27,7 @@ LL | }
2727
| - borrow ends here
2828

2929
error[E0524]: two closures require unique access to `x` at the same time
30-
--> $DIR/borrowck-closures-unique.rs:42:14
30+
--> $DIR/borrowck-closures-unique.rs:44:14
3131
|
3232
LL | let c1 = || set(x);
3333
| -- - previous borrow occurs due to use of `x` in closure
@@ -41,7 +41,7 @@ LL | }
4141
| - borrow from first closure ends here
4242

4343
error[E0595]: closure cannot assign to immutable argument `x`
44-
--> $DIR/borrowck-closures-unique.rs:46:14
44+
--> $DIR/borrowck-closures-unique.rs:48:14
4545
|
4646
LL | let c1 = || x = panic!(); //~ ERROR closure cannot assign to immutable argument
4747
| ^^ cannot borrow mutably

src/test/ui/compile-fail-migration/borrowck/borrowck-issue-2657-1.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// ignore-compare-mode-nll
12+
1113
#![feature(box_syntax)]
1214

1315
fn main() {

src/test/ui/compile-fail-migration/borrowck/borrowck-issue-2657-1.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0505]: cannot move out of `x` because it is borrowed
2-
--> $DIR/borrowck-issue-2657-1.rs:17:13
2+
--> $DIR/borrowck-issue-2657-1.rs:19:13
33
|
44
LL | Some(ref _y) => {
55
| ------ borrow of `x.0` occurs here

src/test/ui/compile-fail-migration/borrowck/borrowck-lend-flow-if.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// ignore-compare-mode-nll
12+
1113
// Note: the borrowck analysis is currently flow-insensitive.
1214
// Therefore, some of these errors are marked as spurious and could be
1315
// corrected by a simple change to the analysis. The others are

src/test/ui/compile-fail-migration/borrowck/borrowck-lend-flow-if.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0502]: cannot borrow `*v` as mutable because `v` is also borrowed as immutable
2-
--> $DIR/borrowck-lend-flow-if.rs:38:21
2+
--> $DIR/borrowck-lend-flow-if.rs:40:21
33
|
44
LL | _w = &v;
55
| - immutable borrow occurs here

src/test/ui/compile-fail-migration/borrowck/borrowck-lend-flow.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// ignore-compare-mode-nll
12+
1113
// Note: the borrowck analysis is currently flow-insensitive.
1214
// Therefore, some of these errors are marked as spurious and could be
1315
// corrected by a simple change to the analysis. The others are

src/test/ui/compile-fail-migration/borrowck/borrowck-lend-flow.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0502]: cannot borrow `*v` as mutable because `v` is also borrowed as immutable
2-
--> $DIR/borrowck-lend-flow.rs:34:21
2+
--> $DIR/borrowck-lend-flow.rs:36:21
33
|
44
LL | let _w = &v;
55
| - immutable borrow occurs here

src/test/ui/compile-fail-migration/borrowck/borrowck-loan-blocks-move-cc.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// ignore-compare-mode-nll
12+
1113
#![feature(box_syntax)]
1214

1315
use std::thread;

src/test/ui/compile-fail-migration/borrowck/borrowck-loan-blocks-move-cc.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0504]: cannot move `v` into closure because it is borrowed
2-
--> $DIR/borrowck-loan-blocks-move-cc.rs:23:27
2+
--> $DIR/borrowck-loan-blocks-move-cc.rs:25:27
33
|
44
LL | let _w = &v;
55
| - borrow of `v` occurs here
@@ -8,7 +8,7 @@ LL | println!("v={}", *v);
88
| ^ move into closure occurs here
99

1010
error[E0504]: cannot move `v` into closure because it is borrowed
11-
--> $DIR/borrowck-loan-blocks-move-cc.rs:32:27
11+
--> $DIR/borrowck-loan-blocks-move-cc.rs:34:27
1212
|
1313
LL | let _w = &v;
1414
| - borrow of `v` occurs here

src/test/ui/compile-fail-migration/borrowck/borrowck-loan-blocks-move.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// ignore-compare-mode-nll
12+
1113
#![feature(box_syntax)]
1214

1315
fn take(_v: Box<isize>) {

src/test/ui/compile-fail-migration/borrowck/borrowck-loan-blocks-move.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0505]: cannot move out of `v` because it is borrowed
2-
--> $DIR/borrowck-loan-blocks-move.rs:19:10
2+
--> $DIR/borrowck-loan-blocks-move.rs:21:10
33
|
44
LL | let _w = &v;
55
| - borrow of `v` occurs here

src/test/ui/compile-fail-migration/borrowck/borrowck-move-from-subpath-of-borrowed-path.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// ignore-compare-mode-nll
12+
1113
// verify that an error is raised when trying to move out of a
1214
// borrowed path.
1315

src/test/ui/compile-fail-migration/borrowck/borrowck-move-from-subpath-of-borrowed-path.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0505]: cannot move out of `*a` because it is borrowed
2-
--> $DIR/borrowck-move-from-subpath-of-borrowed-path.rs:20:9
2+
--> $DIR/borrowck-move-from-subpath-of-borrowed-path.rs:22:9
33
|
44
LL | let b = &a;
55
| - borrow of `a` occurs here

src/test/ui/compile-fail-migration/borrowck/borrowck-move-mut-base-ptr.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// ignore-compare-mode-nll
12+
1113
// Test that attempt to move `&mut` pointer while pointee is borrowed
1214
// yields an error.
1315
//

src/test/ui/compile-fail-migration/borrowck/borrowck-move-mut-base-ptr.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0505]: cannot move out of `t0` because it is borrowed
2-
--> $DIR/borrowck-move-mut-base-ptr.rs:18:9
2+
--> $DIR/borrowck-move-mut-base-ptr.rs:20:9
33
|
44
LL | let p: &isize = &*t0; // Freezes `*t0`
55
| --- borrow of `*t0` occurs here

src/test/ui/compile-fail-migration/borrowck/borrowck-mut-borrow-of-mut-base-ptr.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// ignore-compare-mode-nll
12+
1113
// Test that attempt to mutably borrow `&mut` pointer while pointee is
1214
// borrowed yields an error.
1315
//

src/test/ui/compile-fail-migration/borrowck/borrowck-mut-borrow-of-mut-base-ptr.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0502]: cannot borrow `t0` as mutable because `*t0` is also borrowed as immutable
2-
--> $DIR/borrowck-mut-borrow-of-mut-base-ptr.rs:19:23
2+
--> $DIR/borrowck-mut-borrow-of-mut-base-ptr.rs:21:23
33
|
44
LL | let p: &isize = &*t0; // Freezes `*t0`
55
| --- immutable borrow occurs here
@@ -10,7 +10,7 @@ LL | }
1010
| - immutable borrow ends here
1111

1212
error[E0499]: cannot borrow `t0` as mutable more than once at a time
13-
--> $DIR/borrowck-mut-borrow-of-mut-base-ptr.rs:26:23
13+
--> $DIR/borrowck-mut-borrow-of-mut-base-ptr.rs:28:23
1414
|
1515
LL | let p: &mut isize = &mut *t0; // Claims `*t0`
1616
| --- first mutable borrow occurs here

src/test/ui/compile-fail-migration/borrowck/borrowck-object-lifetime.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// ignore-compare-mode-nll
12+
1113
// Test that borrows that occur due to calls to object methods
1214
// properly "claim" the object path.
1315

src/test/ui/compile-fail-migration/borrowck/borrowck-object-lifetime.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0502]: cannot borrow `*x` as mutable because it is also borrowed as immutable
2-
--> $DIR/borrowck-object-lifetime.rs:26:14
2+
--> $DIR/borrowck-object-lifetime.rs:28:14
33
|
44
LL | let _y = x.borrowed();
55
| - immutable borrow occurs here
@@ -9,7 +9,7 @@ LL | }
99
| - immutable borrow ends here
1010

1111
error[E0502]: cannot borrow `x` as mutable because `*x` is also borrowed as immutable
12-
--> $DIR/borrowck-object-lifetime.rs:31:19
12+
--> $DIR/borrowck-object-lifetime.rs:33:19
1313
|
1414
LL | let _y = x.borrowed();
1515
| - immutable borrow occurs here

src/test/ui/compile-fail-migration/borrowck/borrowck-overloaded-index-autoderef.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// ignore-compare-mode-nll
12+
1113
// Test that we still see borrowck errors of various kinds when using
1214
// indexing and autoderef in combination.
1315

0 commit comments

Comments
 (0)