Attach TokenStream
to ast::Visibility
A `Visibility` does not have outer attributes, so we only capture tokens when parsing a `macro_rules!` matcher
This commit is contained in:
parent
55082ce413
commit
c1011165e6
22 changed files with 120 additions and 50 deletions
|
@ -279,6 +279,7 @@ pub fn nt_to_tokenstream(nt: &Nonterminal, sess: &ParseSess, span: Span) -> Toke
|
|||
}
|
||||
Nonterminal::NtMeta(ref attr) => attr.tokens.clone(),
|
||||
Nonterminal::NtPath(ref path) => path.tokens.clone(),
|
||||
Nonterminal::NtVis(ref vis) => vis.tokens.clone(),
|
||||
Nonterminal::NtTT(ref tt) => Some(tt.clone().into()),
|
||||
Nonterminal::NtExpr(ref expr) | Nonterminal::NtLiteral(ref expr) => {
|
||||
if expr.tokens.is_none() {
|
||||
|
@ -286,7 +287,6 @@ pub fn nt_to_tokenstream(nt: &Nonterminal, sess: &ParseSess, span: Span) -> Toke
|
|||
}
|
||||
prepend_attrs(sess, &expr.attrs, expr.tokens.as_ref(), span)
|
||||
}
|
||||
_ => None,
|
||||
};
|
||||
|
||||
// FIXME(#43081): Avoid this pretty-print + reparse hack
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue