Skip to content

Rollup of 8 pull requests #141753

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 25 commits into from
May 30, 2025
Merged

Rollup of 8 pull requests #141753

merged 25 commits into from
May 30, 2025

Conversation

matthiaskrgr
Copy link
Member

@matthiaskrgr matthiaskrgr commented May 30, 2025

Successful merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

mu001999 and others added 25 commits May 27, 2025 22:03
- The lint is now reported in code that gets removed/modified/duplicated
  by macro expansion.
- Spans are more accurate
- Fixes rust-lang#140281
`visit_clobber` is not really useful except for one niche purpose
involving generic code. We should just use the replace logic where we
can.
PR 138515, we insert a placeholder attribute so that checks for attributes can still know about the placement of `cfg` attributes. When we suggest removing items with `cfg_attr`s (fix Issue 56328) and make them verbose. We tweak the wording of the existing "unused `extern crate`" lint.

```
warning: unused extern crate
  --> $DIR/removing-extern-crate.rs:9:1
   |
LL | extern crate removing_extern_crate as foo;
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unused
   |
note: the lint level is defined here
  --> $DIR/removing-extern-crate.rs:6:9
   |
LL | #![warn(rust_2018_idioms)]
   |         ^^^^^^^^^^^^^^^^
   = note: `#[warn(unused_extern_crates)]` implied by `#[warn(rust_2018_idioms)]`
help: remove the unused `extern crate`
   |
LL - #[cfg_attr(test, macro_use)]
LL - extern crate removing_extern_crate as foo;
LL +
   |
```
Turns out LLVM's `va_arg` is also unreliable for this target, so we need
our own implementation.
before we had an extra 'on' that was
ungramatical.

fixes rust-lang#138112
Clean up the separate `assert_f{16,32,64,128}` macros with a single
`assert_biteq!` macro that works for all float widths.
As was mentioned at [1], we currently use `assert_approx_eq` for testing
some math functions that guarantee exact results. Replace approximate
assertions with exact ones for the following:

* `ceil`
* `floor`
* `fract`
* `from_bits`
* `mul_add`
* `round_ties_even`
* `round`
* `trunc`

This likely wasn't done in the past to avoid writing out exact decimals
that don't match the intuitive answer (e.g. 1.3 - 1.0 = 0.300...004),
but ensuring our results are accurate seems more important here.

[1]: rust-lang#138087 (comment)
The rounding tests are now supported, so there is no longer any reason
to skip these.
`assert_eq!` ignores the sign of zero, but for any tests involving zeros
we do care about this sign. Replace `assert_eq!` with `assert_biteq!`
everywhere possible for float tests to ensure we don't miss this.
`assert_biteq!` is also updated to check equality on non-NaNs, to catch
the unlikely case that bitwise equality works but our `==`
implementation is broken.

There is one notable output change: we were asserting that
`(-0.0).fract()` and `(-1.0).fract()` both return -0.0, but both
actually return +0.0.
Use `cfg_attr_trace` in AST with a placeholder attribute for accurate suggestion

In rust-lang#138515, we insert a placeholder attribute so that checks for attributes can still know about the placement of `cfg` attributes. When we suggest removing items with `cfg_attr`s (fix rust-lang#56328) and make them verbose. We tweak the wording of the existing "unused `extern crate`" lint.

```
warning: unused `extern crate`
  --> $DIR/removing-extern-crate.rs:9:1
   |
LL | extern crate removing_extern_crate as foo;
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unused
   |
note: the lint level is defined here
  --> $DIR/removing-extern-crate.rs:6:9
   |
LL | #![warn(rust_2018_idioms)]
   |         ^^^^^^^^^^^^^^^^
   = note: `#[warn(unused_extern_crates)]` implied by `#[warn(rust_2018_idioms)]`
help: remove the unused `extern crate`
   |
LL - #[cfg_attr(test, macro_use)]
LL - extern crate removing_extern_crate as foo;
   |
```

r? `@petrochenkov`

try-job: x86_64-gnu-aux
…sion, r=davidtwco

Report text_direction_codepoint_in_literal when parsing

The lint is now reported in code that gets removed/modified/duplicated by macro expansion, and spans are more accurate so we don't get ICEs from trying to split a span in the middle of a character.

This removes support for lint level attributes for `text_direction_codepoint_in_literal` except at the crate level, I don't think that there's an easy way around this when the lint can be reported on code that's removed by `cfg` or that is only in the input of a macro.

Fixes rust-lang#140281
…r, r=petrochenkov

Refactor the two-phase check for impls and impl items

Refactor the two-phase dead code check to make the logic clearer and simpler:
1. adding assoc fn and impl into `unsolved_items` directly during the initial construction of the worklist
2. converge the logic of checking whether assoc fn and impl are used to `item_should_be_checked`, and the item is considered used only when its corresponding trait and Self adt are used

This PR only refactors as much as possible to avoid affecting the original functions. However, due to the adjustment of the order of checks, the test results are slightly different, but overall, there is no regression problem

Fixes rust-lang#127911
Fixes rust-lang#128839

Extracted from rust-lang#128637.
r? petrochenkov

try-job: dist-aarch64-linux
…w, r=petrochenkov

remove `visit_clobber` and move `DummyAstNode` to `rustc_expand`

`visit_clobber` is not really useful except for one niche purpose
involving generic code. We should just use the replace logic where we
can.
atomic_load intrinsic: use const generic parameter for ordering

We have a gazillion intrinsics for the atomics because we encode the ordering into the intrinsic name rather than making it a parameter. This is particularly bad for those operations that take two orderings. Let's fix that!

This PR only converts `load`, to see if there's any feedback that would fundamentally change the strategy we pursue for the const generic intrinsics.

The first two commits are preparation and could be a separate PR if you prefer.

`@BoxyUwU` -- I hope this is a use of const generics that is unlikely to explode? All we need is a const generic of enum type. We could funnel it through an integer if we had to but an enum is obviously nicer...

`@bjorn3` it seems like the cranelift backend entirely ignores the ordering?
…r=workingjubilee

implement `va_arg` for x86_64 systemv

tracking issue: rust-lang#44930

Turns out LLVM's `va_arg` is also unreliable for this target.

llvm/llvm-project#141361

So, like clang, we implement our own. I used

- the spec at https://gitlab.com/x86-psABIs/x86-64-ABI
- the clang implementation at https://github.com/llvm/llvm-project/blob/9a440f84773c56d3803f330774acb2b4f471d5b4/clang/lib/CodeGen/Targets/X86.cpp#L3041

We can take a bunch of shortcuts because the return type of `va_list` must implement `VaArgSafe`. I also extended some of the tests, because up to 11 floats can be stored in the `reg_safe_area` for this calling convention.

r? `@workingjubilee`
`@rustbot` label +F-c_variadic

try-job: x86_64-apple-1
…fJung

float: Replace some approximate assertions with exact

As was mentioned at [1], we currently use `assert_approx_eq` for testing
some math functions that guarantee exact results. Replace approximate
assertions with exact ones for the following:

* `ceil`
* `floor`
* `fract`
* `from_bits`
* `mul_add`
* `round_ties_even`
* `round`
* `trunc`

This likely wasn't done in the past to avoid writing out exact decimals
that don't match the intuitive answer (e.g. 1.3 - 1.0 = 0.300...004),
but ensuring our results are accurate seems more important here.

[1]: rust-lang#138087 (comment)

The first commit is a small bit of macro cleanup.

try-job: aarch64-gnu
try-job: x86_64-gnu-aux
…=GuillaumeGomez

rustdoc: display doc(cfg(false)) properly

before we had an extra 'on' that was
ungramatical.

fixes rust-lang#138112

this is what it looks like now:
![screenshot: Available nowhere](https://github.com/user-attachments/assets/e27b4990-09a7-4f13-8bcf-26d44c8c1bea)
@rustbot rustbot added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. A-run-make Area: port run-make Makefiles to rmake.rs 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. labels May 30, 2025
@rustbot rustbot added 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. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output. rollup A PR which is a rollup labels May 30, 2025
@matthiaskrgr
Copy link
Member Author

@bors r+ rollup=never p=5

@bors
Copy link
Collaborator

bors commented May 30, 2025

📌 Commit 71529f5 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 May 30, 2025
@bors
Copy link
Collaborator

bors commented May 30, 2025

⌛ Testing commit 71529f5 with merge 6de3a73...

@bors
Copy link
Collaborator

bors commented May 30, 2025

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

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

📌 Perf builds for each rolled up PR:

PR# Message Perf Build Sha
#133823 Use cfg_attr_trace in AST with a placeholder attribute fo… dcca579018b0f5603dc49e0fa7016f576282e1fc (link)
#141004 Report text_direction_codepoint_in_literal when parsing d7f039e90530064dd8079cf33f1960038ba1aefb (link)
#141407 Refactor the two-phase check for impls and impl items 1d94b8879567d15c8ab09c59a95559cae0ad8a37 (link)
#141430 remove visit_clobber and move DummyAstNode to `rustc_ex… 7c866b4e0361d8d3072032d72ef59716ddcc61fc (link)
#141507 atomic_load intrinsic: use const generic parameter for orde… fba9f850720b553d8af5c9e1a84198248098a44e (link)
#141538 implement va_arg for x86_64 systemv ec2d6e22132df98a3c17bed99b98b9a64c10b76f (link)
#141669 float: Replace some approximate assertions with exact 2da0f38b13e1829a83418028e8183e8bb886644e (link)
#141747 rustdoc: display doc(cfg(false)) properly 38afa91d83460b8739f3585d0d0a842b0cd8c086 (link)

previous master: 1c0849d8ba

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

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 1c0849d (parent) -> 6de3a73 (this PR)

Test differences

Show 404 test diffs

Stage 1

  • floats::f128::test_abs: [missing] -> pass (J1)
  • floats::f128::test_ceil: [missing] -> pass (J1)
  • floats::f128::test_fract: [missing] -> pass (J1)
  • floats::f128::test_max_nan: [missing] -> pass (J1)
  • floats::f128::test_maximum: [missing] -> pass (J1)
  • floats::f128::test_min_nan: [missing] -> pass (J1)
  • floats::f128::test_minimum: [missing] -> pass (J1)
  • floats::f128::test_recip: [missing] -> pass (J1)
  • floats::f128::test_round: [missing] -> pass (J1)
  • floats::f128::test_round_ties_even: [missing] -> pass (J1)
  • floats::f128::test_trunc: [missing] -> pass (J1)
  • floats::f16::test_abs: [missing] -> pass (J1)
  • floats::f16::test_ceil: [missing] -> pass (J1)
  • floats::f16::test_floor: [missing] -> pass (J1)
  • floats::f16::test_fract: [missing] -> pass (J1)
  • floats::f16::test_max_nan: [missing] -> pass (J1)
  • floats::f16::test_maximum: [missing] -> pass (J1)
  • floats::f16::test_min_nan: [missing] -> pass (J1)
  • floats::f16::test_minimum: [missing] -> pass (J1)
  • floats::f16::test_recip: [missing] -> pass (J1)
  • floats::f16::test_round: [missing] -> pass (J1)
  • floats::f16::test_round_ties_even: [missing] -> pass (J1)
  • floats::f16::test_trunc: [missing] -> pass (J1)
  • [crashes] tests/crashes/140281.rs: pass -> [missing] (J2)
  • [rustdoc] tests/rustdoc/cfg-bool.rs: [missing] -> pass (J2)
  • [ui] tests/ui/lint/dead-code/alias-type-used-as-generic-arg-in-impl.rs: [missing] -> pass (J2)
  • [ui] tests/ui/lint/dead-code/trait-only-used-as-type-bound.rs: [missing] -> pass (J2)
  • [ui] tests/ui/parser/macro/unicode-control-codepoints-macros.rs: [missing] -> pass (J2)
  • [ui] tests/ui/rust-2018/removing-extern-crate-malformed-cfg.rs: [missing] -> pass (J2)
  • floats::f128::test_num_f128_rem: pass -> [missing] (J4)

Stage 2

  • [ui] tests/ui/lint/dead-code/alias-type-used-as-generic-arg-in-impl.rs: [missing] -> pass (J0)
  • [ui] tests/ui/lint/dead-code/trait-only-used-as-type-bound.rs: [missing] -> pass (J0)
  • [ui] tests/ui/parser/macro/unicode-control-codepoints-macros.rs: [missing] -> pass (J0)
  • [ui] tests/ui/rust-2018/removing-extern-crate-malformed-cfg.rs: [missing] -> pass (J0)
  • [crashes] tests/crashes/140281.rs: pass -> [missing] (J3)
  • [rustdoc] tests/rustdoc/cfg-bool.rs: [missing] -> pass (J5)

Additionally, 368 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 6de3a733122a82d9b3c3427c7ee16a1e1a022718 --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. x86_64-apple-2: 6677.4s -> 4358.1s (-34.7%)
  2. dist-aarch64-linux: 6452.8s -> 7778.6s (20.5%)
  3. x86_64-apple-1: 8322.1s -> 9944.6s (19.5%)
  4. dist-x86_64-apple: 8037.2s -> 8953.9s (11.4%)
  5. dist-i686-mingw: 8960.3s -> 8205.5s (-8.4%)
  6. dist-apple-various: 8182.6s -> 7770.7s (-5.0%)
  7. dist-loongarch64-musl: 5520.9s -> 5248.7s (-4.9%)
  8. dist-powerpc-linux: 5144.4s -> 5347.5s (3.9%)
  9. test-various: 4138.6s -> 4282.5s (3.5%)
  10. dist-arm-linux-gnueabi: 5292.3s -> 5114.6s (-3.4%)
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 (6de3a73): comparison URL.

Overall result: ❌ regressions - please read the text below

Our benchmarks found a performance regression caused by this PR.
This might be an actual regression, but it can also be just noise.

Next Steps:

  • If the regression was expected or you think it can be justified,
    please write a comment with sufficient written justification, and add
    @rustbot label: +perf-regression-triaged to it, to mark the regression as triaged.
  • If you think that you know of a way to resolve the regression, try to create
    a new PR with a fix for the regression.
  • If you do not understand the regression or you think that it is just noise,
    you can ask the @rust-lang/wg-compiler-performance working group for help (members of this group
    were already notified of this PR).

@rustbot label: +perf-regression
cc @rust-lang/wg-compiler-performance

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.4% [0.1%, 1.4%] 78
Regressions ❌
(secondary)
0.3% [0.1%, 0.6%] 46
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.2% [-0.3%, -0.1%] 3
All ❌✅ (primary) 0.4% [0.1%, 1.4%] 78

Max RSS (memory usage)

Results (primary 2.7%, secondary 0.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)
2.7% [1.6%, 5.6%] 7
Regressions ❌
(secondary)
1.4% [0.5%, 3.7%] 12
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.3% [-5.0%, -0.5%] 5
All ❌✅ (primary) 2.7% [1.6%, 5.6%] 7

Cycles

Results (primary 1.1%, 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)
1.1% [1.1%, 1.1%] 3
Regressions ❌
(secondary)
1.0% [0.6%, 1.5%] 4
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-1.4% [-3.0%, -0.5%] 8
All ❌✅ (primary) 1.1% [1.1%, 1.1%] 3

Binary size

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

Bootstrap: missing data
Artifact size: 370.26 MiB -> 370.26 MiB (0.00%)

@Kobzol
Copy link
Contributor

Kobzol commented May 30, 2025

Started a bunch of perf. runs.

@Kobzol
Copy link
Contributor

Kobzol commented May 30, 2025

Seems like most of the regressions are from #141407 (comment).

@Mark-Simulacrum Mark-Simulacrum added the perf-regression-triaged The performance regression has been triaged. label Jun 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. A-run-make Area: port run-make Makefiles to rmake.rs merged-by-bors This PR was explicitly merged by bors. perf-regression Performance regression. perf-regression-triaged The performance regression has been triaged. 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. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output.
Projects
None yet
Development

Successfully merging this pull request may close these issues.