@@ -313,23 +313,21 @@ impl<'a> Parser<'a> {
313
313
* target_tokens = Some ( tokens. clone ( ) ) ;
314
314
}
315
315
316
- let final_attrs = ret. attrs ( ) ;
317
-
318
316
// If `capture_cfg` is set and we're inside a recursive call to
319
317
// `collect_tokens_trailing_token`, then we need to register a replace range
320
318
// if we have `#[cfg]` or `#[cfg_attr]`. This allows us to run eager cfg-expansion
321
319
// on the captured token stream.
322
320
if self . capture_cfg
323
321
&& matches ! ( self . capture_state. capturing, Capturing :: Yes )
324
- && has_cfg_or_cfg_attr ( final_attrs )
322
+ && has_cfg_or_cfg_attr ( ret . attrs ( ) )
325
323
{
326
324
assert ! ( !self . break_last_token, "Should not have unglued last token with cfg attr" ) ;
327
325
328
326
// Replace the entire AST node that we just parsed, including attributes, with
329
327
// `target`. If this AST node is inside an item that has `#[derive]`, then this will
330
328
// allow us to cfg-expand this AST node.
331
329
let start_pos = if has_outer_attrs { attrs. start_pos } else { start_pos } ;
332
- let target = AttrsTarget { attrs : final_attrs . iter ( ) . cloned ( ) . collect ( ) , tokens } ;
330
+ let target = AttrsTarget { attrs : ret . attrs ( ) . iter ( ) . cloned ( ) . collect ( ) , tokens } ;
333
331
self . capture_state . replace_ranges . push ( ( start_pos..end_pos, Some ( target) ) ) ;
334
332
self . capture_state . replace_ranges . extend ( inner_attr_replace_ranges) ;
335
333
} else if matches ! ( self . capture_state. capturing, Capturing :: No ) {
0 commit comments