Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tell users that || operators are not currently supported in let chain expressions #95314

Merged
merged 1 commit into from
Mar 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion compiler/rustc_ast_passes/src/ast_validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,10 @@ impl<'a> AstValidator<'a> {
diag.note("only supported directly in conditions of `if` and `while` expressions");
diag.note("as well as when nested within `&&` and parentheses in those conditions");
if let ForbiddenLetReason::ForbiddenWithOr(span) = forbidden_let_reason {
diag.span_note(span, "`||` operators are not allowed in let chain expressions");
diag.span_note(
span,
"`||` operators are not currently supported in let chain expressions",
);
}
diag.emit();
} else {
Expand Down
22 changes: 11 additions & 11 deletions src/test/ui/rfc-2497-if-let-chains/disallowed-positions.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ LL | if true || let 0 = 0 {}
|
= note: only supported directly in conditions of `if` and `while` expressions
= note: as well as when nested within `&&` and parentheses in those conditions
note: `||` operators are not allowed in let chain expressions
note: `||` operators are not currently supported in let chain expressions
--> $DIR/disallowed-positions.rs:47:13
|
LL | if true || let 0 = 0 {}
Expand All @@ -76,7 +76,7 @@ LL | if (true || let 0 = 0) {}
|
= note: only supported directly in conditions of `if` and `while` expressions
= note: as well as when nested within `&&` and parentheses in those conditions
note: `||` operators are not allowed in let chain expressions
note: `||` operators are not currently supported in let chain expressions
--> $DIR/disallowed-positions.rs:48:14
|
LL | if (true || let 0 = 0) {}
Expand All @@ -90,7 +90,7 @@ LL | if true && (true || let 0 = 0) {}
|
= note: only supported directly in conditions of `if` and `while` expressions
= note: as well as when nested within `&&` and parentheses in those conditions
note: `||` operators are not allowed in let chain expressions
note: `||` operators are not currently supported in let chain expressions
--> $DIR/disallowed-positions.rs:49:22
|
LL | if true && (true || let 0 = 0) {}
Expand All @@ -104,7 +104,7 @@ LL | if true || (true && let 0 = 0) {}
|
= note: only supported directly in conditions of `if` and `while` expressions
= note: as well as when nested within `&&` and parentheses in those conditions
note: `||` operators are not allowed in let chain expressions
note: `||` operators are not currently supported in let chain expressions
--> $DIR/disallowed-positions.rs:50:13
|
LL | if true || (true && let 0 = 0) {}
Expand Down Expand Up @@ -244,7 +244,7 @@ LL | while true || let 0 = 0 {}
|
= note: only supported directly in conditions of `if` and `while` expressions
= note: as well as when nested within `&&` and parentheses in those conditions
note: `||` operators are not allowed in let chain expressions
note: `||` operators are not currently supported in let chain expressions
--> $DIR/disallowed-positions.rs:111:16
|
LL | while true || let 0 = 0 {}
Expand All @@ -258,7 +258,7 @@ LL | while (true || let 0 = 0) {}
|
= note: only supported directly in conditions of `if` and `while` expressions
= note: as well as when nested within `&&` and parentheses in those conditions
note: `||` operators are not allowed in let chain expressions
note: `||` operators are not currently supported in let chain expressions
--> $DIR/disallowed-positions.rs:112:17
|
LL | while (true || let 0 = 0) {}
Expand All @@ -272,7 +272,7 @@ LL | while true && (true || let 0 = 0) {}
|
= note: only supported directly in conditions of `if` and `while` expressions
= note: as well as when nested within `&&` and parentheses in those conditions
note: `||` operators are not allowed in let chain expressions
note: `||` operators are not currently supported in let chain expressions
--> $DIR/disallowed-positions.rs:113:25
|
LL | while true && (true || let 0 = 0) {}
Expand All @@ -286,7 +286,7 @@ LL | while true || (true && let 0 = 0) {}
|
= note: only supported directly in conditions of `if` and `while` expressions
= note: as well as when nested within `&&` and parentheses in those conditions
note: `||` operators are not allowed in let chain expressions
note: `||` operators are not currently supported in let chain expressions
--> $DIR/disallowed-positions.rs:114:16
|
LL | while true || (true && let 0 = 0) {}
Expand Down Expand Up @@ -426,7 +426,7 @@ LL | true || let 0 = 0;
|
= note: only supported directly in conditions of `if` and `while` expressions
= note: as well as when nested within `&&` and parentheses in those conditions
note: `||` operators are not allowed in let chain expressions
note: `||` operators are not currently supported in let chain expressions
--> $DIR/disallowed-positions.rs:184:10
|
LL | true || let 0 = 0;
Expand All @@ -440,7 +440,7 @@ LL | (true || let 0 = 0);
|
= note: only supported directly in conditions of `if` and `while` expressions
= note: as well as when nested within `&&` and parentheses in those conditions
note: `||` operators are not allowed in let chain expressions
note: `||` operators are not currently supported in let chain expressions
--> $DIR/disallowed-positions.rs:185:11
|
LL | (true || let 0 = 0);
Expand All @@ -454,7 +454,7 @@ LL | true && (true || let 0 = 0);
|
= note: only supported directly in conditions of `if` and `while` expressions
= note: as well as when nested within `&&` and parentheses in those conditions
note: `||` operators are not allowed in let chain expressions
note: `||` operators are not currently supported in let chain expressions
--> $DIR/disallowed-positions.rs:186:19
|
LL | true && (true || let 0 = 0);
Expand Down