Skip to content

Rollup of 6 pull requests#156290

Merged
rust-bors[bot] merged 12 commits intorust-lang:mainfrom
JonathanBrouwer:rollup-PNM9rEm
May 8, 2026
Merged

Rollup of 6 pull requests#156290
rust-bors[bot] merged 12 commits intorust-lang:mainfrom
JonathanBrouwer:rollup-PNM9rEm

Conversation

@JonathanBrouwer
Copy link
Copy Markdown
Contributor

Successful merges:

r? @ghost

Create a similar rollup

Zalathar and others added 12 commits March 12, 2026 17:37
This commit is some minor updates/restructuring in a few locations with
the end result being supporting `-Cpanic=unwind` on WASI targets. This
continues to be off-by-default insofar as WASI targets default to
`-Cpanic=abort`, meaning that actually using anything in this commit
requires `-Zbuild-std`. Specifically the changes made here are:

* The self-contained sysroot for WASI targets now contains a copy of
  `libunwind.a` from wasi-sdk, first shipped with wasi-sdk-33 (also
  updated here).
* The `unwind` crate here in this repository uses the `libunwind` module
  instead of the custom bare-metal wasm implementation of exceptions.
  This means that Rust uses the `_Unwind_*` symbols which allows it to
  interoperate with C/C++/etc.
* Wasm targets are all updated to pass the LLVM argument
  `-wasm-use-legacy-eh=false` to differ from LLVM's/clang's default of
  using the legacy exception handling proposal for WebAssembly. This has
  no effect by default because `panic=abort` is used on most targets.
  Emscripten is exempted from this as the Emscripten target is
  explicitly intended to follow LLVM's/clang's defaults.
* There's a single test in the test suite that links to the
  `panic_unwind` crate which ended up requiring `-Wexceptions` from
  Wasmtime, so the test parts were updated and Wasmtime was updated in
  CI, too.

The net result of all of this is that this should not actually affect
any WebAssembly target's default behavior. Optionally, though, WASI
programs can be built with exception handling via:

    RUSTFLAGS='-Cpanic=unwind' cargo +nightly run -Z build-std --target wasm32-wasip2

Effectively `-Zbuild-std` and `-Cpanic=unwind` is all that's necessary
to enable this support on wasm targets.

Finally, this ends up closing 154593 as well. The WASI targets are now
defined to use `-lunwind` to implement unwinding. This means that the
in-tree definition of `__cpp_exception` is no longer of concern and the
definition is always sourced externally. If Rust is linked with other
C/C++ code using WASI then these idioms are compatible with wasi-sdk,
for example, to use that as a linker. The main caveat is that when using
an external linker the `-fwasm-exceptions` argument needs to be passed
to `clang` for it to be able to find the `libunwind.a` library to link
against.

Closes 154593
…bjorn3

Support `-Cpanic=unwind` on WASI targets

This commit is some minor updates/restructuring in a few locations with the end result being supporting `-Cpanic=unwind` on WASI targets. This continues to be off-by-default insofar as WASI targets default to `-Cpanic=abort`, meaning that actually using anything in this commit requires `-Zbuild-std`. Specifically the changes made here are:

* The self-contained sysroot for WASI targets now contains a copy of `libunwind.a` from wasi-sdk, first shipped with wasi-sdk-33 (also updated here).
* The `unwind` crate here in this repository uses the `libunwind` module instead of the custom bare-metal wasm implementation of exceptions. This means that Rust uses the `_Unwind_*` symbols which allows it to interoperate with C/C++/etc.
* Wasm targets are all updated to pass the LLVM argument `-wasm-use-legacy-eh=false` to differ from LLVM's/clang's default of using the legacy exception handling proposal for WebAssembly. This has no effect by default because `panic=abort` is used on most targets. Emscripten is exempted from this as the Emscripten target is explicitly intended to follow LLVM's/clang's defaults.
* There's a single test in the test suite that links to the `panic_unwind` crate which ended up requiring `-Wexceptions` from Wasmtime, so the test parts were updated and Wasmtime was updated in CI, too.

The net result of all of this is that this should not actually affect any WebAssembly target's default behavior. Optionally, though, WASI programs can be built with exception handling via:

    RUSTFLAGS='-Cpanic=unwind' cargo +nightly run -Z build-std --target wasm32-wasip2

Effectively `-Zbuild-std` and `-Cpanic=unwind` is all that's necessary to enable this support on wasm targets.

Finally, this ends up closing rust-lang#154593 as well. The WASI targets are now defined to use `-lunwind` to implement unwinding. This means that the in-tree definition of `__cpp_exception` is no longer of concern and the definition is always sourced externally. If Rust is linked with other C/C++ code using WASI then these idioms are compatible with wasi-sdk, for example, to use that as a linker. The main caveat is that when using an external linker the `-fwasm-exceptions` argument needs to be passed to `clang` for it to be able to find the `libunwind.a` library to link against.

Closes rust-lang#154593
…rce-shared-first-version, r=oli-obk

Experiment: Reborrow traits

With this PR we now have basic functional Reborrow and CoerceShared traits. The current limitations are:

1. Reborrowable types can only have one lifetime parameter, so as to avoid having to figure out and store in rmeta the information of which lifetimes weaken during reborrowing.
2. Reborrowing of `&mut` wrappers is working (though I've not tested generic wrappers like `Option<&mut T>` yet), but CoerceShared of `&mut` wrappers currently causes an ICE.

The remaining tasks to complete before I'd consider this PR mergeable are:

- [x] Fix ICE on CoerceShared. Unfortunately this might require dipping into rmeta.
- [x] Expand the tests to give a more complete view of the current state of the experiment.

Reborrow traits experiment: rust-lang#145612

Co-authored by @dingxiangfei2009
…n-ice, r=lqd

Add regression test for closure return ICE

Fixes rust-lang#155893
core: drop unmapped ZSTs in array `map`

Fixes rust-lang#152211.
Alternative to rust-lang#152220 and rust-lang#152248.

This makes the `Drain` type use the same ZST-handling strategy as `slice::IterMut`, which stores the remaining length instead of a one-past-the-end pointer when the type is a ZST. I've also removed the const-generic `N` parameter from `Drain` to avoid unnecessary monomorphizations.
Add a suite of ChunkedBitSet union/subtract/intersect test scenarios

While working on rust-lang#153754, I found that these code paths are under-tested.
Add `sync` option to `-Z threads` to force synchronization on one thread

This adds a `sync` option to `-Z threads` to force synchronization while still using one thread. This is useful to measure overhead of synchronization without the noise of additional threads.
@rust-bors rust-bors Bot added the rollup A PR which is a rollup label May 7, 2026
@rustbot rustbot added A-CI Area: Our Github Actions CI A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) 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-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-clippy Relevant to the Clippy team. 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. labels May 7, 2026
@JonathanBrouwer
Copy link
Copy Markdown
Contributor Author

@bors r+ rollup=never p=5

Trying commonly failed jobs
@bors try jobs=dist-various-1,test-various,x86_64-gnu-aux,x86_64-gnu-llvm-21-3,x86_64-msvc-1,aarch64-apple,x86_64-mingw-1,i686-msvc-2

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented May 7, 2026

📌 Commit 05c012f has been approved by JonathanBrouwer

It is now in the queue for this repository.

@rust-bors rust-bors Bot 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 7, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request May 7, 2026
Rollup of 6 pull requests


try-job: dist-various-1
try-job: test-various
try-job: x86_64-gnu-aux
try-job: x86_64-gnu-llvm-21-3
try-job: x86_64-msvc-1
try-job: aarch64-apple
try-job: x86_64-mingw-1
try-job: i686-msvc-2
@rust-bors

This comment has been minimized.

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented May 8, 2026

☀️ Try build successful (CI)
Build commit: 6461a6d (6461a6d05bc8124a4c15387f87d35b4c1d80e7f3, parent: ffccab6abef68b70c5e23cfbfb1ac7680104040d)

@rust-bors rust-bors Bot added merged-by-bors This PR was explicitly merged by bors. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels May 8, 2026
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented May 8, 2026

☀️ Test successful - CI
Approved by: JonathanBrouwer
Duration: 3h 9m 43s
Pushing 63b1dfc to main...

@rust-bors rust-bors Bot merged commit 63b1dfc into rust-lang:main May 8, 2026
13 checks passed
@rustbot rustbot added this to the 1.97.0 milestone May 8, 2026
@rust-timer
Copy link
Copy Markdown
Collaborator

📌 Perf builds for each rolled up PR:

PR# Message Perf Build Sha
#151753 Experiment: Reborrow traits 780259ea354b99cf9eaa7aa0520c42f4c977b043 (link)
#152487 core: drop unmapped ZSTs in array map 188cf0dd686ec1dd5f02c83f69f87fae606bfb6c (link)
#153759 Add a suite of ChunkedBitSet union/subtract/intersect test … 939eaeb456af71dd8632dda9d984ff3ab3a7211b (link)
#156061 Support -Cpanic=unwind on WASI targets 5df24f3b94f90f4f9481933883ea4de05170a052 (link)
#156198 Add sync option to -Z threads to force synchronization … bdd963ec091cb2165e59d69d41a081d8298e1fd2 (link)
#156280 Add regression test for closure return ICE 35d7a833e76a8d2955124753b5f8d05e027f97c1 (link)

previous master: f964de49bc

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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 8, 2026

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 f964de4 (parent) -> 63b1dfc (this PR)

Test differences

Show 62 test diffs

Stage 0

  • bit_set::tests::chunked_bulk_ops: [missing] -> pass (J1)

Stage 1

  • [ui] tests/ui/closures/return-in-closure-with-fn-bound.rs: [missing] -> pass (J1)
  • [ui] tests/ui/reborrow/custom_marker.rs: [missing] -> pass (J1)
  • [ui] tests/ui/reborrow/custom_marker_assign_deref.rs: [missing] -> pass (J1)
  • [ui] tests/ui/reborrow/custom_marker_coerce_shared.rs: [missing] -> pass (J1)
  • [ui] tests/ui/reborrow/custom_marker_coerce_shared_copy.rs: [missing] -> pass (J1)
  • [ui] tests/ui/reborrow/custom_marker_coerce_shared_move.rs: [missing] -> pass (J1)
  • [ui] tests/ui/reborrow/custom_marker_deref.rs: [missing] -> pass (J1)
  • [ui] tests/ui/reborrow/custom_marker_mut_a_b.rs: [missing] -> pass (J1)
  • [ui] tests/ui/reborrow/custom_marker_mut_self.rs: [missing] -> pass (J1)
  • [ui] tests/ui/reborrow/custom_marker_mut_self_a.rs: [missing] -> pass (J1)
  • [ui] tests/ui/reborrow/custom_marker_mut_self_b.rs: [missing] -> pass (J1)
  • [ui] tests/ui/reborrow/custom_marker_two_lifetimes.rs: [missing] -> pass (J1)
  • array::array_map_drops_unmapped_zst_elements_on_panic: [missing] -> pass (J2)
  • bit_set::tests::chunked_bulk_ops: [missing] -> pass (J4)

Stage 2

  • [ui] tests/ui/closures/return-in-closure-with-fn-bound.rs: [missing] -> pass (J0)
  • [ui] tests/ui/reborrow/custom_marker.rs: [missing] -> pass (J0)
  • [ui] tests/ui/reborrow/custom_marker_assign_deref.rs: [missing] -> pass (J0)
  • [ui] tests/ui/reborrow/custom_marker_coerce_shared.rs: [missing] -> pass (J0)
  • [ui] tests/ui/reborrow/custom_marker_coerce_shared_copy.rs: [missing] -> pass (J0)
  • [ui] tests/ui/reborrow/custom_marker_coerce_shared_move.rs: [missing] -> pass (J0)
  • [ui] tests/ui/reborrow/custom_marker_deref.rs: [missing] -> pass (J0)
  • [ui] tests/ui/reborrow/custom_marker_mut_a_b.rs: [missing] -> pass (J0)
  • [ui] tests/ui/reborrow/custom_marker_mut_self.rs: [missing] -> pass (J0)
  • [ui] tests/ui/reborrow/custom_marker_mut_self_a.rs: [missing] -> pass (J0)
  • [ui] tests/ui/reborrow/custom_marker_mut_self_b.rs: [missing] -> pass (J0)
  • [ui] tests/ui/reborrow/custom_marker_two_lifetimes.rs: [missing] -> pass (J0)
  • array::array_map_drops_unmapped_zst_elements_on_panic: [missing] -> pass (J3)

Additionally, 34 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 63b1dfc0e00fd6f8ad7cd8817fc712e7d9b7be59 --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-x86_64-apple: 2h 56m -> 1h 42m (-41.6%)
  2. x86_64-gnu-stable: 1h 49m -> 2h 17m (+25.7%)
  3. dist-sparcv9-solaris: 1h 15m -> 1h 34m (+25.5%)
  4. aarch64-apple: 3h 8m -> 2h 21m (-25.2%)
  5. i686-gnu-nopt-2: 2h 15m -> 1h 43m (-24.2%)
  6. dist-x86_64-msvc-alt: 2h 11m -> 2h 42m (+24.1%)
  7. x86_64-mingw-1: 2h 17m -> 2h 49m (+23.2%)
  8. optional-x86_64-gnu-parallel-frontend: 2h 13m -> 2h 42m (+21.6%)
  9. dist-i686-msvc: 2h 15m -> 1h 49m (-19.3%)
  10. x86_64-gnu-tools: 56m 56s -> 1h 7m (+18.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
Copy Markdown
Collaborator

Finished benchmarking commit (63b1dfc): 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.4%, 0.4%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.1% [-0.2%, -0.1%] 5
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results (primary -1.6%, secondary 1.3%)

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

mean range count
Regressions ❌
(primary)
1.7% [1.6%, 1.9%] 2
Regressions ❌
(secondary)
2.3% [0.6%, 5.4%] 12
Improvements ✅
(primary)
-3.0% [-4.9%, -1.9%] 5
Improvements ✅
(secondary)
-2.7% [-3.0%, -2.4%] 3
All ❌✅ (primary) -1.6% [-4.9%, 1.9%] 7

Cycles

Results (primary 5.1%, secondary 7.2%)

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

mean range count
Regressions ❌
(primary)
5.1% [3.3%, 6.9%] 2
Regressions ❌
(secondary)
10.9% [0.5%, 30.9%] 8
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.7% [-3.9%, -0.9%] 3
All ❌✅ (primary) 5.1% [3.3%, 6.9%] 2

Binary size

This perf run didn't have relevant results for this metric.

Bootstrap: 508.875s -> 498.27s (-2.08%)
Artifact size: 395.04 MiB -> 395.08 MiB (0.01%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-CI Area: Our Github Actions CI A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) 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 T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-clippy Relevant to the Clippy team. 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