mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 23:04:33 +00:00
Remove the T::VISIT_TOKENS
test in visit_mac_args
.
The two paths are equivalent -- they both end up calling `visit_expr()`. I have kept the more restrictive path, the one that requires that `token` be an expression nonterminal. (The next commit will simplify this function further.)
This commit is contained in:
parent
cde25f8dbe
commit
ae5f67f9e8
@ -372,18 +372,14 @@ pub fn visit_mac_args<T: MutVisitor>(args: &mut MacArgs, vis: &mut T) {
|
||||
}
|
||||
MacArgs::Eq(eq_span, token) => {
|
||||
vis.visit_span(eq_span);
|
||||
if T::VISIT_TOKENS {
|
||||
visit_token(token, vis);
|
||||
} else {
|
||||
// The value in `#[key = VALUE]` must be visited as an expression for backward
|
||||
// compatibility, so that macros can be expanded in that position.
|
||||
match &mut token.kind {
|
||||
token::Interpolated(nt) => match Lrc::make_mut(nt) {
|
||||
token::NtExpr(expr) => vis.visit_expr(expr),
|
||||
t => panic!("unexpected token in key-value attribute: {:?}", t),
|
||||
},
|
||||
// The value in `#[key = VALUE]` must be visited as an expression for backward
|
||||
// compatibility, so that macros can be expanded in that position.
|
||||
match &mut token.kind {
|
||||
token::Interpolated(nt) => match Lrc::make_mut(nt) {
|
||||
token::NtExpr(expr) => vis.visit_expr(expr),
|
||||
t => panic!("unexpected token in key-value attribute: {:?}", t),
|
||||
}
|
||||
},
|
||||
t => panic!("unexpected token in key-value attribute: {:?}", t),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user