Skip to content

Commit 642993e

Browse files
committed
Update tests wrt. bind_by_by_move_pattern_guards stabilization.
1 parent 0356813 commit 642993e

33 files changed

+35
-218
lines changed

src/librustc_mir/error_codes.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1989,7 +1989,6 @@ 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(bind_by_move_pattern_guards)]
19931992
let mut x = Some(0);
19941993
match x {
19951994
None => (),

src/test/mir-opt/match-arm-scopes.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
// all of the bindings for that scope.
99
// * No drop flags are used.
1010

11-
#![feature(nll, bind_by_move_pattern_guards)]
12-
1311
fn complicated_match(cond: bool, items: (bool, bool, String)) -> i32 {
1412
match items {
1513
(false, a, s) | (a, false, s) if if cond { return 3 } else { a } => 1,

src/test/ui/bind-by-move/bind-by-move-no-guards.rs

Lines changed: 0 additions & 13 deletions
This file was deleted.

src/test/ui/bind-by-move/bind-by-move-no-guards.stderr

Lines changed: 0 additions & 11 deletions
This file was deleted.

src/test/ui/borrowck/borrowck-mutate-in-guard.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,9 @@ fn foo() -> isize {
88
let mut x = Enum::A(&mut n);
99
match x {
1010
Enum::A(_) if { x = Enum::B(false); false } => 1,
11-
//~^ ERROR cannot assign in a pattern guard
12-
//~| ERROR cannot assign `x` in match guard
11+
//~^ ERROR cannot assign `x` in match guard
1312
Enum::A(_) if { let y = &mut x; *y = Enum::B(false); false } => 1,
14-
//~^ ERROR cannot mutably borrow in a pattern guard
15-
//~| ERROR cannot assign in a pattern guard
16-
//~| ERROR cannot mutably borrow `x` in match guard
13+
//~^ ERROR cannot mutably borrow `x` in match guard
1714
Enum::A(p) => *p,
1815
Enum::B(_) => 2,
1916
}
Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,3 @@
1-
error[E0302]: cannot assign in a pattern guard
2-
--> $DIR/borrowck-mutate-in-guard.rs:10:25
3-
|
4-
LL | Enum::A(_) if { x = Enum::B(false); false } => 1,
5-
| ^^^^^^^^^^^^^^^^^^ assignment in pattern guard
6-
7-
error[E0301]: cannot mutably borrow in a pattern guard
8-
--> $DIR/borrowck-mutate-in-guard.rs:13:38
9-
|
10-
LL | Enum::A(_) if { let y = &mut x; *y = Enum::B(false); false } => 1,
11-
| ^ borrowed mutably in pattern guard
12-
|
13-
= help: add `#![feature(bind_by_move_pattern_guards)]` to the crate attributes to enable
14-
15-
error[E0302]: cannot assign in a pattern guard
16-
--> $DIR/borrowck-mutate-in-guard.rs:13:41
17-
|
18-
LL | Enum::A(_) if { let y = &mut x; *y = Enum::B(false); false } => 1,
19-
| ^^^^^^^^^^^^^^^^^^^ assignment in pattern guard
20-
211
error[E0510]: cannot assign `x` in match guard
222
--> $DIR/borrowck-mutate-in-guard.rs:10:25
233
|
@@ -27,15 +7,14 @@ LL | Enum::A(_) if { x = Enum::B(false); false } => 1,
277
| ^^^^^^^^^^^^^^^^^^ cannot assign
288

299
error[E0510]: cannot mutably borrow `x` in match guard
30-
--> $DIR/borrowck-mutate-in-guard.rs:13:33
10+
--> $DIR/borrowck-mutate-in-guard.rs:12:33
3111
|
3212
LL | match x {
3313
| - value is immutable in match guard
3414
...
3515
LL | Enum::A(_) if { let y = &mut x; *y = Enum::B(false); false } => 1,
3616
| ^^^^^^ cannot mutably borrow
3717

38-
error: aborting due to 5 previous errors
18+
error: aborting due to 2 previous errors
3919

40-
Some errors have detailed explanations: E0301, E0302, E0510.
41-
For more information about an error, try `rustc --explain E0301`.
20+
For more information about this error, try `rustc --explain E0510`.

src/test/ui/error-codes/E0008.rs

Lines changed: 0 additions & 7 deletions
This file was deleted.

src/test/ui/error-codes/E0008.stderr

Lines changed: 0 additions & 11 deletions
This file was deleted.

src/test/ui/error-codes/E0301.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
fn main() {
22
match Some(()) {
33
None => { },
4-
option if option.take().is_none() => {}, //~ ERROR E0301
4+
option if option.take().is_none() => {},
55
Some(_) => { } //~^ ERROR E0596
66
}
77
}

src/test/ui/error-codes/E0301.stderr

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
error[E0301]: cannot mutably borrow in a pattern guard
2-
--> $DIR/E0301.rs:4:19
3-
|
4-
LL | option if option.take().is_none() => {},
5-
| ^^^^^^ borrowed mutably in pattern guard
6-
|
7-
= help: add `#![feature(bind_by_move_pattern_guards)]` to the crate attributes to enable
8-
91
error[E0596]: cannot borrow `option` as mutable, as it is immutable for the pattern guard
102
--> $DIR/E0301.rs:4:19
113
|
@@ -14,7 +6,6 @@ LL | option if option.take().is_none() => {},
146
|
157
= note: variables bound in patterns are immutable until the end of the pattern guard
168

17-
error: aborting due to 2 previous errors
9+
error: aborting due to previous error
1810

19-
Some errors have detailed explanations: E0301, E0596.
20-
For more information about an error, try `rustc --explain E0301`.
11+
For more information about this error, try `rustc --explain E0596`.

0 commit comments

Comments
 (0)