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

-1
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

-2
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

-13
This file was deleted.

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

-11
This file was deleted.

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

+2-5
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
}
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

-7
This file was deleted.

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

-11
This file was deleted.

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

+1-1
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

+2-11
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`.

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
fn main() {
22
match Some(()) {
33
None => { },
4-
option if { option = None; false } => { }, //~ ERROR E0302
4+
option if { option = None; false } => { },
55
//~^ ERROR cannot assign to `option`, as it is immutable for the pattern guard
66
Some(_) => { }
77
}

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

+1-8
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
error[E0302]: cannot assign in a pattern guard
2-
--> $DIR/E0302.rs:4:21
3-
|
4-
LL | option if { option = None; false } => { },
5-
| ^^^^^^^^^^^^^ assignment in pattern guard
6-
71
error[E0594]: cannot assign to `option`, as it is immutable for the pattern guard
82
--> $DIR/E0302.rs:4:21
93
|
@@ -12,6 +6,5 @@ LL | option if { option = None; false } => { },
126
|
137
= note: variables bound in patterns are immutable until the end of the pattern guard
148

15-
error: aborting due to 2 previous errors
9+
error: aborting due to previous error
1610

17-
For more information about this error, try `rustc --explain E0302`.

src/test/ui/issues/issue-24535-allow-mutable-borrow-in-match-guard.rs

-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
// See further discussion on rust-lang/rust#24535,
66
// rust-lang/rfcs#1006, and rust-lang/rfcs#107
77

8-
#![feature(bind_by_move_pattern_guards)]
9-
108
fn main() {
119
rust_issue_24535();
1210
rfcs_issue_1006_1();

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

-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
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-
#![feature(bind_by_move_pattern_guards)]
9-
108
fn main() {
119
let mut b = &mut true;
1210
match b {

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

+1-1
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:14:25
2+
--> $DIR/issue-27282-reborrow-ref-mut-in-guard.rs:12: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

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33

44
// run-pass
55

6-
#![feature(bind_by_move_pattern_guards)]
7-
86
// Test that z always point to the same temporary.
97
fn referent_stability() {
108
let p;

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

-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
// Test that we have enough false edges to avoid exposing the exact matching
22
// algorithm in borrow checking.
33

4-
#![feature(bind_by_move_pattern_guards)]
5-
64
fn guard_always_precedes_arm(y: i32) {
75
let mut x;
86
// x should always be initialized, as the only way to reach the arm is

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
error[E0381]: use of possibly-uninitialized variable: `x`
2-
--> $DIR/match-cfg-fake-edges.rs:23:13
2+
--> $DIR/match-cfg-fake-edges.rs:21:13
33
|
44
LL | x;
55
| ^ use of possibly-uninitialized `x`
66

77
error[E0382]: use of moved value: `x`
8-
--> $DIR/match-cfg-fake-edges.rs:37:13
8+
--> $DIR/match-cfg-fake-edges.rs:35:13
99
|
1010
LL | let x = String::new();
1111
| - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait

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

-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
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-
#![feature(bind_by_move_pattern_guards)]
9-
108
fn ok_mutation_in_guard(mut q: i32) {
119
match q {
1210
// OK, mutation doesn't change which patterns g matches

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

+9-9
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:57:13
2+
--> $DIR/match-guards-partially-borrow.rs:55: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:69:13
11+
--> $DIR/match-guards-partially-borrow.rs:67: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:93:13
20+
--> $DIR/match-guards-partially-borrow.rs:91: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:107:22
29+
--> $DIR/match-guards-partially-borrow.rs:105: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:119:13
38+
--> $DIR/match-guards-partially-borrow.rs:117: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:130:13
49+
--> $DIR/match-guards-partially-borrow.rs:128: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:141:13
58+
--> $DIR/match-guards-partially-borrow.rs:139: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:153:13
67+
--> $DIR/match-guards-partially-borrow.rs:151: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:164:13
76+
--> $DIR/match-guards-partially-borrow.rs:162:13
7777
|
7878
LL | match b {
7979
| - value is immutable in match guard

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

-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
// run-pass
66

7-
#![feature(bind_by_move_pattern_guards)]
8-
97
use std::sync::mpsc::channel;
108

119
fn main() {

src/test/ui/rfc-0107-bind-by-move-pattern-guards/feature-gate.gate_and_2015.stderr

-10
This file was deleted.

src/test/ui/rfc-0107-bind-by-move-pattern-guards/feature-gate.gate_and_2018.stderr

-10
This file was deleted.

src/test/ui/rfc-0107-bind-by-move-pattern-guards/feature-gate.gate_and_feature_nll.stderr

-10
This file was deleted.

src/test/ui/rfc-0107-bind-by-move-pattern-guards/feature-gate.gate_and_znll.stderr

-10
This file was deleted.

src/test/ui/rfc-0107-bind-by-move-pattern-guards/feature-gate.no_gate.stderr

-11
This file was deleted.

0 commit comments

Comments
 (0)