Skip to content

Rollup of 6 pull requests #128230

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 20 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
2a73553
Support ?Trait bounds in supertraits and dyn Trait under a feature gate
Bryanskiy Feb 23, 2024
caee195
Invert early exit conditions in `collect_tokens_trailing_token`.
nnethercote Jul 25, 2024
4288edb
Inline and remove `AttrWrapper::is_complete`.
nnethercote Jul 25, 2024
3d363c3
Move `is_complete` to the module that uses it.
nnethercote Jul 25, 2024
e631b1e
Invert the sense of `is_complete` and rename it as `needs_tokens`.
nnethercote Jul 25, 2024
a560810
Don't include inner attribute ranges in `CaptureState`.
nnethercote Jul 26, 2024
6e87858
Fix a comment.
nnethercote Jul 26, 2024
6ea2da5
Tweak a loop.
nnethercote Jul 26, 2024
55d37ae
Remove an unnecessary block.
nnethercote Jul 26, 2024
984039f
Test RUSTC_OVERRIDE_VERSION_STRING
oli-obk Apr 25, 2024
192671f
Make RUSTC_OVERRIDE_VERSION_STRING overwrite the rendered version out…
oli-obk Apr 25, 2024
33b98bf
Remove redundant option that was just encoding that a slice was empty
oli-obk Jul 26, 2024
114e0dc
CI: do not respect custom try jobs for unrolled perf builds
Kobzol Jul 26, 2024
fd9d0bf
Forbid `?Trait` bounds repetitions
Bryanskiy Jul 26, 2024
a9af0a3
Rollup merge of #121676 - Bryanskiy:polarity, r=petrochenkov
matthiaskrgr Jul 26, 2024
da74d40
Rollup merge of #124339 - oli-obk:supports_feature, r=wesleywiser
matthiaskrgr Jul 26, 2024
64eff24
Rollup merge of #128223 - nnethercote:refactor-collect_tokens, r=petr…
matthiaskrgr Jul 26, 2024
e2eb043
Rollup merge of #128224 - nnethercote:fewer-replace_ranges, r=petroch…
matthiaskrgr Jul 26, 2024
202c765
Rollup merge of #128226 - oli-obk:option_vs_empty_slice, r=petrochenkov
matthiaskrgr Jul 26, 2024
53f0849
Rollup merge of #128227 - Kobzol:ci-unrolled-perf-build-matrix, r=tgr…
matthiaskrgr Jul 26, 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
Don't include inner attribute ranges in CaptureState.
The current code is this:
```
self.capture_state.replace_ranges.push((start_pos..end_pos, Some(target)));
self.capture_state.replace_ranges.extend(inner_attr_replace_ranges);
```
What's not obvious is that every range in `inner_attr_replace_ranges`
must be a strict sub-range of `start_pos..end_pos`. Which means, in
`LazyAttrTokenStreamImpl::to_attr_token_stream`, they will be done
first, and then the `start_pos..end_pos` replacement will just overwrite
them. So they aren't needed.
  • Loading branch information
nnethercote committed Jul 26, 2024
commit a560810a69a09452b4cd0c3173b6af98496dba35
8 changes: 2 additions & 6 deletions compiler/rustc_parse/src/parser/attr_wrapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -337,8 +337,7 @@ impl<'a> Parser<'a> {
// When parsing `m`:
// - `start_pos..end_pos` is `0..34` (`mod m`, excluding the `#[cfg_eval]` attribute).
// - `inner_attr_replace_ranges` is empty.
// - `replace_range_start..replace_ranges_end` has two entries.
// - One to delete the inner attribute (`17..27`), obtained when parsing `g` (see above).
// - `replace_range_start..replace_ranges_end` has one entry.
// - One `AttrsTarget` (added below when parsing `g`) to replace all of `g` (`3..33`,
// including its outer attribute), with:
// - `attrs`: includes the outer and the inner attr.
Expand Down Expand Up @@ -369,12 +368,10 @@ impl<'a> Parser<'a> {

// What is the status here when parsing the example code at the top of this method?
//
// When parsing `g`, we add two entries:
// When parsing `g`, we add one entry:
// - The `start_pos..end_pos` (`3..33`) entry has a new `AttrsTarget` with:
// - `attrs`: includes the outer and the inner attr.
// - `tokens`: lazy tokens for `g` (with its inner attr deleted).
// - `inner_attr_replace_ranges` contains the one entry to delete the inner attr's
// tokens (`17..27`).
//
// When parsing `m`, we do nothing here.

Expand All @@ -384,7 +381,6 @@ impl<'a> Parser<'a> {
let start_pos = if has_outer_attrs { attrs.start_pos } else { start_pos };
let target = AttrsTarget { attrs: ret.attrs().iter().cloned().collect(), tokens };
self.capture_state.replace_ranges.push((start_pos..end_pos, Some(target)));
self.capture_state.replace_ranges.extend(inner_attr_replace_ranges);
} else if matches!(self.capture_state.capturing, Capturing::No) {
// Only clear the ranges once we've finished capturing entirely, i.e. we've finished
// the outermost call to this method.
Expand Down