Skip to content

Rollup of 6 pull requests #141842

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

Merged
merged 15 commits into from
Jun 1, 2025
Merged

Rollup of 6 pull requests #141842

merged 15 commits into from
Jun 1, 2025

Conversation

jhpratt
Copy link
Member

@jhpratt jhpratt commented May 31, 2025

Successful merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

Ryan van Polen and others added 15 commits May 16, 2025 11:59
This commit improves the Clone trait documentation to address confusion
around what "duplication" means for different types, especially for smart
pointers like Arc<Mutex<T>>.

Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
Add const support for the float rounding methods floor, ceil, trunc,
fract, round and round_ties_even.
This works by moving the calculation logic from

     src/tools/miri/src/intrinsics/mod.rs

into

     compiler/rustc_const_eval/src/interpret/intrinsics.rs.

All relevant method definitions were adjusted to include the `const`
keyword for all supported float types: f16, f32, f64 and f128.

The constness is hidden behind the feature gate

     feature(const_float_round_methods)

which is tracked in

     rust-lang#141555

This commit is a squash of the following commits:
- test: add tests that we expect to pass when float rounding becomes const
- feat: make float rounding methods `const`
- fix: replace `rustc_allow_const_fn_unstable(core_intrinsics)` attribute with `#[rustc_const_unstable(feature = "f128", issue = "116909")]` in `library/core/src/num/f128.rs`
- revert: undo update to `library/stdarch`
- refactor: replace multiple `float_<mode>_intrinsic` rounding methods with a single, parametrized one
- fix: add `#[cfg(not(bootstrap))]` to new const method tests
- test: add extra sign tests to check `+0.0` and `-0.0`
- revert: undo accidental changes to `round` docs
- fix: gate `const` float round method behind `const_float_round_methods`
- fix: remove unnecessary `#![feature(const_float_methods)]`
- fix: remove unnecessary `#![feature(const_float_methods)]` [2]
- revert: undo changes to `tests/ui/consts/const-eval/float_methods.rs`
- fix: adjust after rebase
- test: fix float tests
- test: add tests for `fract`
- chore: add commented-out `const_float_round_methods` feature gates to `f16` and `f128`
- fix: adjust NaN when rounding floats
- chore: add FIXME comment for de-duplicating float tests
- test: remove unnecessary test file `tests/ui/consts/const-eval/float_methods.rs`
- test: fix tests after upstream simplification of how float tests are run
In the previous description it said there was a TOCTOU race but did not
explain exactly what the problem was. I sat down with the CVE, reviewed
its text, and created this explanation. This context should hopefully
help people understand the actual risk as-such.

Incidentally, it also fixes the capitalization on the name of Redox OS.
…atten, r=jhpratt

Stabilize feature `result_flattening`

Stabilizes the `Result::flatten` method

## Implementations

- [x] Implementation `Result::flatten`: rust-lang#70140
- [x] Implementation `const` `Result::flatten`: rust-lang#130692
- [x] Update stabilization attribute macros (this PR)

## Stabilization process

- [x] Created this PR [suggested](rust-lang#70142 (comment)) by ``@RalfJung``
- [x] FCP (haven't found any, is it applicable here?)
- [ ] Close issue rust-lang#70142
…bilee

std: clarify Clone trait documentation about duplication semantics

Closes rust-lang#141138

The change explicitly explains that cloning behavior varies by type and clarifies that smart pointers (`Arc`, `Rc`) share the same underlying data. I've also added an example of cloning to Arc.
Miri CI: test aarch64-apple-darwin in PRs instead of the x86_64 target

The aarch64 target is more important, and also this ensures we cover all main architectures (x86_64, i686, aarch64) in PR CI.
…r=RalfJung

Add `const` support for float rounding methods

# Add `const` support for float rounding methods

This PR makes the following float rounding methods `const`:

- `f64::{floor, ceil, trunc, round, round_ties_even}`
- and the corresponding methods for `f16`, `f32` and `f128`

Tracking issue: rust-lang#141555

## Procedure

I followed rust-lang@c09ed3e as closely as I could in making float methods `const`, and also received great guidance from https://internals.rust-lang.org/t/const-rounding-methods-in-float-types/22957/3?u=ruancomelli.

## Note

This is my first code contribution to the Rust project, so please let me know if I missed anything - I'd be more than happy to revise and learn more. Thank you for taking the time to review it!
…r=jdonszelmann

Fix "consider borrowing" for else-if

Fixes rust-lang#141810

When trying to suggest a borrow on a `if` or `block` expression, instead we now recurse into the `if` or `block`.
The comments in the code should explain the goal of the new code.

r? ``@jdonszelmann``
…-races-are, r=thomcc,ChrisDenton

library: explain TOCTOU races in `fs::remove_dir_all`

In the previous description it said there was a TOCTOU race but did not explain exactly what the problem was. I sat down with the CVE, reviewed its text, and created this explanation. This context should hopefully help people understand the actual risk as-such.

Incidentally, it also fixes the capitalization on the name of Redox OS.

Original CVE and advisory:
- CVE: https://www.cve.org/CVERecord?id=CVE-2022-21658
- security advisory: https://groups.google.com/g/rustlang-security-announcements/c/R1fZFDhnJVQ?pli=1
- github cross-post: GHSA-r9cc-f5pr-p3j2
@rustbot rustbot added A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-infra Relevant to the infrastructure 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 May 31, 2025
@jhpratt
Copy link
Member Author

jhpratt commented May 31, 2025

@bors r+ rollup=never p=5

@bors
Copy link
Collaborator

bors commented May 31, 2025

📌 Commit 7f306d5 has been approved by jhpratt

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 May 31, 2025
@bors
Copy link
Collaborator

bors commented Jun 1, 2025

⌛ Testing commit 7f306d5 with merge 337c11e...

@bors
Copy link
Collaborator

bors commented Jun 1, 2025

☀️ Test successful - checks-actions
Approved by: jhpratt
Pushing 337c11e to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jun 1, 2025
@bors bors merged commit 337c11e into rust-lang:master Jun 1, 2025
10 checks passed
@rustbot rustbot added this to the 1.89.0 milestone Jun 1, 2025
@rust-timer
Copy link
Collaborator

📌 Perf builds for each rolled up PR:

PR# Message Perf Build Sha
#141072 Stabilize feature result_flattening 9d3690904e263bea017a3fa351bff41529180c97 (link)
#141215 std: clarify Clone trait documentation about duplication se… e191aaa0fd32507c3ae950a5cc4c3efca485c340 (link)
#141277 Miri CI: test aarch64-apple-darwin in PRs instead of the x8… 7db8b1bd3608be25a06bc1eed7cb9d3b3450ac92 (link)
#141521 Add const support for float rounding methods 1df0b8f90916a41352cdb228a922db5aae0b3ac4 (link)
#141812 Fix "consider borrowing" for else-if 1f32018185ae07476f5c642a09ec24a8b512babe (link)
#141832 library: explain TOCTOU races in fs::remove_dir_all 8323d68eeefb749c112f55bb0a5ce8775380b6e6 (link)

previous master: f0999ffdc4

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

Copy link
Contributor

github-actions bot commented Jun 1, 2025

What is this? This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.

Comparing f0999ff (parent) -> 337c11e (this PR)

Test differences

Show 662 test diffs

Stage 1

  • num::f32::ceil: [missing] -> pass (J0)
  • num::f32::floor: [missing] -> pass (J0)
  • num::f32::fract: [missing] -> pass (J0)
  • num::f32::round: [missing] -> pass (J0)
  • num::f32::round_ties_even: [missing] -> pass (J0)
  • num::f32::trunc: [missing] -> pass (J0)
  • num::f32_const::ceil: [missing] -> pass (J0)
  • num::f32_const::floor: [missing] -> pass (J0)
  • num::f32_const::fract: [missing] -> pass (J0)
  • num::f32_const::round: [missing] -> pass (J0)
  • num::f32_const::round_ties_even: [missing] -> pass (J0)
  • num::f32_const::trunc: [missing] -> pass (J0)
  • num::f64::ceil: [missing] -> pass (J0)
  • num::f64::floor: [missing] -> pass (J0)
  • num::f64::fract: [missing] -> pass (J0)
  • num::f64::round: [missing] -> pass (J0)
  • num::f64::round_ties_even: [missing] -> pass (J0)
  • num::f64::trunc: [missing] -> pass (J0)
  • num::f64_const::ceil: [missing] -> pass (J0)
  • num::f64_const::floor: [missing] -> pass (J0)
  • num::f64_const::fract: [missing] -> pass (J0)
  • num::f64_const::round: [missing] -> pass (J0)
  • num::f64_const::round_ties_even: [missing] -> pass (J0)
  • num::f64_const::trunc: [missing] -> pass (J0)
  • [ui] tests/ui/typeck/consider-borrowing-141810-1.rs: [missing] -> pass (J1)
  • [ui] tests/ui/typeck/consider-borrowing-141810-2.rs: [missing] -> pass (J1)
  • [ui] tests/ui/typeck/consider-borrowing-141810-3.rs: [missing] -> pass (J1)
  • [ui] tests/ui/typeck/consider-borrowing-141810-4.rs: [missing] -> pass (J1)

Stage 2

  • [ui] tests/ui/typeck/consider-borrowing-141810-1.rs: [missing] -> pass (J2)
  • [ui] tests/ui/typeck/consider-borrowing-141810-2.rs: [missing] -> pass (J2)
  • [ui] tests/ui/typeck/consider-borrowing-141810-3.rs: [missing] -> pass (J2)
  • [ui] tests/ui/typeck/consider-borrowing-141810-4.rs: [missing] -> pass (J2)

Additionally, 630 doctest diffs were found. These are ignored, as they are noisy.

Job group index

Test dashboard

Run

cargo run --manifest-path src/ci/citool/Cargo.toml -- \
    test-dashboard 337c11e5932275e7d450c1f2e26f289f0ddfa717 --output-dir test-dashboard

And then open test-dashboard/index.html in your browser to see an overview of all executed tests.

Job duration changes

  1. dist-aarch64-linux: 5419.4s -> 7891.6s (45.6%)
  2. dist-apple-various: 6334.0s -> 8568.4s (35.3%)
  3. aarch64-apple: 5280.1s -> 4209.9s (-20.3%)
  4. x86_64-apple-1: 6663.1s -> 7869.6s (18.1%)
  5. aarch64-gnu: 6686.9s -> 7777.2s (16.3%)
  6. dist-arm-linux-musl: 5667.9s -> 6331.2s (11.7%)
  7. x86_64-apple-2: 5396.2s -> 4775.3s (-11.5%)
  8. x86_64-gnu-stable: 7519.1s -> 6886.5s (-8.4%)
  9. dist-x86_64-apple: 7862.0s -> 7358.8s (-6.4%)
  10. dist-x86_64-freebsd: 4786.3s -> 5035.1s (5.2%)
How to interpret the job duration changes?

Job durations can vary a lot, based on the actual runner instance
that executed the job, system noise, invalidated caches, etc. The table above is provided
mostly for t-infra members, for simpler debugging of potential CI slow-downs.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (337c11e): comparison URL.

Overall result: ❌✅ regressions and improvements - no action needed

@rustbot label: -perf-regression

Instruction count

This is the most reliable metric that we have; it was used to determine the overall result at the top of this comment. However, even this metric can sometimes exhibit noise.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
0.5% [0.3%, 0.6%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.4% [-0.4%, -0.4%] 1
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results (primary -1.4%, secondary -0.6%)

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)
1.6% [0.4%, 5.9%] 5
Improvements ✅
(primary)
-1.4% [-1.4%, -1.4%] 1
Improvements ✅
(secondary)
-1.7% [-4.8%, -0.5%] 10
All ❌✅ (primary) -1.4% [-1.4%, -1.4%] 1

Cycles

Results (secondary 1.3%)

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.0% [0.6%, 7.3%] 9
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.7% [-0.8%, -0.5%] 3
All ❌✅ (primary) - - 0

Binary size

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

Bootstrap: 774.682s -> 774.952s (0.03%)
Artifact size: 372.26 MiB -> 372.29 MiB (0.01%)

@jhpratt jhpratt deleted the rollup-r7ldrl2 branch June 1, 2025 05:53
github-actions bot pushed a commit to model-checking/verify-rust-std that referenced this pull request Jun 3, 2025
Rollup of 6 pull requests

Successful merges:

 - rust-lang#141072 (Stabilize feature `result_flattening`)
 - rust-lang#141215 (std: clarify Clone trait documentation about duplication semantics)
 - rust-lang#141277 (Miri CI: test aarch64-apple-darwin in PRs instead of the x86_64 target)
 - rust-lang#141521 (Add `const` support for float rounding methods)
 - rust-lang#141812 (Fix "consider borrowing" for else-if)
 - rust-lang#141832 (library: explain TOCTOU races in `fs::remove_dir_all`)

r? `@ghost`
`@rustbot` modify labels: rollup
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. 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-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-infra Relevant to the infrastructure 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.

9 participants