This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +5
-5
lines changed
compiler/rustc_parse/src/parser Expand file tree Collapse file tree 3 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -303,17 +303,17 @@ impl<'a> Parser<'a> {
303
303
None
304
304
} ;
305
305
if let Some ( attr) = attr {
306
- let end_pos = self . num_bump_calls ;
307
306
// If we are currently capturing tokens, mark the location of this inner attribute.
308
307
// If capturing ends up creating a `LazyAttrTokenStream`, we will include
309
308
// this replace range with it, removing the inner attribute from the final
310
309
// `AttrTokenStream`. Inner attributes are stored in the parsed AST note.
311
310
// During macro expansion, they are selectively inserted back into the
312
311
// token stream (the first inner attribute is removed each time we invoke the
313
312
// corresponding macro).
314
- let range = start_pos..end_pos;
315
313
if let Capturing :: Yes = self . capture_state . capturing {
316
- self . capture_state . inner_attr_ranges . insert ( attr. id , ( range, None ) ) ;
314
+ let end_pos = self . num_bump_calls ;
315
+ let range = start_pos..end_pos;
316
+ self . capture_state . inner_attr_ranges . insert ( attr. id , range) ;
317
317
}
318
318
attrs. push ( attr) ;
319
319
} else {
Original file line number Diff line number Diff line change @@ -260,7 +260,7 @@ impl<'a> Parser<'a> {
260
260
// Take the captured ranges for any inner attributes that we parsed.
261
261
for inner_attr in ret. attrs ( ) . iter ( ) . filter ( |a| a. style == ast:: AttrStyle :: Inner ) {
262
262
if let Some ( attr_range) = self . capture_state . inner_attr_ranges . remove ( & inner_attr. id ) {
263
- inner_attr_replace_ranges. push ( attr_range) ;
263
+ inner_attr_replace_ranges. push ( ( attr_range, None ) ) ;
264
264
} else {
265
265
self . dcx ( ) . span_delayed_bug ( inner_attr. span , "Missing token range for attribute" ) ;
266
266
}
Original file line number Diff line number Diff line change @@ -225,7 +225,7 @@ enum Capturing {
225
225
struct CaptureState {
226
226
capturing : Capturing ,
227
227
replace_ranges : Vec < ReplaceRange > ,
228
- inner_attr_ranges : FxHashMap < AttrId , ReplaceRange > ,
228
+ inner_attr_ranges : FxHashMap < AttrId , Range < u32 > > ,
229
229
}
230
230
231
231
/// Iterator over a `TokenStream` that produces `Token`s. It's a bit odd that
You can’t perform that action at this time.
0 commit comments