Skip to content
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

Rollup of 7 pull requests #123029

Merged
merged 17 commits into from Mar 25, 2024
Merged

Rollup of 7 pull requests #123029

merged 17 commits into from Mar 25, 2024

Conversation

matthiaskrgr
Copy link
Member

Successful merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

SkiFire13 and others added 17 commits March 24, 2024 11:27
These headers and flags were historically needed, but are now unnecessary due
to various changes in how coverage information is stored in MIR.
In user-facing Rust, `dyn` always has at least one predicate following
it. Unfortunately, because we filter out marker traits from receivers at
callsites and `dyn Sync` is, for example, legal, this results in us
having `dyn` types with no predicates on occasion in our alias set
encoding. This patch handles cases where there are no predicates in a
`dyn` type which are relevant to its alias set.

Fixes rust-lang#122998
Previously, we only rewrote `&self` and `&mut self` receivers. By
instantiating the method from the trait definition, we can make this
work work with arbitrary legal receivers instead.
I will be on vacation for the next three weeks. I will re-add myself
when I return.
It has a single call site, and afterwards all the calls to
`parse_expr_tuple_field_access` are in a single method, which is nice.
Pass in the span for the field rather than using `prev_token`.
Also rename it `mk_expr_tuple_field_access`, because it doesn't do any
actual parsing, it just creates an expression with what it's given.

Not much of a clarity win by itself, but unlocks additional subsequent
simplifications.
For the `MiddleDot` case, current behaviour:
- For a case like `1.2`, `sym1` is `1` and `sym2` is `2`, and `self.token`
  holds `1.2`.
- It creates a new ident token from `sym1` that it puts into `self.token`.
- Then it does `bump_with` with a new dot token, which moves the `sym1`
  token into `prev_token`.
- Then it does `bump_with` with a new ident token from `sym2`, which moves the
  `dot` token into `prev_token` and discards the `sym1` token.
- Then it does `bump`, which puts whatever is next into `self.token`,
  moves the `sym2` token into `prev_token`, and discards the `dot` token
  altogether.

New behaviour:
- Skips creating and inserting the `sym1` and dot tokens, because they are
  unnecessary.
- This also demonstrates that the comment about `Spacing::Alone` is
  wrong -- that value is never used. That comment was added in rust-lang#77250,
  and AFAICT it has always been incorrect.

The commit also expands comments. I found this code hard to read
previously, the examples in comments make it easier.
…_expr, r=est31

Tweak `parse_dot_suffix_expr`

I find this function hard to understand, so I rewrote it.

r? ```@est31```
…r=onur-ozkan

Add more comments to the bootstrap code that handles `tests/coverage`

At the bootstrap level, coverage tests are a bit more complicated than other test suites, because we want to run the same set of test files in multiple different modes, in a way that's convenient and flexible when invoked manually.

This PR adds a few more comments to explain what's going on.
…pratt

Clarify transmute example

The example claims using an iterator will copy the entire vector, but this is not true in practice thanks to internal specializations in the stdlib (see https://godbolt.org/z/cnxo3MYs5 for confirmation that this doesn't reallocate nor iterate over the vec's elements). Since neither the copy nor the optimization is guaranteed I opted for saying that they _may_ happen.
…ulacrum

Clean up unnecessary headers/flags in coverage mir-opt tests

During rust-lang#122542, I noticed that some of the headers and flags I had copied over from `tests/mir-opt/instrument_coverage.rs`  were unnecessary. And while working to remove those, I noticed even more that could be removed or replaced.
CFI: Handle dyn with no principal

In user-facing Rust, `dyn` always has at least one predicate following it. Unfortunately, because we filter out marker traits from receivers at callsites and `dyn Sync` is, for example, legal, this results in us having `dyn` types with no predicates on occasion in our alias set encoding. This patch handles cases where there are no predicates in a `dyn` type which are relevant to its alias set.

Fixes rust-lang#122998

r? workingjubilee
…compiler-errors

CFI: Support complex receivers

Right now, we only support rewriting `&self` and `&mut self` into `&dyn MyTrait` and `&mut dyn MyTrait`. This expands it to handle the full gamut of receivers by calculating the receiver based on *substitution* rather than based on a rewrite. This means that, for example, `Arc<Self>` will become `Arc<dyn MyTrait>` appropriately with this change.

This approach also allows us to support associated type constraints as well, so we will correctly rewrite `&self` into `&dyn MyTrait<T=i32>`, for example.

r? ```@workingjubilee```
… r=nnethercote

Temporarily remove nnethercote from the review rotation.

I will be on vacation for the next three weeks. I will re-add myself when I return.

r? `@nnethercote`
@rustbot rustbot added A-meta Area: Issues about the rust-lang/rust repository. PG-exploit-mitigations Project group: Exploit mitigations S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. rollup A PR which is a rollup labels Mar 25, 2024
@matthiaskrgr
Copy link
Member Author

@bors r+ rollup=never p=7

@bors
Copy link
Contributor

bors commented Mar 25, 2024

📌 Commit ab8084a has been approved by matthiaskrgr

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 25, 2024
@bors
Copy link
Contributor

bors commented Mar 25, 2024

⌛ Testing commit ab8084a with merge af98101...

@bors
Copy link
Contributor

bors commented Mar 25, 2024

☀️ Test successful - checks-actions
Approved by: matthiaskrgr
Pushing af98101 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Mar 25, 2024
@bors bors merged commit af98101 into rust-lang:master Mar 25, 2024
12 checks passed
@rustbot rustbot added this to the 1.79.0 milestone Mar 25, 2024
@rust-timer
Copy link
Collaborator

📌 Perf builds for each rolled up PR:

PR# Message Perf Build Sha
#122858 Tweak parse_dot_suffix_expr c8c42e4e2a703700eaf73504574a07b392f1652a (link)
#122982 Add more comments to the bootstrap code that handles `tests… d259a5b60fb313b267e16118e4603ab9cf2d2da0 (link)
#122990 Clarify transmute example 514e0a593e48d39ff84ceed9782546bde9cd79cc (link)
#122995 Clean up unnecessary headers/flags in coverage mir-opt tests 6215da09d1eaf0afc59b9c82f46980c42d5e7ec0 (link)
#123003 CFI: Handle dyn with no principal b0da0dade285f64a45391307287c13f1d5ef1c3b (link)
#123005 CFI: Support complex receivers a1d28bd6399d60bb6ace6566d9faeb3baf2c3eae (link)
#123020 Temporarily remove nnethercote from the review rotation. 54e47172c1471a03ca2b9504d6143fae7bad7d85 (link)

previous master: dda2372cf3

In the case of a perf regression, run the following command for each PR you suspect might be the cause: @rust-timer build $SHA

@rust-log-analyzer
Copy link
Collaborator

A job failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
  PR_MESSAGE: Automation to keep dependencies in `Cargo.lock` current.
following is the output from `cargo update`:
  COMMIT_MESSAGE: cargo update 
##[endgroup]
Starting download for Cargo-lock
##[error]Unable to find any artifacts for the associated workflow

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (af98101): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
2.8% [2.8%, 2.8%] 1
Improvements ✅
(primary)
-0.9% [-1.1%, -0.5%] 3
Improvements ✅
(secondary)
-2.9% [-2.9%, -2.9%] 1
All ❌✅ (primary) -0.9% [-1.1%, -0.5%] 3

Cycles

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
0.6% [0.5%, 0.7%] 3
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-1.4% [-1.4%, -1.4%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.1% [-1.4%, 0.7%] 4

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 670.821s -> 672.431s (0.24%)
Artifact size: 315.04 MiB -> 315.03 MiB (-0.00%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-meta Area: Issues about the rust-lang/rust repository. merged-by-bors This PR was explicitly merged by bors. PG-exploit-mitigations Project group: Exploit mitigations rollup A PR which is a rollup S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants