Skip to content

Conversation

@purplesyringa
Copy link
Contributor

@purplesyringa purplesyringa commented Oct 30, 2025

Fixes #148246, less invasive than the previously proposed #148269. Removes the publicly visible unstable intrinsic tracked in #122465 since it's not clear how to export it in a sound manner.

r? @bjorn3


rustc assumes that regular extern "Rust" functions unwind only if the unwind panic runtime is linked. throw was annotated as such, but unwound unconditionally. This could cause UB when a crate built with -C panic=abort called throw from core built with -C panic=unwind, since no terminator was added to handle the panic arising from calling an allegedly non-unwinding extern "Rust" function.

rustc was taught to recognize this condition since #144225 and prevented such linkage, but this caused regressions in
#148246, since this meant that Emscripten projects could not be built with -C panic=abort without recompiling std.

The most straightforward solution would be to move throw into the panic_unwind crate, so that it's only compiled if the panic runtime is guaranteed to be unwind, but this is messy due to our architecture. Instead, move it into unwind::wasm, which is only compiled for bare-metal targets that default to panic = "abort", rendering the issue moot.

rustc assumes that regular `extern "Rust"` functions unwind only if the
`unwind` panic runtime is linked. `throw` was annotated as such, but
unwound unconditionally. This could cause UB when a crate built with `-C
panic=abort` called `throw` from `core` built with `-C panic=unwind`,
since no terminator was added to handle the panic arising from calling an
allegedly non-unwinding `extern "Rust"` function.

rustc was taught to recognize this condition since
rust-lang#144225 and prevented such
linkage, but this caused regressions in
rust-lang#148246, since this meant that
Emscripten projects could not be built with `-C panic=abort` without
recompiling std.

The most straightforward solution would be to move `throw` into the
`panic_unwind` crate, so that it's only compiled if the panic runtime is
guaranteed to be `unwind`, but this is messy due to our architecture.
Instead, move it into `unwind::wasm`, which is only compiled for
bare-metal targets that default to `panic = "abort"`, rendering the
issue moot.
@rustbot
Copy link
Collaborator

rustbot commented Oct 30, 2025

stdarch is developed in its own repository. If possible, consider making this change to rust-lang/stdarch instead.

cc @Amanieu, @folkertdev, @sayantn

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 30, 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. labels Oct 30, 2025
@bjorn3
Copy link
Member

bjorn3 commented Oct 30, 2025

@bors r+

@bors
Copy link
Collaborator

bors commented Oct 30, 2025

📌 Commit 420544a has been approved by bjorn3

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 Oct 30, 2025
purplesyringa added a commit to iex-rs/lithium that referenced this pull request Oct 30, 2025
@bors
Copy link
Collaborator

bors commented Oct 30, 2025

⌛ Testing commit 420544a with merge 8205e6b...

@bors
Copy link
Collaborator

bors commented Oct 30, 2025

☀️ Test successful - checks-actions
Approved by: bjorn3
Pushing 8205e6b to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Oct 30, 2025
@bors bors merged commit 8205e6b into rust-lang:master Oct 30, 2025
12 checks passed
@rustbot rustbot added this to the 1.93.0 milestone Oct 30, 2025
@github-actions
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 6906167 (parent) -> 8205e6b (this PR)

Test differences

Show 4 test diffs

Stage 1

  • [ui] tests/ui/wasm/wasm-link-to-panic-abort-issue-148246.rs: [missing] -> ignore (only executed when the architecture is wasm32) (J1)

Stage 2

  • [ui] tests/ui/wasm/wasm-link-to-panic-abort-issue-148246.rs: [missing] -> ignore (only executed when the architecture is wasm32) (J0)

Additionally, 2 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 8205e6b75ec656305ac235d4726d2c7a1ddcef14 --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-gnu-llvm-20-2: 6016.0s -> 5106.5s (-15.1%)
  2. aarch64-gnu-llvm-20-2: 2569.6s -> 2196.4s (-14.5%)
  3. x86_64-gnu-tools: 3783.8s -> 3324.7s (-12.1%)
  4. pr-check-1: 1677.3s -> 1479.0s (-11.8%)
  5. dist-apple-various: 3362.9s -> 3755.6s (+11.7%)
  6. i686-gnu-2: 6279.5s -> 5552.7s (-11.6%)
  7. dist-x86_64-apple: 7544.2s -> 6678.3s (-11.5%)
  8. dist-aarch64-msvc: 5221.7s -> 5754.4s (+10.2%)
  9. x86_64-gnu-aux: 6749.2s -> 7423.0s (+10.0%)
  10. aarch64-gnu: 7036.5s -> 6334.3s (-10.0%)
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 (8205e6b): comparison URL.

Overall result: ✅ 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
Improvements ✅
(primary)
-3.0% [-3.0%, -3.0%] 1
Improvements ✅
(secondary)
-0.8% [-0.8%, -0.8%] 1
All ❌✅ (primary) -3.0% [-3.0%, -3.0%] 1

Max RSS (memory usage)

Results (primary 0.3%, secondary -3.3%)

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

mean range count
Regressions ❌
(primary)
4.0% [4.0%, 4.0%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-3.5% [-3.5%, -3.5%] 1
Improvements ✅
(secondary)
-3.3% [-4.6%, -2.1%] 5
All ❌✅ (primary) 0.3% [-3.5%, 4.0%] 2

Cycles

Results (primary -3.6%, secondary 2.6%)

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)
2.6% [2.3%, 2.9%] 2
Improvements ✅
(primary)
-3.6% [-3.6%, -3.6%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -3.6% [-3.6%, -3.6%] 1

Binary size

Results (primary -1.1%, secondary 0.0%)

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.0% [0.0%, 0.0%] 1
Improvements ✅
(primary)
-1.1% [-1.1%, -1.1%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -1.1% [-1.1%, -1.1%] 1

Bootstrap: 475.565s -> 475.886s (0.07%)
Artifact size: 390.38 MiB -> 390.36 MiB (-0.01%)

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

Labels

merged-by-bors This PR was explicitly merged by bors. 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.

Core crate doesn't support panic="abort" in 1.90 wasm32-unknown-emscripten

5 participants