Rollup merge of #149041 - folkertdev:sparc64-mips64-ignore-unsized, r=bjorn3

ignore unsized types in mips64 and sparc64 callconvs

Non-rustic calling conventions should not make up an ABI for unsized types (cc https://github.com/rust-lang/rust/pull/148302). The vast majority of our callconv implementations already ignore unsized types, `sparc64` and `mips64` I guess were missed.

r? `````@bjorn3`````
This commit is contained in:
Matthias Krüger 2025-11-20 11:15:53 +01:00 committed by GitHub
commit 7198d31e4b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 8 additions and 4 deletions

View file

@ -148,12 +148,12 @@ where
Ty: TyAbiInterface<'a, C> + Copy,
C: HasDataLayout,
{
if !fn_abi.ret.is_ignore() {
if !fn_abi.ret.is_ignore() && fn_abi.ret.layout.is_sized() {
classify_ret(cx, &mut fn_abi.ret);
}
for arg in fn_abi.args.iter_mut() {
if arg.is_ignore() {
if arg.is_ignore() || !arg.layout.is_sized() {
continue;
}
classify_arg(cx, arg);

View file

@ -216,11 +216,14 @@ where
Ty: TyAbiInterface<'a, C> + Copy,
C: HasDataLayout + HasTargetSpec,
{
if !fn_abi.ret.is_ignore() {
if !fn_abi.ret.is_ignore() && fn_abi.ret.layout.is_sized() {
classify_arg(cx, &mut fn_abi.ret, Size::from_bytes(32));
}
for arg in fn_abi.args.iter_mut() {
if !arg.layout.is_sized() {
continue;
}
if arg.is_ignore() {
// sparc64-unknown-linux-{gnu,musl,uclibc} doesn't ignore ZSTs.
if cx.target_spec().os == Os::Linux

View file

@ -280,7 +280,8 @@ macro_rules! test_transparent_unsized {
};
}
#[cfg(not(any(target_arch = "mips64", target_arch = "sparc64")))]
// NOTE: non-rustic ABIs do not support unsized types: they are skipped during ABI generation, and
// will trigger an error if they make it to rustc_monomorphize/src/mono_checks/abi_check.rs
mod unsized_ {
use super::*;
test_transparent_unsized!(str_, str);