diff options
| author | Michael Goulet <michael@errs.io> | 2025-03-06 12:22:15 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-03-06 12:22:15 -0500 |
| commit | 34d273b4bf3412794e3f5accf6866b61b17b78cf (patch) | |
| tree | 0caed31a2ea81e6b5c757a25ae1f6bfdebad67a5 /compiler/rustc_attr_parsing/src/parser.rs | |
| parent | 91175bd932ea78cf4ae21bd0f11df3146da93293 (diff) | |
| parent | 41dd80aeaa706c169df62bdf16033b61b914cb87 (diff) | |
| download | rust-34d273b4bf3412794e3f5accf6866b61b17b78cf.tar.gz rust-34d273b4bf3412794e3f5accf6866b61b17b78cf.zip | |
Rollup merge of #137758 - jdonszelmann:fix-137662, r=nnethercote
fix usage of ty decl macro fragments in attributes See the test case. Due to one missing code path (and also the changes in #137517), using $ty or other specific fragments as part of an attr wouldn't work. $tt used to work since it wouldn't be parsed anywhere along the way. Closes #137662
Diffstat (limited to 'compiler/rustc_attr_parsing/src/parser.rs')
| -rw-r--r-- | compiler/rustc_attr_parsing/src/parser.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/compiler/rustc_attr_parsing/src/parser.rs b/compiler/rustc_attr_parsing/src/parser.rs index 96fc9d7d9ac..f0cce26f4e2 100644 --- a/compiler/rustc_attr_parsing/src/parser.rs +++ b/compiler/rustc_attr_parsing/src/parser.rs @@ -473,6 +473,15 @@ impl<'a> MetaItemListParserContext<'a> { { self.inside_delimiters.next(); return Some(MetaItemOrLitParser::Lit(lit)); + } else if let Some(TokenTree::Delimited(.., Delimiter::Invisible(_), inner_tokens)) = + self.inside_delimiters.peek() + { + self.inside_delimiters.next(); + return MetaItemListParserContext { + inside_delimiters: inner_tokens.iter().peekable(), + dcx: self.dcx, + } + .next(); } // or a path. |
