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 6 pull requests #123128

Merged
merged 20 commits into from Mar 27, 2024
Merged

Rollup of 6 pull requests #123128

merged 20 commits into from Mar 27, 2024

Conversation

GuillaumeGomez
Copy link
Member

Successful merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

compiler-errors and others added 20 commits March 24, 2024 20:06
warning: casting raw pointers to the same type and constness is unnecessary (`*mut V` -> `*mut V`)
   --> library\alloc\src\collections\btree\map\entry.rs:357:31
    |
357 |                 let val_ptr = root.borrow_mut().push(self.key, value) as *mut V;
    |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `root.borrow_mut().push
(self.key, value)`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast

warning: casting to the same type is unnecessary (`usize` -> `usize`)
   --> library\alloc\src\ffi\c_str.rs:411:56
    |
411 |             let slice = slice::from_raw_parts_mut(ptr, len as usize);
    |                                                        ^^^^^^^^^^^^ help: try: `len`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast

warning: casting raw pointers to the same type and constness is unnecessary (`*mut T` -> `*mut T`)
   --> library\alloc\src\slice.rs:516:25
    |
516 |                         (buf.as_mut_ptr() as *mut T).add(buf.len()),
    |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `buf.as_mut_ptr()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast

warning: casting raw pointers to the same type and constness is unnecessary (`*mut T` -> `*mut T`)
   --> library\alloc\src\slice.rs:537:21
    |
537 |                     (buf.as_mut_ptr() as *mut T).add(buf.len()),
    |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `buf.as_mut_ptr()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast

warning: casting raw pointers to the same type and constness is unnecessary (`*const ()` -> `*const ()`)
   --> library\alloc\src\task.rs:151:13
    |
151 |             waker as *const (),
    |             ^^^^^^^^^^^^^^^^^^ help: try: `waker`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast

warning: casting raw pointers to the same type and constness is unnecessary (`*const ()` -> `*const ()`)
   --> library\alloc\src\task.rs:323:13
    |
323 |             waker as *const (),
    |             ^^^^^^^^^^^^^^^^^^ help: try: `waker`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast

warning: casting to the same type is unnecessary (`usize` -> `usize`)
   --> library\std\src\sys_common\net.rs:110:21
    |
110 |             assert!(len as usize >= mem::size_of::<c::sockaddr_in>());
    |                     ^^^^^^^^^^^^ help: try: `len`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast

warning: casting to the same type is unnecessary (`usize` -> `usize`)
   --> library\std\src\sys_common\net.rs:116:21
    |
116 |             assert!(len as usize >= mem::size_of::<c::sockaddr_in6>());
    |                     ^^^^^^^^^^^^ help: try: `len`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
If a function was instrumented for coverage, but all of its coverage statements
have been removed by later MIR transforms, it should be treated as "unused"
even if the compiler generates an unreachable stub for it.
This enables KCFI-based testing for all the CFI run-pass tests in the
suite today. We can add the test header on top of in-flight CFI tests
once they land.

It also enables KCFI as a sanitizer for x86_64 and aarch64 Linux to make
this possible. The sanitizer should likely be available for all aarch64,
x86_64, and riscv targets, but that isn't critical for initial testing.
Previously, the documentation for a variant appeared after the documentation
for each of its fields. This was inconsistent with structs and unions, and made
little sense on its own; fields are subordinate to variants and should
therefore appear later in the documentation.
coverage: Re-enable `UnreachablePropagation` for coverage builds

This is a sequence of 3 related changes:
- Clean up the existing code that scans for unused functions
- Detect functions that were instrumented for coverage, but have had all their coverage statements removed by later MIR transforms (e.g. `UnreachablePropagation`)
- Re-enable `UnreachablePropagation` in coverage builds

Because we now detect functions that have lost their coverage statements, and treat them as unused, we don't need to worry about `UnreachablePropagation` removing all of those statements. This is demonstrated by `tests/coverage/unreachable.rs`.

Fixes rust-lang#116171.
…ol, r=oli-obk

Make `TyCtxt::coroutine_layout` take coroutine's kind parameter

For coroutines that come from coroutine-closures (i.e. async closures), we may have two kinds of bodies stored in the coroutine; one that takes the closure's captures by reference, and one that takes the captures by move.

These currently have identical layouts, but if we do any optimization for these layouts that are related to the upvars, then they will diverge -- e.g. rust-lang#120168 (comment).

This PR relaxes the assertion I added in rust-lang#121122, and instead make the `TyCtxt::coroutine_layout` method take the `coroutine_kind_ty` argument from the coroutine, which will allow us to differentiate these by-move and by-ref bodies.
CFI: Enable KCFI testing of run-pass tests

This enables KCFI-based testing for all the CFI run-pass tests in the suite today. We can add the test header on top of in-flight CFI tests once they land. This is becoming more important as we get closer to leveraging CFI's multiple type attachment feature, as that is where the implementations will have a divergence.

It also enables KCFI as a sanitizer for x86_64 and aarch64 Linux to make this possible. The sanitizer should likely be available for all aarch64, x86_64, and riscv targets, but that isn't critical for initial testing.
lib: fix some unnecessary_cast clippy lint

Fixes few instances of `unnecessary_cast` clippy lint
…ds-doc, r=GuillaumeGomez

rustdoc: Swap fields and variant documentations

Previously, the documentation for a variant appeared after the documentation for each of its fields. This was inconsistent with structs and unions, and made little sense on its own; fields are subordinate to variants and should therefore appear later in the documentation.

Before:

![Screenshot of rendered documentation before this patch.](https://github.com/rust-lang/rust/assets/50083900/4c98258e-bdf7-4507-9cf1-fe601407ff11)

After:

![Screenshot of rendered documentation after this patch.](https://github.com/rust-lang/rust/assets/50083900/bd223f92-9b06-4b5a-820e-7a8501bdc0e2)
@rustbot rustbot added A-testsuite Area: The testsuite used to check the correctness of rustc 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. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. rollup A PR which is a rollup labels Mar 27, 2024
@GuillaumeGomez
Copy link
Member Author

@bors r+ p=5 rollup=never

@bors
Copy link
Contributor

bors commented Mar 27, 2024

📌 Commit c0945f0 has been approved by GuillaumeGomez

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 27, 2024
@bors
Copy link
Contributor

bors commented Mar 27, 2024

⌛ Testing commit c0945f0 with merge 10a7aa1...

@bors
Copy link
Contributor

bors commented Mar 27, 2024

☀️ Test successful - checks-actions
Approved by: GuillaumeGomez
Pushing 10a7aa1 to master...

1 similar comment
@bors
Copy link
Contributor

bors commented Mar 27, 2024

☀️ Test successful - checks-actions
Approved by: GuillaumeGomez
Pushing 10a7aa1 to master...

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

📌 Perf builds for each rolled up PR:

PR# Message Perf Build Sha
#121843 Implement -L KIND=@RUSTC_BUILTIN/... 928e47d3c8d6194ba816589ef59b5c548de28a2f (link)
#122860 coverage: Re-enable UnreachablePropagation for coverage b… 0b7a16037d262124354dd0c972d706a26d89ebef (link)
#123021 Make TyCtxt::coroutine_layout take coroutine's kind param… 66efff6330296c36f5179e9ca36d5eacf227656b (link)
#123024 CFI: Enable KCFI testing of run-pass tests 1475c2dea34fde1105f6679bd7cadd4a66ad557c (link)
#123083 lib: fix some unnecessary_cast clippy lint b19349b5b81c80b31ca32c2fb4f50b04dcecc8d0 (link)
#123116 rustdoc: Swap fields and variant documentations f459a124c452587bc5965bbd98a9cbe6c97629a0 (link)

previous master: 0dcc1309d0

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-timer
Copy link
Collaborator

Finished benchmarking commit (10a7aa1): 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)
1.5% [0.5%, 2.5%] 2
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-1.2% [-1.8%, -0.4%] 5
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -0.5% [-1.8%, 2.5%] 7

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.4% [0.4%, 0.5%] 2
Regressions ❌
(secondary)
2.0% [2.0%, 2.0%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.4% [0.4%, 0.5%] 2

Binary size

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

Bootstrap: 669.238s -> 670.226s (0.15%)
Artifact size: 315.79 MiB -> 315.70 MiB (-0.03%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-testsuite Area: The testsuite used to check the correctness of rustc 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. T-rustdoc Relevant to the rustdoc 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