Skip to content

Commit 7333e7e

Browse files
committed
removed some feature gates for let_chains and reverted function names
1 parent f27980b commit 7333e7e

File tree

5 files changed

+32
-37
lines changed

5 files changed

+32
-37
lines changed

tests/ui/mir/mir_match_guard_let_chains_drop_order.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
// See `mir_drop_order.rs` for more information
88

9-
#![cfg_attr(edition2021, feature(let_chains))]
109
#![allow(irrefutable_let_patterns)]
1110

1211
use std::cell::RefCell;

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

Lines changed: 14 additions & 15 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
@@ -14,7 +13,7 @@ fn ok_mutation_in_if_guard(mut q: i32) {
1413
}
1514
}
1615

17-
fn ok_mutation_in_(mut q: i32) {
16+
fn ok_mutation_in_if_let_guard(mut q: i32) {
1817
match q {
1918
// OK, mutation doesn't change which patterns g matches
2019
_ if let Some(()) = { q = 1; None } => (),
@@ -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
_ => (),
@@ -81,7 +80,7 @@ fn ok_indirect_mutation_in_if_guard(mut p: &bool) {
8180
}
8281
}
8382

84-
fn ok_indirect_mutation_in_(mut p: &bool) {
83+
fn ok_indirect_mutation_in_if_let_guard(mut p: &bool) {
8584
match *p {
8685
// OK, mutation doesn't change which patterns s matches
8786
_ if let Some(()) = {
@@ -103,7 +102,7 @@ fn mutation_invalidates_pattern_in_if_guard(mut q: bool) {
103102
}
104103
}
105104

106-
fn mutation_invalidates_pattern_in_(mut q: bool) {
105+
fn mutation_invalidates_pattern_in_if_let_guard(mut q: bool) {
107106
match q {
108107
// q doesn't match the pattern with the guard by the end of the guard.
109108
false if let Some(()) = {
@@ -126,7 +125,7 @@ fn mutation_invalidates_previous_pattern_in_if_guard(mut r: bool) {
126125
}
127126
}
128127

129-
fn mutation_invalidates_previous_pattern_in_(mut r: bool) {
128+
fn mutation_invalidates_previous_pattern_in_if_let_guard(mut r: bool) {
130129
match r {
131130
// r matches a previous pattern by the end of the guard.
132131
true => (),
@@ -151,7 +150,7 @@ fn match_on_borrowed_early_end_if_guard(mut s: bool) {
151150
}
152151
}
153152

154-
fn match_on_borrowed_early_end_(mut s: bool) {
153+
fn match_on_borrowed_early_end_if_let_guard(mut s: bool) {
155154
let h = &mut s;
156155
// OK value of s is unused before modification.
157156
match s {
@@ -175,7 +174,7 @@ fn bad_mutation_in_if_guard(mut t: bool) {
175174
}
176175
}
177176

178-
fn bad_mutation_in_(mut t: bool) {
177+
fn bad_mutation_in_if_let_guard(mut t: bool) {
179178
match t {
180179
true => (),
181180
false if let Some(()) = {
@@ -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
@@ -249,7 +248,7 @@ fn bad_indirect_mutation_in_if_guard(mut y: &bool) {
249248
}
250249
}
251250

252-
fn bad_indirect_mutation_in_(mut y: &bool) {
251+
fn bad_indirect_mutation_in_if_let_guard(mut y: &bool) {
253252
match *y {
254253
true => (),
255254
false if let Some(()) = {
@@ -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(()) = {

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

tests/ui/rfcs/rfc-2294-if-let-guard/shadowing.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
//@[edition2021] edition:2021
66
//@[edition2024] edition:2024
77

8-
#![cfg_attr(edition2021, feature(let_chains))]
9-
108
fn main() {
119
let x: Option<Option<i32>> = Some(Some(6));
1210
match x {

tests/ui/rfcs/rfc-2294-if-let-guard/temporary-early-drop.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
//@ check-pass
66

77
#![allow(irrefutable_let_patterns)]
8-
#![cfg_attr(edition2021, feature(let_chains))]
98

109
struct Pd;
1110

0 commit comments

Comments
 (0)