Skip to content

Commit f9c7ca7

Browse files
committed
Move inner_attr code downwards.
This puts it just before the `replace_ranges` initialization, which makes sense because the two variables are closely related.
1 parent 1f67cf9 commit f9c7ca7

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

compiler/rustc_parse/src/parser/attr_wrapper.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -256,16 +256,6 @@ impl<'a> Parser<'a> {
256256
return Ok(ret);
257257
}
258258

259-
let mut inner_attr_replace_ranges = Vec::new();
260-
// Take the captured ranges for any inner attributes that we parsed.
261-
for inner_attr in ret.attrs().iter().filter(|a| a.style == ast::AttrStyle::Inner) {
262-
if let Some(attr_range) = self.capture_state.inner_attr_ranges.remove(&inner_attr.id) {
263-
inner_attr_replace_ranges.push((attr_range, None));
264-
} else {
265-
self.dcx().span_delayed_bug(inner_attr.span, "Missing token range for attribute");
266-
}
267-
}
268-
269259
let replace_ranges_end = self.capture_state.replace_ranges.len();
270260

271261
assert!(
@@ -283,6 +273,16 @@ impl<'a> Parser<'a> {
283273

284274
let num_calls = end_pos - start_pos;
285275

276+
// Take the captured ranges for any inner attributes that we parsed.
277+
let mut inner_attr_replace_ranges = Vec::new();
278+
for inner_attr in ret.attrs().iter().filter(|a| a.style == ast::AttrStyle::Inner) {
279+
if let Some(attr_range) = self.capture_state.inner_attr_ranges.remove(&inner_attr.id) {
280+
inner_attr_replace_ranges.push((attr_range, None));
281+
} else {
282+
self.dcx().span_delayed_bug(inner_attr.span, "Missing token range for attribute");
283+
}
284+
}
285+
286286
// This is hot enough for `deep-vector` that checking the conditions for an empty iterator
287287
// is measurably faster than actually executing the iterator.
288288
let replace_ranges: Box<[ReplaceRange]> =

0 commit comments

Comments
 (0)