diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2022-12-27 16:37:48 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-12-27 16:37:48 +0100 |
| commit | b7657e9cecaf46128702c5a221c3a84fd6e7cae6 (patch) | |
| tree | b8df1df6806743449140c9966f285e3c166d00cd /compiler/rustc_parse/src/parser | |
| parent | d5b975cb7c227b5eec4a83c4651d1225f479c230 (diff) | |
| parent | 668d9fd7bc5094a5df76adde70d5947cb6705281 (diff) | |
| download | rust-b7657e9cecaf46128702c5a221c3a84fd6e7cae6.tar.gz rust-b7657e9cecaf46128702c5a221c3a84fd6e7cae6.zip | |
Rollup merge of #106066 - JohnTitor:rm-bindings-after-at-fixme, r=compiler-errors
Always suggest as `MachineApplicable` in `recover_intersection_pat` This resolves one FIXME in `recover_intersection_pat` by always applying `MachineApplicable` when suggesting, as `bindings_after_at` is now stable. This also separates a test to apply `// run-rustfix`. Signed-off-by: Yuki Okushi <jtitor@2k36.org>
Diffstat (limited to 'compiler/rustc_parse/src/parser')
| -rw-r--r-- | compiler/rustc_parse/src/parser/pat.rs | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/compiler/rustc_parse/src/parser/pat.rs b/compiler/rustc_parse/src/parser/pat.rs index a1981e11477..0b057f2f577 100644 --- a/compiler/rustc_parse/src/parser/pat.rs +++ b/compiler/rustc_parse/src/parser/pat.rs @@ -491,17 +491,6 @@ impl<'a> Parser<'a> { if let PatKind::Ident(_, _, sub @ None) = &mut rhs.kind { // The user inverted the order, so help them fix that. - let mut applicability = Applicability::MachineApplicable; - // FIXME(bindings_after_at): Remove this code when stabilizing the feature. - lhs.walk(&mut |p| match p.kind { - // `check_match` is unhappy if the subpattern has a binding anywhere. - PatKind::Ident(..) => { - applicability = Applicability::MaybeIncorrect; - false // Short-circuit. - } - _ => true, - }); - let lhs_span = lhs.span; // Move the LHS into the RHS as a subpattern. // The RHS is now the full pattern. @@ -510,7 +499,12 @@ impl<'a> Parser<'a> { self.struct_span_err(sp, "pattern on wrong side of `@`") .span_label(lhs_span, "pattern on the left, should be on the right") .span_label(rhs.span, "binding on the right, should be on the left") - .span_suggestion(sp, "switch the order", pprust::pat_to_string(&rhs), applicability) + .span_suggestion( + sp, + "switch the order", + pprust::pat_to_string(&rhs), + Applicability::MachineApplicable, + ) .emit(); } else { // The special case above doesn't apply so we may have e.g. `A(x) @ B(y)`. |
