Skip to content

Commit c4bf275

Browse files
committed
Remove 'feature(nll)' from bind_by_move_pattern_guards tests.
1 parent f64b66a commit c4bf275

20 files changed

+71
-68
lines changed

src/librustc_mir/error_codes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1989,7 +1989,7 @@ When matching on a variable it cannot be mutated in the match guards, as this
19891989
could cause the match to be non-exhaustive:
19901990
19911991
```compile_fail,E0510
1992-
#![feature(nll, bind_by_move_pattern_guards)]
1992+
#![feature(bind_by_move_pattern_guards)]
19931993
let mut x = Some(0);
19941994
match x {
19951995
None => (),

src/test/ui/issues/issue-27282-reborrow-ref-mut-in-guard.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@
55
// reject it. But I want to make sure that we continue to reject it
66
// (under NLL) even when that conservaive check goes away.
77

8-
98
#![feature(bind_by_move_pattern_guards)]
10-
#![feature(nll)]
119

1210
fn main() {
1311
let mut b = &mut true;

src/test/ui/issues/issue-27282-reborrow-ref-mut-in-guard.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0596]: cannot borrow `r` as mutable, as it is immutable for the pattern guard
2-
--> $DIR/issue-27282-reborrow-ref-mut-in-guard.rs:16:25
2+
--> $DIR/issue-27282-reborrow-ref-mut-in-guard.rs:14:25
33
|
44
LL | ref mut r if { (|| { let bar = &mut *r; **bar = false; })();
55
| ^^ - mutable borrow occurs due to use of `r` in closure

src/test/ui/match/match-ref-mut-stability.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
// run-pass
55

6-
#![feature(nll, bind_by_move_pattern_guards)]
6+
#![feature(bind_by_move_pattern_guards)]
77

88
// Test that z always point to the same temporary.
99
fn referent_stability() {

src/test/ui/nll/match-cfg-fake-edges.rs

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Test that we have enough false edges to avoid exposing the exact matching
22
// algorithm in borrow checking.
33

4-
#![feature(nll, bind_by_move_pattern_guards)]
4+
#![feature(bind_by_move_pattern_guards)]
55

66
fn guard_always_precedes_arm(y: i32) {
77
let mut x;
@@ -41,18 +41,4 @@ fn guard_may_be_taken(y: bool) {
4141
};
4242
}
4343

44-
fn all_previous_tests_may_be_done(y: &mut (bool, bool)) {
45-
let r = &mut y.1;
46-
// We don't actually test y.1 to select the second arm, but we don't want
47-
// borrowck results to be based on the order we match patterns.
48-
match y {
49-
(false, true) => 1, //~ ERROR cannot use `y.1` because it was mutably borrowed
50-
(true, _) => {
51-
r;
52-
2
53-
}
54-
(false, _) => 3,
55-
};
56-
}
57-
5844
fn main() {}

src/test/ui/nll/match-cfg-fake-edges.stderr

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,7 @@ LL | true => {
1616
LL | x;
1717
| ^ value used here after move
1818

19-
error[E0503]: cannot use `y.1` because it was mutably borrowed
20-
--> $DIR/match-cfg-fake-edges.rs:49:17
21-
|
22-
LL | let r = &mut y.1;
23-
| -------- borrow of `y.1` occurs here
24-
...
25-
LL | (false, true) => 1,
26-
| ^^^^ use of borrowed `y.1`
27-
LL | (true, _) => {
28-
LL | r;
29-
| - borrow later used here
30-
31-
error: aborting due to 3 previous errors
19+
error: aborting due to 2 previous errors
3220

33-
Some errors have detailed explanations: E0381, E0382, E0503.
21+
Some errors have detailed explanations: E0381, E0382.
3422
For more information about an error, try `rustc --explain E0381`.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Test that we have enough false edges to avoid exposing the exact matching
2+
// algorithm in borrow checking.
3+
4+
#![feature(nll)]
5+
6+
fn all_previous_tests_may_be_done(y: &mut (bool, bool)) {
7+
let r = &mut y.1;
8+
// We don't actually test y.1 to select the second arm, but we don't want
9+
// borrowck results to be based on the order we match patterns.
10+
match y {
11+
(false, true) => 1, //~ ERROR cannot use `y.1` because it was mutably borrowed
12+
(true, _) => {
13+
r;
14+
2
15+
}
16+
(false, _) => 3,
17+
};
18+
}
19+
20+
fn main() {}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
error[E0503]: cannot use `y.1` because it was mutably borrowed
2+
--> $DIR/match-cfg-fake-edges2.rs:11:17
3+
|
4+
LL | let r = &mut y.1;
5+
| -------- borrow of `y.1` occurs here
6+
...
7+
LL | (false, true) => 1,
8+
| ^^^^ use of borrowed `y.1`
9+
LL | (true, _) => {
10+
LL | r;
11+
| - borrow later used here
12+
13+
error: aborting due to previous error
14+
15+
For more information about this error, try `rustc --explain E0503`.

src/test/ui/nll/match-guards-partially-borrow.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@
55
// Test that we don't allow mutating the value being matched on in a way that
66
// changes which patterns it matches, until we have chosen an arm.
77

8-
98
#![feature(bind_by_move_pattern_guards)]
10-
#![feature(nll)]
119

1210
fn ok_mutation_in_guard(mut q: i32) {
1311
match q {

src/test/ui/nll/match-guards-partially-borrow.stderr

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0510]: cannot assign `q` in match guard
2-
--> $DIR/match-guards-partially-borrow.rs:59:13
2+
--> $DIR/match-guards-partially-borrow.rs:57:13
33
|
44
LL | match q {
55
| - value is immutable in match guard
@@ -8,7 +8,7 @@ LL | q = true;
88
| ^^^^^^^^ cannot assign
99

1010
error[E0510]: cannot assign `r` in match guard
11-
--> $DIR/match-guards-partially-borrow.rs:71:13
11+
--> $DIR/match-guards-partially-borrow.rs:69:13
1212
|
1313
LL | match r {
1414
| - value is immutable in match guard
@@ -17,7 +17,7 @@ LL | r = true;
1717
| ^^^^^^^^ cannot assign
1818

1919
error[E0510]: cannot assign `t` in match guard
20-
--> $DIR/match-guards-partially-borrow.rs:95:13
20+
--> $DIR/match-guards-partially-borrow.rs:93:13
2121
|
2222
LL | match t {
2323
| - value is immutable in match guard
@@ -26,7 +26,7 @@ LL | t = true;
2626
| ^^^^^^^^ cannot assign
2727

2828
error[E0510]: cannot mutably borrow `x.0` in match guard
29-
--> $DIR/match-guards-partially-borrow.rs:109:22
29+
--> $DIR/match-guards-partially-borrow.rs:107:22
3030
|
3131
LL | match x {
3232
| - value is immutable in match guard
@@ -35,7 +35,7 @@ LL | Some(ref mut r) => *r = None,
3535
| ^^^^^^^^^ cannot mutably borrow
3636

3737
error[E0506]: cannot assign to `t` because it is borrowed
38-
--> $DIR/match-guards-partially-borrow.rs:121:13
38+
--> $DIR/match-guards-partially-borrow.rs:119:13
3939
|
4040
LL | s if {
4141
| - borrow of `t` occurs here
@@ -46,7 +46,7 @@ LL | } => (), // What value should `s` have in the arm?
4646
| - borrow later used here
4747

4848
error[E0510]: cannot assign `y` in match guard
49-
--> $DIR/match-guards-partially-borrow.rs:132:13
49+
--> $DIR/match-guards-partially-borrow.rs:130:13
5050
|
5151
LL | match *y {
5252
| -- value is immutable in match guard
@@ -55,7 +55,7 @@ LL | y = &true;
5555
| ^^^^^^^^^ cannot assign
5656

5757
error[E0510]: cannot assign `z` in match guard
58-
--> $DIR/match-guards-partially-borrow.rs:143:13
58+
--> $DIR/match-guards-partially-borrow.rs:141:13
5959
|
6060
LL | match z {
6161
| - value is immutable in match guard
@@ -64,7 +64,7 @@ LL | z = &true;
6464
| ^^^^^^^^^ cannot assign
6565

6666
error[E0510]: cannot assign `a` in match guard
67-
--> $DIR/match-guards-partially-borrow.rs:155:13
67+
--> $DIR/match-guards-partially-borrow.rs:153:13
6868
|
6969
LL | match a {
7070
| - value is immutable in match guard
@@ -73,7 +73,7 @@ LL | a = &true;
7373
| ^^^^^^^^^ cannot assign
7474

7575
error[E0510]: cannot assign `b` in match guard
76-
--> $DIR/match-guards-partially-borrow.rs:166:13
76+
--> $DIR/match-guards-partially-borrow.rs:164:13
7777
|
7878
LL | match b {
7979
| - value is immutable in match guard

0 commit comments

Comments
 (0)