diff --git a/compiler/rustc_target/src/abi/call/sparc64.rs b/compiler/rustc_target/src/abi/call/sparc64.rs index cbed5b4afc134..97d48a79aebfa 100644 --- a/compiler/rustc_target/src/abi/call/sparc64.rs +++ b/compiler/rustc_target/src/abi/call/sparc64.rs @@ -98,7 +98,7 @@ fn parse_structure<'a, Ty, C>( cx: &C, layout: TyAndLayout<'a, Ty>, mut data: Sdata, - mut offset: Size, + offset: Size, ) -> Sdata where Ty: TyAbiInterface<'a, C> + Copy, @@ -115,9 +115,15 @@ where abi::Abi::Aggregate { .. } => { for i in 0..layout.fields.count() { if offset < layout.fields.offset(i) { - offset = layout.fields.offset(i); + data = parse_structure( + cx, + layout.field(cx, i), + data.clone(), + layout.fields.offset(i), + ); + } else { + data = parse_structure(cx, layout.field(cx, i), data.clone(), offset); } - data = parse_structure(cx, layout.field(cx, i), data.clone(), offset); } } _ => { diff --git a/tests/ui/abi/compatibility.rs b/tests/ui/abi/compatibility.rs index d5f0531307838..7edc1e01b7389 100644 --- a/tests/ui/abi/compatibility.rs +++ b/tests/ui/abi/compatibility.rs @@ -265,7 +265,6 @@ test_abi_compatible!(fn_fn, fn(), fn(i32) -> i32); // Compatibility of 1-ZST. test_abi_compatible!(zst_unit, Zst, ()); -#[cfg(not(any(target_arch = "sparc64")))] test_abi_compatible!(zst_array, Zst, [u8; 0]); test_abi_compatible!(nonzero_int, NonZeroI32, i32); @@ -306,7 +305,7 @@ test_transparent!(zst, Zst); test_transparent!(unit, ()); test_transparent!(enum_, Option); test_transparent!(enum_niched, Option<&'static i32>); -#[cfg(not(any(target_arch = "mips64", target_arch = "sparc64")))] +#[cfg(not(target_arch = "mips64"))] mod tuples { use super::*; // mixing in some floats since they often get special treatment @@ -320,7 +319,7 @@ mod tuples { test_transparent!(tuple, (i32, f32, i64, f64)); } // Some targets have special rules for arrays. -#[cfg(not(any(target_arch = "mips64", target_arch = "sparc64")))] +#[cfg(not(target_arch = "mips64"))] mod arrays { use super::*; test_transparent!(empty_array, [u32; 0]); @@ -342,7 +341,7 @@ macro_rules! test_transparent_unsized { }; } -#[cfg(not(any(target_arch = "mips64", target_arch = "sparc64")))] +#[cfg(not(target_arch = "mips64"))] mod unsized_ { use super::*; test_transparent_unsized!(str_, str);