Skip to content

Rollup of 7 pull requests #143026

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
Jun 26, 2025
Merged

Rollup of 7 pull requests #143026

merged 25 commits into from
Jun 26, 2025

Conversation

jdonszelmann
Copy link
Contributor

@jdonszelmann jdonszelmann commented Jun 25, 2025

Successful merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

Kivooeo and others added 25 commits June 23, 2025 18:53
Signed-off-by: Karan Janthe <karanjanthe@gmail.com>
Signed-off-by: Karan Janthe <karanjanthe@gmail.com>
The cross-build megatest gets extremely conflict-prone, so
start cutting it into smaller pieces.
… restore snapshot when set subdiag arg

Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
…secure-abis-always-match-c, r=compiler-errors

Withdraw the claim `extern "C-cmse-nonsecure-*"` always matches `extern "C"`

We currently claim that `extern "C-cmse-nonsecure-*"` ABIs will always match `extern "C"`, but that seems... **optimistic** when one considers that `extern "C"` is ambiguous enough to be redefined in ways we may not want the Cortex M Security Extensions ABIs to mirror. If some configuration, feature, or other platform quirk that applied to Arm CPUs with CMSE would modify the `extern "C"` ABI, it does not seem like we should guarantee that also applies to the `extern "cmse-nonsecure-*"` ABIs. Anything involving target modifiers that might affect register availability or usage could make us liars if, for instance, clang decides those apply to normal C functions but not ones with the CMSE attributes, but we still want to have interop with the C compiler.

We simply do not control enough of the factors involved to both force these ABIs to match and still provide useful interop, so we shouldn't implicitly promise they do. We should leave this judgement call to the decisions of platform experts who can afford to keep up with the latest news from Cambridge, instead of enshrining today's hopeful guess forever in Rust's permitted ABIs.

It's a bit weird anyways.
- The attributes are `__attribute__((cmse_nonsecure_call))` and `__attribute__((cmse_nonsecure_entry))`, so the obvious choice is `extern "cmse-nonsecure-call"` and `extern "cmse-nonsecure-entry"`.
- We do not prefix any other ABI that reflects (or even *is*) a C ABI with "C-", with the exception of the Rust-defined `extern "C-unwind`", e.g. we do not have `extern "C-aapcs"` or `extern "C-sysv64"`.

Tracking issues:
- rust-lang#75835
- rust-lang#81391
`tests/ui`: A New Order [8/N]

Some `tests/ui/` housekeeping, to trim down number of tests directly under `tests/ui/`. Part of rust-lang#133895.
…li-obk

Add runtime check to avoid overwrite arg in `Diag`

## Origin PR description
At first, I set up a `debug_assert` check for the arg method to make sure that `args` in `Diag` aren't easily overwritten, and I added the `remove_arg()` method, so that if you do need to overwrite an arg, then you can explicitly call `remove_arg()` to remove it first, then call `arg()` to overwrite it.

For the code before the rust-lang#142015 change, it won't compile because it will report an error
```
arg `instance`already exists.
```

This PR also modifies all diagnostics that fail the check to pass the check. There are two cases of check failure:

1. ~~Between *the parent diagnostic and the subdiagnostic*, or *between the subdiagnostics* have the same field between them. In this case, I renamed the conflicting fields.~~
2. ~~For subdiagnostics stored in `Vec`, the rendering may iteratively write the same arg over and over again. In this case, I changed the auto-generation with `derive(SubDiagnostic)` to manually implementing `SubDiagnostic` and manually rendered it with `eagerly_translate()`, similar to rust-lang#142031 (comment), and after rendering it I manually deleted useless arg with the newly added `remove_arg` method.~~

## Final Decision

After trying and discussing, we made a final decision.

For `#[derive(Subdiagnostic)]`, This PR made two changes:

1. After the subdiagnostic is rendered, remove all args of this subdiagnostic, which allows for usage like `Vec<Subdiag>`.
2. Store `diag.args` before setting arguments, so that you can restore the contents of the main diagnostic after deleting the arguments after subdiagnostic is rendered, to avoid deleting the main diagnostic's arg when they have the same name args.
…useZ4

Add PrintTAFn flag for targeted type analysis printing

## Summary
This PR adds a new `PrintTAFn` flag to the `-Z autodiff` option that allows printing type analysis information for a specific function, rather than all functions.

## Changes

### New Flag
- Added `PrintTAFn=<function_name>` option to `-Z autodiff`
- Usage: `-Z autodiff=Enable,PrintTAFn=my_function_name`

### Implementation Details
- **Rust side**: Added `PrintTAFn(String)` variant to `AutoDiff` enum
- **Parser**: Updated `parse_autodiff` to handle `PrintTAFn=<function_name>` syntax with proper error handling
- **FFI**: Added `set_print_type_fun` function to interface with Enzyme's `FunctionToAnalyze` command line option
- **Documentation**: Updated help text and documentation for the new flag

### Files Modified
- `compiler/rustc_session/src/config.rs`: Added `PrintTAFn(String)` variant
- `compiler/rustc_session/src/options.rs`: Updated parser and help text (now shows `PrintTAFn` in the list)
- `compiler/rustc_codegen_llvm/src/llvm/enzyme_ffi.rs`: Added FFI function and static variable
- `compiler/rustc_codegen_llvm/src/back/lto.rs`: Added handling for new flag
- `src/doc/rustc-dev-guide/src/autodiff/flags.md`: Updated documentation
- `src/doc/unstable-book/src/compiler-flags/autodiff.md`: Updated documentation

## Testing
The flag can be tested with:
```bash
rustc +enzyme -Z autodiff=Enable,PrintTAFn=square test.rs
```

This will print type analysis information only for the function named "square" instead of all functions.

## Error Handling
The parser includes proper error handling:
- Missing argument: `PrintTAFn` without `=<function_name>` will show an error
- Unknown options: Invalid autodiff options will be reported

r? ```@ZuseZ4```
…-dead

Check CoerceUnsized impl validity before coercing

Self-explanatory from the title.

Fixes rust-lang#126982
Fixes rust-lang#131048
Fixes rust-lang#134217
Fixes rust-lang#126269
Fixes rust-lang#138265
…ty-abis, r=jieyouxu

Convert some ABI tests to use `extern "rust-invalid"`
Make `Sub`, `Mul`, `Div` and `Rem`  `const_traits`

Generally useful for implementation, like Add.
@rustbot rustbot added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. A-rustc-dev-guide Area: rustc-dev-guide A-translation Area: Translation infrastructure, and migrating existing diagnostics to SessionDiagnostic F-autodiff `#![feature(autodiff)]` S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 25, 2025
@rustbot rustbot added 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 Jun 25, 2025
@jdonszelmann
Copy link
Contributor Author

@bors r+ rollup=never p=5

@bors
Copy link
Collaborator

bors commented Jun 25, 2025

📌 Commit c001128 has been approved by jdonszelmann

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 Jun 25, 2025
@bors
Copy link
Collaborator

bors commented Jun 25, 2025

⌛ Testing commit c001128 with merge bc4376f...

@bors
Copy link
Collaborator

bors commented Jun 26, 2025

☀️ Test successful - checks-actions
Approved by: jdonszelmann
Pushing bc4376f to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jun 26, 2025
@bors bors merged commit bc4376f into rust-lang:master Jun 26, 2025
11 checks passed
@rustbot rustbot added this to the 1.90.0 milestone Jun 26, 2025
@rust-timer
Copy link
Collaborator

📌 Perf builds for each rolled up PR:

PR# Message Perf Build Sha
#142146 Withdraw the claim extern "C-cmse-nonsecure-*" always mat… 42e0892e78890116d5c3501fffcee5c781b95b83 (link)
#142200 tests/ui: A New Order [8/N] 237096c9091735b8622a96b19822721b406c1ea3 (link)
#142724 Add runtime check to avoid overwrite arg in Diag bb03d03df697e180457b2c5b0188904f1c7ded88 (link)
#142809 Add PrintTAFn flag for targeted type analysis printing b85c27fac84941dd024507862b8154333bffd8a7 (link)
#142976 Check CoerceUnsized impl validity before coercing 279e5c1963809e0e05aa995c92092b5659bedb28 (link)
#142992 Convert some ABI tests to use extern "rust-invalid" edd99230bf38604a68303fb5370e1fe8417b5e2b (link)
#143000 Make Sub, Mul, Div and Rem const_traits 2ac5a5a3ba792cc7976a140ffe49103c4a2d616f (link)

previous master: 0fa4ec6cde

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 0fa4ec6 (parent) -> bc4376f (this PR)

Test differences

Show 106 test diffs

Stage 1

  • [crashes] tests/crashes/126269.rs: pass -> [missing] (J1)
  • [crashes] tests/crashes/126982.rs: pass -> [missing] (J1)
  • [crashes] tests/crashes/131048.rs: pass -> [missing] (J1)
  • [crashes] tests/crashes/134217.rs: pass -> [missing] (J1)
  • [crashes] tests/crashes/138265.rs: pass -> [missing] (J1)
  • [ui] tests/ui/abi/unsupported-in-impls.rs: [missing] -> pass (J1)
  • [ui] tests/ui/coercion/invalid-blanket-coerce-unsized-impl.rs: [missing] -> pass (J1)
  • [ui] tests/ui/defaults-well-formedness.rs: pass -> [missing] (J1)
  • [ui] tests/ui/deprecation-in-force-unstable.rs: pass -> [missing] (J1)
  • [ui] tests/ui/deprecation/deprecated_main_function.rs: [missing] -> pass (J1)
  • [ui] tests/ui/deref-rc.rs: pass -> [missing] (J1)
  • [ui] tests/ui/deref.rs: pass -> [missing] (J1)
  • [ui] tests/ui/derive-uninhabited-enum-38885.rs: pass -> [missing] (J1)
  • [ui] tests/ui/derives/derive-debug-uninhabited-enum.rs: [missing] -> pass (J1)
  • [ui] tests/ui/destructure-trait-ref.rs: pass -> [missing] (J1)
  • [ui] tests/ui/diverging-fallback-method-chain.rs: pass -> [missing] (J1)
  • [ui] tests/ui/diverging-fallback-option.rs: pass -> [missing] (J1)
  • [ui] tests/ui/generics/default-type-params-well-formedness.rs: [missing] -> pass (J1)
  • [ui] tests/ui/never_type/never-type-fallback-option.rs: [missing] -> pass (J1)
  • [ui] tests/ui/traits/trait-object-destructure.rs: [missing] -> pass (J1)
  • [ui] tests/ui/typeck/inference-method-chain-diverging-fallback.rs: [missing] -> pass (J1)

Stage 2

  • [ui] tests/ui/abi/unsupported-in-impls.rs: [missing] -> pass (J0)
  • [ui] tests/ui/coercion/invalid-blanket-coerce-unsized-impl.rs: [missing] -> pass (J0)
  • [ui] tests/ui/defaults-well-formedness.rs: pass -> [missing] (J0)
  • [ui] tests/ui/deprecation-in-force-unstable.rs: pass -> [missing] (J0)
  • [ui] tests/ui/deprecation/deprecated_main_function.rs: [missing] -> pass (J0)
  • [ui] tests/ui/deref-rc.rs: pass -> [missing] (J0)
  • [ui] tests/ui/deref.rs: pass -> [missing] (J0)
  • [ui] tests/ui/derive-uninhabited-enum-38885.rs: pass -> [missing] (J0)
  • [ui] tests/ui/derives/derive-debug-uninhabited-enum.rs: [missing] -> pass (J0)
  • [ui] tests/ui/destructure-trait-ref.rs: pass -> [missing] (J0)
  • [ui] tests/ui/diverging-fallback-method-chain.rs: pass -> [missing] (J0)
  • [ui] tests/ui/diverging-fallback-option.rs: pass -> [missing] (J0)
  • [ui] tests/ui/generics/default-type-params-well-formedness.rs: [missing] -> pass (J0)
  • [ui] tests/ui/never_type/never-type-fallback-option.rs: [missing] -> pass (J0)
  • [ui] tests/ui/traits/trait-object-destructure.rs: [missing] -> pass (J0)
  • [ui] tests/ui/typeck/inference-method-chain-diverging-fallback.rs: [missing] -> pass (J0)
  • [crashes] tests/crashes/126269.rs: pass -> [missing] (J2)
  • [crashes] tests/crashes/126982.rs: pass -> [missing] (J2)
  • [crashes] tests/crashes/131048.rs: pass -> [missing] (J2)
  • [crashes] tests/crashes/134217.rs: pass -> [missing] (J2)
  • [crashes] tests/crashes/138265.rs: pass -> [missing] (J2)

Additionally, 64 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 bc4376fa73b636eb6f2c7d48b1f731d70f022c4b --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-apple: 5296.5s -> 6836.1s (29.1%)
  2. dist-apple-various: 7384.7s -> 6063.7s (-17.9%)
  3. x86_64-gnu-aux: 6306.9s -> 7150.5s (13.4%)
  4. x86_64-apple-2: 5022.5s -> 5538.5s (10.3%)
  5. dist-x86_64-apple: 9968.9s -> 10904.9s (9.4%)
  6. x86_64-gnu-llvm-19-3: 6496.9s -> 6967.6s (7.2%)
  7. dist-powerpc-linux: 4743.5s -> 5069.9s (6.9%)
  8. aarch64-gnu: 6816.3s -> 6360.4s (-6.7%)
  9. dist-i686-mingw: 7680.8s -> 8178.3s (6.5%)
  10. x86_64-apple-1: 8144.8s -> 7623.9s (-6.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 (bc4376f): comparison URL.

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

@rustbot label: -perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

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

Max RSS (memory usage)

Results (primary 0.3%, secondary -4.6%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
1.1% [0.9%, 1.3%] 2
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-1.3% [-1.3%, -1.3%] 1
Improvements ✅
(secondary)
-4.6% [-4.6%, -4.6%] 1
All ❌✅ (primary) 0.3% [-1.3%, 1.3%] 3

Cycles

Results (secondary -1.8%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-1.8% [-1.8%, -1.8%] 1
All ❌✅ (primary) - - 0

Binary size

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

Bootstrap: 689.313s -> 692.088s (0.40%)
Artifact size: 372.06 MiB -> 372.11 MiB (0.01%)

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-rustc-dev-guide Area: rustc-dev-guide A-translation Area: Translation infrastructure, and migrating existing diagnostics to SessionDiagnostic F-autodiff `#![feature(autodiff)]` 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-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.

10 participants