Use reparsed TokenStream
if we captured any inner attributes
Fixes #78675 We now bail out of `prepend_attrs` if we ended up capturing any inner attributes (which can happen in several places, due to token capturing for `macro_rules!` arguments.
This commit is contained in:
parent
499ebcfdf3
commit
22383b32b8
4 changed files with 132 additions and 29 deletions
|
@ -611,11 +611,11 @@ fn prepend_attrs(
|
|||
}
|
||||
let mut builder = tokenstream::TokenStreamBuilder::new();
|
||||
for attr in attrs {
|
||||
assert_eq!(
|
||||
attr.style,
|
||||
ast::AttrStyle::Outer,
|
||||
"inner attributes should prevent cached tokens from existing"
|
||||
);
|
||||
// FIXME: Correctly handle tokens for inner attributes.
|
||||
// For now, we fall back to reparsing the original AST node
|
||||
if attr.style == ast::AttrStyle::Inner {
|
||||
return None;
|
||||
}
|
||||
builder.push(
|
||||
attr.tokens
|
||||
.as_ref()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue