Skip to content

Commit ea97dd9

Browse files
authored
Unrolled build for #149041
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 #148302). The vast majority of our callconv implementations already ignore unsized types, `sparc64` and `mips64` I guess were missed. r? `````@bjorn3`````
2 parents 2c0f486 + bbf7dc0 commit ea97dd9

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

compiler/rustc_target/src/callconv/mips64.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,12 +148,12 @@ where
148148
Ty: TyAbiInterface<'a, C> + Copy,
149149
C: HasDataLayout,
150150
{
151-
if !fn_abi.ret.is_ignore() {
151+
if !fn_abi.ret.is_ignore() && fn_abi.ret.layout.is_sized() {
152152
classify_ret(cx, &mut fn_abi.ret);
153153
}
154154

155155
for arg in fn_abi.args.iter_mut() {
156-
if arg.is_ignore() {
156+
if arg.is_ignore() || !arg.layout.is_sized() {
157157
continue;
158158
}
159159
classify_arg(cx, arg);

compiler/rustc_target/src/callconv/sparc64.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,11 +216,14 @@ where
216216
Ty: TyAbiInterface<'a, C> + Copy,
217217
C: HasDataLayout + HasTargetSpec,
218218
{
219-
if !fn_abi.ret.is_ignore() {
219+
if !fn_abi.ret.is_ignore() && fn_abi.ret.layout.is_sized() {
220220
classify_arg(cx, &mut fn_abi.ret, Size::from_bytes(32));
221221
}
222222

223223
for arg in fn_abi.args.iter_mut() {
224+
if !arg.layout.is_sized() {
225+
continue;
226+
}
224227
if arg.is_ignore() {
225228
// sparc64-unknown-linux-{gnu,musl,uclibc} doesn't ignore ZSTs.
226229
if cx.target_spec().os == Os::Linux

tests/ui/abi/compatibility.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,8 @@ macro_rules! test_transparent_unsized {
280280
};
281281
}
282282

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

0 commit comments

Comments
 (0)