Skip to content

Commit

Permalink
compiler: use is_rustic_abi in ty_utils
Browse files Browse the repository at this point in the history
expands some conditionals to include different "rustic" ABIs, so that we
actually handle passing args through all "rustic" ABIs
  • Loading branch information
workingjubilee committed Mar 5, 2025
1 parent e81fbe3 commit 8a68987
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 16 deletions.
7 changes: 2 additions & 5 deletions compiler/rustc_ty_utils/src/abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down
11 changes: 0 additions & 11 deletions tests/crashes/132981.rs

This file was deleted.

6 changes: 6 additions & 0 deletions tests/ui/abi/rust-cold-works-with-rustic-args.rs
Original file line number Diff line number Diff line change
@@ -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]) {}

0 comments on commit 8a68987

Please sign in to comment.