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> {
303303 None
304304 } ;
305305 if let Some ( attr) = attr {
306- let end_pos = self . num_bump_calls ;
307306 // If we are currently capturing tokens, mark the location of this inner attribute.
308307 // If capturing ends up creating a `LazyAttrTokenStream`, we will include
309308 // this replace range with it, removing the inner attribute from the final
310309 // `AttrTokenStream`. Inner attributes are stored in the parsed AST note.
311310 // During macro expansion, they are selectively inserted back into the
312311 // token stream (the first inner attribute is removed each time we invoke the
313312 // corresponding macro).
314- let range = start_pos..end_pos;
315313 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) ;
317317 }
318318 attrs. push ( attr) ;
319319 } else {
Original file line number Diff line number Diff line change @@ -260,7 +260,7 @@ impl<'a> Parser<'a> {
260260 // Take the captured ranges for any inner attributes that we parsed.
261261 for inner_attr in ret. attrs ( ) . iter ( ) . filter ( |a| a. style == ast:: AttrStyle :: Inner ) {
262262 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 ) ) ;
264264 } else {
265265 self . dcx ( ) . span_delayed_bug ( inner_attr. span , "Missing token range for attribute" ) ;
266266 }
Original file line number Diff line number Diff line change @@ -225,7 +225,7 @@ enum Capturing {
225225struct CaptureState {
226226 capturing : Capturing ,
227227 replace_ranges : Vec < ReplaceRange > ,
228- inner_attr_ranges : FxHashMap < AttrId , ReplaceRange > ,
228+ inner_attr_ranges : FxHashMap < AttrId , Range < u32 > > ,
229229}
230230
231231/// 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