about summary refs log tree commit diff
path: root/compiler/rustc_parse/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-12-27 15:44:53 +0000
committerbors <bors@rust-lang.org>2022-12-27 15:44:53 +0000
commitdb7962532610cfbfb9be17e8d6c1b48acf5ed184 (patch)
treeaed378c750c8a930e823b93e31975135f02abfba /compiler/rustc_parse/src
parentb38a6d373cb254697411147c0e49cd2e84864258 (diff)
parentb7657e9cecaf46128702c5a221c3a84fd6e7cae6 (diff)
downloadrust-db7962532610cfbfb9be17e8d6c1b48acf5ed184.tar.gz
rust-db7962532610cfbfb9be17e8d6c1b48acf5ed184.zip
Auto merge of #106183 - matthiaskrgr:rollup-ww6yzhi, r=matthiaskrgr
Rollup of 3 pull requests

Successful merges:

 - #105817 (Remove unreasonable help message for auto trait)
 - #105994 (Add regression test for #99647)
 - #106066 (Always suggest as `MachineApplicable` in `recover_intersection_pat`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_parse/src')
-rw-r--r--compiler/rustc_parse/src/parser/pat.rs18
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)`.