Skip to content

Commit 4651c8d

Browse files
authored
Rollup merge of #95314 - c410-f3r:aqui-vamos-nos, r=lcnr
Tell users that `||` operators are not currently supported in let chain expressions Tells that `||` operators are not currently supported instead of not allowed. See #53667 (comment) In other words, this PR is pretty much trivial.
2 parents ae037a8 + 9e0b7c3 commit 4651c8d

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

compiler/rustc_ast_passes/src/ast_validation.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,10 @@ impl<'a> AstValidator<'a> {
122122
diag.note("only supported directly in conditions of `if` and `while` expressions");
123123
diag.note("as well as when nested within `&&` and parentheses in those conditions");
124124
if let ForbiddenLetReason::ForbiddenWithOr(span) = forbidden_let_reason {
125-
diag.span_note(span, "`||` operators are not allowed in let chain expressions");
125+
diag.span_note(
126+
span,
127+
"`||` operators are not currently supported in let chain expressions",
128+
);
126129
}
127130
diag.emit();
128131
} else {

src/test/ui/rfc-2497-if-let-chains/disallowed-positions.stderr

+11-11
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ LL | if true || let 0 = 0 {}
6262
|
6363
= note: only supported directly in conditions of `if` and `while` expressions
6464
= note: as well as when nested within `&&` and parentheses in those conditions
65-
note: `||` operators are not allowed in let chain expressions
65+
note: `||` operators are not currently supported in let chain expressions
6666
--> $DIR/disallowed-positions.rs:47:13
6767
|
6868
LL | if true || let 0 = 0 {}
@@ -76,7 +76,7 @@ LL | if (true || let 0 = 0) {}
7676
|
7777
= note: only supported directly in conditions of `if` and `while` expressions
7878
= note: as well as when nested within `&&` and parentheses in those conditions
79-
note: `||` operators are not allowed in let chain expressions
79+
note: `||` operators are not currently supported in let chain expressions
8080
--> $DIR/disallowed-positions.rs:48:14
8181
|
8282
LL | if (true || let 0 = 0) {}
@@ -90,7 +90,7 @@ LL | if true && (true || let 0 = 0) {}
9090
|
9191
= note: only supported directly in conditions of `if` and `while` expressions
9292
= note: as well as when nested within `&&` and parentheses in those conditions
93-
note: `||` operators are not allowed in let chain expressions
93+
note: `||` operators are not currently supported in let chain expressions
9494
--> $DIR/disallowed-positions.rs:49:22
9595
|
9696
LL | if true && (true || let 0 = 0) {}
@@ -104,7 +104,7 @@ LL | if true || (true && let 0 = 0) {}
104104
|
105105
= note: only supported directly in conditions of `if` and `while` expressions
106106
= note: as well as when nested within `&&` and parentheses in those conditions
107-
note: `||` operators are not allowed in let chain expressions
107+
note: `||` operators are not currently supported in let chain expressions
108108
--> $DIR/disallowed-positions.rs:50:13
109109
|
110110
LL | if true || (true && let 0 = 0) {}
@@ -244,7 +244,7 @@ LL | while true || let 0 = 0 {}
244244
|
245245
= note: only supported directly in conditions of `if` and `while` expressions
246246
= note: as well as when nested within `&&` and parentheses in those conditions
247-
note: `||` operators are not allowed in let chain expressions
247+
note: `||` operators are not currently supported in let chain expressions
248248
--> $DIR/disallowed-positions.rs:111:16
249249
|
250250
LL | while true || let 0 = 0 {}
@@ -258,7 +258,7 @@ LL | while (true || let 0 = 0) {}
258258
|
259259
= note: only supported directly in conditions of `if` and `while` expressions
260260
= note: as well as when nested within `&&` and parentheses in those conditions
261-
note: `||` operators are not allowed in let chain expressions
261+
note: `||` operators are not currently supported in let chain expressions
262262
--> $DIR/disallowed-positions.rs:112:17
263263
|
264264
LL | while (true || let 0 = 0) {}
@@ -272,7 +272,7 @@ LL | while true && (true || let 0 = 0) {}
272272
|
273273
= note: only supported directly in conditions of `if` and `while` expressions
274274
= note: as well as when nested within `&&` and parentheses in those conditions
275-
note: `||` operators are not allowed in let chain expressions
275+
note: `||` operators are not currently supported in let chain expressions
276276
--> $DIR/disallowed-positions.rs:113:25
277277
|
278278
LL | while true && (true || let 0 = 0) {}
@@ -286,7 +286,7 @@ LL | while true || (true && let 0 = 0) {}
286286
|
287287
= note: only supported directly in conditions of `if` and `while` expressions
288288
= note: as well as when nested within `&&` and parentheses in those conditions
289-
note: `||` operators are not allowed in let chain expressions
289+
note: `||` operators are not currently supported in let chain expressions
290290
--> $DIR/disallowed-positions.rs:114:16
291291
|
292292
LL | while true || (true && let 0 = 0) {}
@@ -426,7 +426,7 @@ LL | true || let 0 = 0;
426426
|
427427
= note: only supported directly in conditions of `if` and `while` expressions
428428
= note: as well as when nested within `&&` and parentheses in those conditions
429-
note: `||` operators are not allowed in let chain expressions
429+
note: `||` operators are not currently supported in let chain expressions
430430
--> $DIR/disallowed-positions.rs:184:10
431431
|
432432
LL | true || let 0 = 0;
@@ -440,7 +440,7 @@ LL | (true || let 0 = 0);
440440
|
441441
= note: only supported directly in conditions of `if` and `while` expressions
442442
= note: as well as when nested within `&&` and parentheses in those conditions
443-
note: `||` operators are not allowed in let chain expressions
443+
note: `||` operators are not currently supported in let chain expressions
444444
--> $DIR/disallowed-positions.rs:185:11
445445
|
446446
LL | (true || let 0 = 0);
@@ -454,7 +454,7 @@ LL | true && (true || let 0 = 0);
454454
|
455455
= note: only supported directly in conditions of `if` and `while` expressions
456456
= note: as well as when nested within `&&` and parentheses in those conditions
457-
note: `||` operators are not allowed in let chain expressions
457+
note: `||` operators are not currently supported in let chain expressions
458458
--> $DIR/disallowed-positions.rs:186:19
459459
|
460460
LL | true && (true || let 0 = 0);

0 commit comments

Comments
 (0)