Skip to content
Closed
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
5834772
Update Tests
veera-sivarajan Jul 4, 2024
cf09cba
When finding item gated behind a `cfg` flat, point at it
estebank Jul 12, 2024
2e1e627
rustdoc: fix `current` class on sidebar modnav
notriddle Jul 18, 2024
4cad705
Parser: Suggest Placing the Return Type After Function Parameters
veera-sivarajan Jul 4, 2024
2f5a84e
Don't allow unsafe statics outside of extern blocks
compiler-errors Jul 18, 2024
a87122e
Simplify `CaptureState::inner_attr_ranges`.
nnethercote Jul 12, 2024
9ee82f7
Remove `final_attrs` local variable.
nnethercote Jul 12, 2024
28c7ae7
Move `inner_attr` code downwards.
nnethercote Jul 15, 2024
78bfffa
Make `Parser::num_bump_calls` 0-indexed.
nnethercote Jul 17, 2024
e69ff1c
Remove an unnecessary `ForceCollect::Yes`.
nnethercote Jul 16, 2024
7d7e2a1
Don't always force collect tokens in `recover_stmt_local_after_let`.
nnethercote Jul 16, 2024
9d908a2
Use `ForceCollect` in `parse_attr_item`.
nnethercote Jul 17, 2024
4b20da7
Overhaul comments in `collect_tokens_trailing_token`.
nnethercote Jul 15, 2024
4158a1c
Only check `force_collect` in `collect_tokens_trailing_token`.
nnethercote Jul 17, 2024
0c932b7
Rearrange sidebar modnav builder to more logical order
notriddle Jul 19, 2024
75abd77
Rollup merge of #127350 - veera-sivarajan:bugfix-126311, r=lcnr
matthiaskrgr Jul 19, 2024
8463b38
Rollup merge of #127662 - estebank:gate-span, r=TaKO8Ki
matthiaskrgr Jul 19, 2024
101e581
Rollup merge of #127902 - nnethercote:collect_tokens_trailing_token-c…
matthiaskrgr Jul 19, 2024
492f94e
Rollup merge of #127903 - nnethercote:force_collect-improvements, r=p…
matthiaskrgr Jul 19, 2024
9d2d0af
Rollup merge of #127932 - notriddle:notriddle/current, r=GuillaumeGomez
matthiaskrgr Jul 19, 2024
11d0acc
Rollup merge of #127943 - compiler-errors:no-unsafe, r=spastorino
matthiaskrgr Jul 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Move inner_attr code downwards.
This puts it just before the `replace_ranges` initialization, which
makes sense because the two variables are closely related.
  • Loading branch information
nnethercote committed Jul 18, 2024
commit 28c7ae76e941776c280f64d7d9eae96abed6bde6
20 changes: 10 additions & 10 deletions compiler/rustc_parse/src/parser/attr_wrapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,16 +256,6 @@ impl<'a> Parser<'a> {
return Ok(ret);
}

let mut inner_attr_replace_ranges = Vec::new();
// Take the captured ranges for any inner attributes that we parsed.
for inner_attr in ret.attrs().iter().filter(|a| a.style == ast::AttrStyle::Inner) {
if let Some(attr_range) = self.capture_state.inner_attr_ranges.remove(&inner_attr.id) {
inner_attr_replace_ranges.push((attr_range, None));
} else {
self.dcx().span_delayed_bug(inner_attr.span, "Missing token range for attribute");
}
}

let replace_ranges_end = self.capture_state.replace_ranges.len();

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

let num_calls = end_pos - start_pos;

// Take the captured ranges for any inner attributes that we parsed.
let mut inner_attr_replace_ranges = Vec::new();
for inner_attr in ret.attrs().iter().filter(|a| a.style == ast::AttrStyle::Inner) {
if let Some(attr_range) = self.capture_state.inner_attr_ranges.remove(&inner_attr.id) {
inner_attr_replace_ranges.push((attr_range, None));
} else {
self.dcx().span_delayed_bug(inner_attr.span, "Missing token range for attribute");
}
}

// This is hot enough for `deep-vector` that checking the conditions for an empty iterator
// is measurably faster than actually executing the iterator.
let replace_ranges: Box<[ReplaceRange]> =
Expand Down