Skip to content
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

Make _Unwind_Action a type alias, not enum #138573

Merged
merged 1 commit into from
Mar 17, 2025

Conversation

Noratrieb
Copy link
Member

It's bitflags in practice, so an enum is unsound, as an enum must only have the described values. The x86_64 psABI declares it as a typedef int _Unwind_Action, which seems reasonable. I made a newtype first but that was more annoying than just a typedef. We don't really use this value for much other than a short check.

I ran x check library --target aarch64-unknown-linux-gnu,x86_64-pc-windows-gnu,x86_64-fortanix-unknown-sgx,x86_64-unknown-haiku,x86_64-unknown-fuchsi a,x86_64-unknown-freebsd,x86_64-unknown-dragonfly,x86_64-unknown-netbsd,x86_64-unknown-openbsd,x86_64-unknown-redox,riscv64-linux-android,armv7-unknown-freebsd (and some more but they failed to build for other reasons :D)

fixes #138558

r? workingjubilee have fun

It's bitflags in practice, so an enum is unsound, as an enum must only
have the described values. The x86_64 psABI declares it as a `typedef
int _Unwind_Action`, which seems reasonable. I made a newtype first but
that was more annoying than just a typedef. We don't really use this
value for much other than a short check.
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Mar 16, 2025
@workingjubilee
Copy link
Member

seems fine to me.

@workingjubilee
Copy link
Member

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Mar 16, 2025

📌 Commit f20a6c7 has been approved by workingjubilee

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 Mar 16, 2025
jhpratt added a commit to jhpratt/rust that referenced this pull request Mar 16, 2025
…, r=workingjubilee

Make `_Unwind_Action` a type alias, not enum

It's bitflags in practice, so an enum is unsound, as an enum must only have the described values. The x86_64 psABI declares it as a `typedef int _Unwind_Action`, which seems reasonable. I made a newtype first but that was more annoying than just a typedef. We don't really use this value for much other than a short check.

I ran `x check library --target aarch64-unknown-linux-gnu,x86_64-pc-windows-gnu,x86_64-fortanix-unknown-sgx,x86_64-unknown-haiku,x86_64-unknown-fuchsi
a,x86_64-unknown-freebsd,x86_64-unknown-dragonfly,x86_64-unknown-netbsd,x86_64-unknown-openbsd,x86_64-unknown-redox,riscv64-linux-android,armv7-unknown-freebsd` (and some more but they failed to build for other reasons :D)

fixes rust-lang#138558

r? workingjubilee have fun
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 16, 2025
Rollup of 7 pull requests

Successful merges:

 - rust-lang#136293 (document capacity for ZST as example)
 - rust-lang#136355 (Add `*_value` methods to proc_macro lib)
 - rust-lang#136359 (doc all differences of ptr:copy(_nonoverlapping) with memcpy and memmove)
 - rust-lang#136816 (refactor `notable_traits_button` to use iterator combinators  instead of for loop)
 - rust-lang#138363 (Add `From<{integer}>` for `f16`/`f128` impls)
 - rust-lang#138552 (Misc print request handling cleanups + a centralized test for print request stability gating)
 - rust-lang#138573 (Make `_Unwind_Action` a type alias, not enum)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 17, 2025
Rollup of 5 pull requests

Successful merges:

 - rust-lang#136293 (document capacity for ZST as example)
 - rust-lang#136359 (doc all differences of ptr:copy(_nonoverlapping) with memcpy and memmove)
 - rust-lang#136816 (refactor `notable_traits_button` to use iterator combinators  instead of for loop)
 - rust-lang#138552 (Misc print request handling cleanups + a centralized test for print request stability gating)
 - rust-lang#138573 (Make `_Unwind_Action` a type alias, not enum)

r? `@ghost`
`@rustbot` modify labels: rollup
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Mar 17, 2025
Rollup merge of rust-lang#138573 - Noratrieb:no-unsound-bad-bonk-bonk, r=workingjubilee

Make `_Unwind_Action` a type alias, not enum

It's bitflags in practice, so an enum is unsound, as an enum must only have the described values. The x86_64 psABI declares it as a `typedef int _Unwind_Action`, which seems reasonable. I made a newtype first but that was more annoying than just a typedef. We don't really use this value for much other than a short check.

I ran `x check library --target aarch64-unknown-linux-gnu,x86_64-pc-windows-gnu,x86_64-fortanix-unknown-sgx,x86_64-unknown-haiku,x86_64-unknown-fuchsi
a,x86_64-unknown-freebsd,x86_64-unknown-dragonfly,x86_64-unknown-netbsd,x86_64-unknown-openbsd,x86_64-unknown-redox,riscv64-linux-android,armv7-unknown-freebsd` (and some more but they failed to build for other reasons :D)

fixes rust-lang#138558

r? workingjubilee have fun
@bors bors merged commit 5144055 into rust-lang:master Mar 17, 2025
6 checks passed
@rustbot rustbot added this to the 1.87.0 milestone Mar 17, 2025
@Noratrieb Noratrieb deleted the no-unsound-bad-bonk-bonk branch March 17, 2025 06:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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.

std personality _Unwind_Action should not be a enum
4 participants