diff options
| author | bors <bors@rust-lang.org> | 2025-08-31 03:00:54 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2025-08-31 03:00:54 +0000 |
| commit | 64a99db105f45ea3304732ffb51066c3b5193bc7 (patch) | |
| tree | a731ff2123ba6ff288f43d842c9724e38ed6d4cf /compiler/rustc_parse/src/lib.rs | |
| parent | cd60c60d9f6bf13ca96ecde7392327c3caf6f162 (diff) | |
| parent | 3af81cf0b7bd394dac89cbacec303b5937b5519a (diff) | |
| download | rust-64a99db105f45ea3304732ffb51066c3b5193bc7.tar.gz rust-64a99db105f45ea3304732ffb51066c3b5193bc7.zip | |
Auto merge of #145582 - estebank:issue-107806, r=chenyukang
Detect missing `if let` or `let-else`
During `let` binding parse error and encountering a block, detect if there is a likely missing `if` or `else`:
```
error: expected one of `.`, `;`, `?`, `else`, or an operator, found `{`
--> $DIR/missing-if-let-or-let-else.rs:14:25
|
LL | let Some(x) = foo() {
| ^ expected one of `.`, `;`, `?`, `else`, or an operator
|
help: you might have meant to use `if let`
|
LL | if let Some(x) = foo() {
| ++
help: alternatively, you might have meant to use `let else`
|
LL | let Some(x) = foo() else {
| ++++
```
Fix rust-lang/rust#107806.
Diffstat (limited to 'compiler/rustc_parse/src/lib.rs')
| -rw-r--r-- | compiler/rustc_parse/src/lib.rs | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/compiler/rustc_parse/src/lib.rs b/compiler/rustc_parse/src/lib.rs index 48289b2e8ab..197333d942d 100644 --- a/compiler/rustc_parse/src/lib.rs +++ b/compiler/rustc_parse/src/lib.rs @@ -6,6 +6,7 @@ #![feature(assert_matches)] #![feature(box_patterns)] #![feature(debug_closure_helpers)] +#![feature(default_field_values)] #![feature(if_let_guard)] #![feature(iter_intersperse)] #![recursion_limit = "256"] |
