diff options
| author | Jacob Pratt <jacob@jhpratt.dev> | 2025-03-16 21:47:45 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-03-16 21:47:45 -0400 |
| commit | 514405505509e410865dc8648bc2df7a0ca59749 (patch) | |
| tree | 25a50bace09c9b3cf062f3d9b7d05eb83bff5db6 /library/std/src/sys | |
| parent | 6da26f7cfed691273e1d6e287a6d0aaa548a44bb (diff) | |
| parent | f20a6c70fb7a1b9bf1b855e6d1e711c1afd6bb48 (diff) | |
| download | rust-514405505509e410865dc8648bc2df7a0ca59749.tar.gz rust-514405505509e410865dc8648bc2df7a0ca59749.zip | |
Rollup merge of #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 #138558 r? workingjubilee have fun
Diffstat (limited to 'library/std/src/sys')
| -rw-r--r-- | library/std/src/sys/personality/gcc.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/library/std/src/sys/personality/gcc.rs b/library/std/src/sys/personality/gcc.rs index cd2c7899f4b..9a5b3b2fd19 100644 --- a/library/std/src/sys/personality/gcc.rs +++ b/library/std/src/sys/personality/gcc.rs @@ -220,7 +220,7 @@ cfg_if::cfg_if! { Ok(action) => action, Err(_) => return uw::_URC_FATAL_PHASE1_ERROR, }; - if actions as i32 & uw::_UA_SEARCH_PHASE as i32 != 0 { + if actions & uw::_UA_SEARCH_PHASE != 0 { match eh_action { EHAction::None | EHAction::Cleanup(_) => uw::_URC_CONTINUE_UNWIND, EHAction::Catch(_) | EHAction::Filter(_) => uw::_URC_HANDLER_FOUND, @@ -230,7 +230,7 @@ cfg_if::cfg_if! { match eh_action { EHAction::None => uw::_URC_CONTINUE_UNWIND, // Forced unwinding hits a terminate action. - EHAction::Filter(_) if actions as i32 & uw::_UA_FORCE_UNWIND as i32 != 0 => uw::_URC_CONTINUE_UNWIND, + EHAction::Filter(_) if actions & uw::_UA_FORCE_UNWIND != 0 => uw::_URC_CONTINUE_UNWIND, EHAction::Cleanup(lpad) | EHAction::Catch(lpad) | EHAction::Filter(lpad) => { uw::_Unwind_SetGR( context, |
