about summary refs log tree commit diff
path: root/compiler/rustc_parse/src/parser/pat.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2025-02-16 01:29:09 +0000
committerbors <bors@rust-lang.org>2025-02-16 01:29:09 +0000
commit500a686ba8bb1b51df7e7f8f81d286b2e20209ff (patch)
treea7d6969c682059d906e33ff189816feb67e0b413 /compiler/rustc_parse/src/parser/pat.rs
parente72df78268bafbfe28366aa0e382713f55a491e7 (diff)
parentb3d5a770f696460c3eb513e1804a59dbb04641d9 (diff)
downloadrust-500a686ba8bb1b51df7e7f8f81d286b2e20209ff.tar.gz
rust-500a686ba8bb1b51df7e7f8f81d286b2e20209ff.zip
Auto merge of #137093 - matthiaskrgr:rollup-72j7mut, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #127581 (Fix crate name validation)
 - #136490 (Do not allow attributes on struct field rest patterns)
 - #136808 (Try to recover from path sep error in type parsing)
 - #137055 (rustdoc: Properly restore search input placeholder)
 - #137068 (fix(rustdoc): Fixed `Copy Item Path` in rust doc)
 - #137070 (Do not generate invalid links in job summaries)
 - #137074 (compiletest: add `{ignore,only}-rustc_abi-x86-sse2` directives)
 - #137076 (triagebot.toml: ping me on changes to `tests/rustdoc-json`)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_parse/src/parser/pat.rs')
-rw-r--r--compiler/rustc_parse/src/parser/pat.rs22
1 files changed, 11 insertions, 11 deletions
diff --git a/compiler/rustc_parse/src/parser/pat.rs b/compiler/rustc_parse/src/parser/pat.rs
index 64bcb1a5a36..8ce749ec814 100644
--- a/compiler/rustc_parse/src/parser/pat.rs
+++ b/compiler/rustc_parse/src/parser/pat.rs
@@ -1472,17 +1472,6 @@ impl<'a> Parser<'a> {
         let mut last_non_comma_dotdot_span = None;
 
         while self.token != token::CloseDelim(Delimiter::Brace) {
-            let attrs = match self.parse_outer_attributes() {
-                Ok(attrs) => attrs,
-                Err(err) => {
-                    if let Some(delayed) = delayed_err {
-                        delayed.emit();
-                    }
-                    return Err(err);
-                }
-            };
-            let lo = self.token.span;
-
             // check that a comma comes after every field
             if !ate_comma {
                 let err = if self.token == token::At {
@@ -1585,6 +1574,17 @@ impl<'a> Parser<'a> {
                 }
             }
 
+            let attrs = match self.parse_outer_attributes() {
+                Ok(attrs) => attrs,
+                Err(err) => {
+                    if let Some(delayed) = delayed_err {
+                        delayed.emit();
+                    }
+                    return Err(err);
+                }
+            };
+            let lo = self.token.span;
+
             let field = self.collect_tokens(None, attrs, ForceCollect::No, |this, attrs| {
                 let field = match this.parse_pat_field(lo, attrs) {
                     Ok(field) => Ok(field),