Skip to content

Commit b91be87

Browse files
committed
temp
1 parent 7b5a15a commit b91be87

File tree

2 files changed

+26
-27
lines changed

2 files changed

+26
-27
lines changed

tests/ui/nll/match-guards-partially-borrow.rs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +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-
98
fn ok_mutation_in_if_guard(mut q: i32) {
109
match q {
1110
// OK, mutation doesn't change which patterns g matches
@@ -34,7 +33,7 @@ fn ok_mutation_in_if_guard2(mut u: bool) {
3433
}
3534
}
3635

37-
fn ok_mutation_in_2(mut u: bool) {
36+
fn ok_mutation_in_if_let_guard2(mut u: bool) {
3837
// OK value of u is unused before modification
3938
match u {
4039
_ => (),
@@ -58,7 +57,7 @@ fn ok_mutation_in_if_guard4(mut w: (&mut bool,)) {
5857
}
5958
}
6059

61-
fn ok_mutation_in_4(mut w: (&mut bool,)) {
60+
fn ok_mutation_in_if_let_guard4(mut w: (&mut bool,)) {
6261
// OK value of u is unused before modification
6362
match w {
6463
_ => (),
@@ -202,7 +201,7 @@ fn bad_mutation_in_if_guard2(mut x: Option<Option<&i32>>) {
202201
}
203202
}
204203

205-
fn bad_mutation_in_2(mut x: Option<Option<&i32>>) {
204+
fn bad_mutation_in_if_let_guard2(mut x: Option<Option<&i32>>) {
206205
// Check that nested patterns are checked.
207206
match x {
208207
None => (),
@@ -228,7 +227,7 @@ fn bad_mutation_in_if_guard3(mut t: bool) {
228227
}
229228
}
230229

231-
fn bad_mutation_in_3(mut t: bool) {
230+
fn bad_mutation_in_if_let_guard3(mut t: bool) {
232231
match t {
233232
s if let Some(()) = {
234233
t = !t; //~ ERROR
@@ -271,7 +270,7 @@ fn bad_indirect_mutation_in_if_guard2(mut z: &bool) {
271270
}
272271
}
273272

274-
fn bad_indirect_mutation_in_2(mut z: &bool) {
273+
fn bad_indirect_mutation_in_if_let_guard2(mut z: &bool) {
275274
match z {
276275
&true => (),
277276
&false if let Some(()) = {
@@ -294,7 +293,7 @@ fn bad_indirect_mutation_in_if_guard3(mut a: &bool) {
294293
}
295294
}
296295

297-
fn bad_indirect_mutation_in_3(mut a: &bool) {
296+
fn bad_indirect_mutation_in_if_let_guard3(mut a: &bool) {
298297
// Same as bad_indirect_mutation_in_if_guard2, but using match ergonomics
299298
match a {
300299
true => (),
@@ -317,7 +316,7 @@ fn bad_indirect_mutation_in_if_guard4(mut b: &bool) {
317316
}
318317
}
319318

320-
fn bad_indirect_mutation_in_4(mut b: &bool) {
319+
fn bad_indirect_mutation_in_if_let_guard4(mut b: &bool) {
321320
match b {
322321
&_ => (),
323322
&_ if let Some(()) = {
@@ -328,4 +327,4 @@ fn bad_indirect_mutation_in_4(mut b: &bool) {
328327
}
329328
}
330329

331-
fn main() {}
330+
fn main() {}

tests/ui/nll/match-guards-partially-borrow.stderr

Lines changed: 18 additions & 18 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:99:13
2+
--> $DIR/match-guards-partially-borrow.rs:98: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 `q` in match guard
11-
--> $DIR/match-guards-partially-borrow.rs:110:13
11+
--> $DIR/match-guards-partially-borrow.rs:109:13
1212
|
1313
LL | match q {
1414
| - value is immutable in match guard
@@ -17,7 +17,7 @@ LL | q = true;
1717
| ^^^^^^^^ cannot assign
1818

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

2828
error[E0510]: cannot assign `r` in match guard
29-
--> $DIR/match-guards-partially-borrow.rs:134:13
29+
--> $DIR/match-guards-partially-borrow.rs:133:13
3030
|
3131
LL | match r {
3232
| - value is immutable in match guard
@@ -35,7 +35,7 @@ LL | r = true;
3535
| ^^^^^^^^ cannot assign
3636

3737
error[E0510]: cannot assign `t` in match guard
38-
--> $DIR/match-guards-partially-borrow.rs:171:13
38+
--> $DIR/match-guards-partially-borrow.rs:170:13
3939
|
4040
LL | match t {
4141
| - value is immutable in match guard
@@ -44,7 +44,7 @@ LL | t = true;
4444
| ^^^^^^^^ cannot assign
4545

4646
error[E0510]: cannot assign `t` in match guard
47-
--> $DIR/match-guards-partially-borrow.rs:182:13
47+
--> $DIR/match-guards-partially-borrow.rs:181:13
4848
|
4949
LL | match t {
5050
| - value is immutable in match guard
@@ -53,7 +53,7 @@ LL | t = true;
5353
| ^^^^^^^^ cannot assign
5454

5555
error[E0510]: cannot mutably borrow `x.0` in match guard
56-
--> $DIR/match-guards-partially-borrow.rs:196:22
56+
--> $DIR/match-guards-partially-borrow.rs:195:22
5757
|
5858
LL | match x {
5959
| - value is immutable in match guard
@@ -62,7 +62,7 @@ LL | Some(ref mut r) => *r = None,
6262
| ^^^^^^^^^ cannot mutably borrow
6363

6464
error[E0510]: cannot mutably borrow `x.0` in match guard
65-
--> $DIR/match-guards-partially-borrow.rs:212:22
65+
--> $DIR/match-guards-partially-borrow.rs:211:22
6666
|
6767
LL | match x {
6868
| - value is immutable in match guard
@@ -71,7 +71,7 @@ LL | Some(ref mut r) => *r = None,
7171
| ^^^^^^^^^ cannot mutably borrow
7272

7373
error[E0506]: cannot assign to `t` because it is borrowed
74-
--> $DIR/match-guards-partially-borrow.rs:224:13
74+
--> $DIR/match-guards-partially-borrow.rs:223:13
7575
|
7676
LL | s if {
7777
| - `t` is borrowed here
@@ -82,7 +82,7 @@ LL | } => (), // What value should `s` have in the arm?
8282
| - borrow later used here
8383

8484
error[E0506]: cannot assign to `t` because it is borrowed
85-
--> $DIR/match-guards-partially-borrow.rs:234:13
85+
--> $DIR/match-guards-partially-borrow.rs:233:13
8686
|
8787
LL | s if let Some(()) = {
8888
| - `t` is borrowed here
@@ -93,7 +93,7 @@ LL | } => (), // What value should `s` have in the arm?
9393
| - borrow later used here
9494

9595
error[E0510]: cannot assign `y` in match guard
96-
--> $DIR/match-guards-partially-borrow.rs:245:13
96+
--> $DIR/match-guards-partially-borrow.rs:244:13
9797
|
9898
LL | match *y {
9999
| -- value is immutable in match guard
@@ -102,7 +102,7 @@ LL | y = &true;
102102
| ^^^^^^^^^ cannot assign
103103

104104
error[E0510]: cannot assign `y` in match guard
105-
--> $DIR/match-guards-partially-borrow.rs:256:13
105+
--> $DIR/match-guards-partially-borrow.rs:255:13
106106
|
107107
LL | match *y {
108108
| -- value is immutable in match guard
@@ -111,7 +111,7 @@ LL | y = &true;
111111
| ^^^^^^^^^ cannot assign
112112

113113
error[E0510]: cannot assign `z` in match guard
114-
--> $DIR/match-guards-partially-borrow.rs:267:13
114+
--> $DIR/match-guards-partially-borrow.rs:266:13
115115
|
116116
LL | match z {
117117
| - value is immutable in match guard
@@ -120,7 +120,7 @@ LL | z = &true;
120120
| ^^^^^^^^^ cannot assign
121121

122122
error[E0510]: cannot assign `z` in match guard
123-
--> $DIR/match-guards-partially-borrow.rs:278:13
123+
--> $DIR/match-guards-partially-borrow.rs:277:13
124124
|
125125
LL | match z {
126126
| - value is immutable in match guard
@@ -129,7 +129,7 @@ LL | z = &true;
129129
| ^^^^^^^^^ cannot assign
130130

131131
error[E0510]: cannot assign `a` in match guard
132-
--> $DIR/match-guards-partially-borrow.rs:290:13
132+
--> $DIR/match-guards-partially-borrow.rs:289:13
133133
|
134134
LL | match a {
135135
| - value is immutable in match guard
@@ -138,7 +138,7 @@ LL | a = &true;
138138
| ^^^^^^^^^ cannot assign
139139

140140
error[E0510]: cannot assign `a` in match guard
141-
--> $DIR/match-guards-partially-borrow.rs:302:13
141+
--> $DIR/match-guards-partially-borrow.rs:301:13
142142
|
143143
LL | match a {
144144
| - value is immutable in match guard
@@ -147,7 +147,7 @@ LL | a = &true;
147147
| ^^^^^^^^^ cannot assign
148148

149149
error[E0510]: cannot assign `b` in match guard
150-
--> $DIR/match-guards-partially-borrow.rs:313:13
150+
--> $DIR/match-guards-partially-borrow.rs:312:13
151151
|
152152
LL | match b {
153153
| - value is immutable in match guard
@@ -156,7 +156,7 @@ LL | b = &true;
156156
| ^^^^^^^^^ cannot assign
157157

158158
error[E0510]: cannot assign `b` in match guard
159-
--> $DIR/match-guards-partially-borrow.rs:324:13
159+
--> $DIR/match-guards-partially-borrow.rs:323:13
160160
|
161161
LL | match b {
162162
| - value is immutable in match guard

0 commit comments

Comments
 (0)