diff options
| author | Jubilee Young <workingjubilee@gmail.com> | 2025-03-04 16:50:16 -0800 |
|---|---|---|
| committer | Jubilee Young <workingjubilee@gmail.com> | 2025-03-04 19:57:51 -0800 |
| commit | 8a689878ced1b3c0834ea32265c7d1cd43750db4 (patch) | |
| tree | cfe438d6614cf801ee403626e0d7314179e8e852 | |
| parent | e81fbe30e6bfbfb62f599b03baf0f34bab447bef (diff) | |
| download | rust-8a689878ced1b3c0834ea32265c7d1cd43750db4.tar.gz rust-8a689878ced1b3c0834ea32265c7d1cd43750db4.zip | |
compiler: use `is_rustic_abi` in ty_utils
expands some conditionals to include different "rustic" ABIs, so that we actually handle passing args through all "rustic" ABIs
| -rw-r--r-- | compiler/rustc_ty_utils/src/abi.rs | 7 | ||||
| -rw-r--r-- | tests/crashes/132981.rs | 11 | ||||
| -rw-r--r-- | tests/ui/abi/rust-cold-works-with-rustic-args.rs | 6 |
3 files changed, 8 insertions, 16 deletions
diff --git a/compiler/rustc_ty_utils/src/abi.rs b/compiler/rustc_ty_utils/src/abi.rs index e317768ff60..a726ebae6fe 100644 --- a/compiler/rustc_ty_utils/src/abi.rs +++ b/compiler/rustc_ty_utils/src/abi.rs @@ -436,10 +436,7 @@ fn fn_abi_sanity_check<'tcx>( ) { let tcx = cx.tcx(); - if spec_abi == ExternAbi::Rust - || spec_abi == ExternAbi::RustCall - || spec_abi == ExternAbi::RustCold - { + if spec_abi.is_rustic_abi() { if arg.layout.is_zst() { // Casting closures to function pointers depends on ZST closure types being // omitted entirely in the calling convention. @@ -687,7 +684,7 @@ fn fn_abi_adjust_for_abi<'tcx>( let tcx = cx.tcx(); - if abi == ExternAbi::Rust || abi == ExternAbi::RustCall || abi == ExternAbi::RustIntrinsic { + if abi.is_rustic_abi() { fn_abi.adjust_for_rust_abi(cx, abi); // Look up the deduced parameter attributes for this function, if we have its def ID and diff --git a/tests/crashes/132981.rs b/tests/crashes/132981.rs deleted file mode 100644 index 916c1559240..00000000000 --- a/tests/crashes/132981.rs +++ /dev/null @@ -1,11 +0,0 @@ -//@ known-bug: #132981 -//@compile-flags: -Clink-dead-code=true --crate-type lib -//@ only-x86_64 -//@ ignore-windows -// The set of targets this crashes on is really fiddly, because it is deep in our ABI logic. It -// crashes on x86_64-unknown-linux-gnu, and i686-pc-windows-msvc, but not on -// x86_64-pc-windows-msvc. If you are trying to fix this crash, don't pay too much attention to the -// directives. - -#![feature(rust_cold_cc)] -pub extern "rust-cold" fn foo(_: [usize; 3]) {} diff --git a/tests/ui/abi/rust-cold-works-with-rustic-args.rs b/tests/ui/abi/rust-cold-works-with-rustic-args.rs new file mode 100644 index 00000000000..57027364699 --- /dev/null +++ b/tests/ui/abi/rust-cold-works-with-rustic-args.rs @@ -0,0 +1,6 @@ +//@build-pass +//@compile-flags: -Clink-dead-code=true --crate-type lib +// We used to not handle all "rustic" ABIs in a (relatively) uniform way, +// so we failed to fix up arguments for actually passing through the ABI... +#![feature(rust_cold_cc)] +pub extern "rust-cold" fn foo(_: [usize; 3]) {} |
