ignore unsized types in mips64 and sparc64 callconvs · rust-lang/rust@bbf7dc0 (original) (raw)
File tree
3 files changed
lines changed
- compiler/rustc_target/src/callconv
3 files changed
lines changed
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -148,12 +148,12 @@ where | ||
| 148 | 148 | Ty: TyAbiInterface<'a, C> + Copy, |
| 149 | 149 | C: HasDataLayout, |
| 150 | 150 | { |
| 151 | -if !fn_abi.ret.is_ignore() { | |
| 151 | +if !fn_abi.ret.is_ignore() && fn_abi.ret.layout.is_sized() { | |
| 152 | 152 | classify_ret(cx, &mut fn_abi.ret); |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | for arg in fn_abi.args.iter_mut() { |
| 156 | -if arg.is_ignore() { | |
| 156 | +if arg.is_ignore() | | |
| 157 | 157 | continue; |
| 158 | 158 | } |
| 159 | 159 | classify_arg(cx, arg); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -216,11 +216,14 @@ where | ||
| 216 | 216 | Ty: TyAbiInterface<'a, C> + Copy, |
| 217 | 217 | C: HasDataLayout + HasTargetSpec, |
| 218 | 218 | { |
| 219 | -if !fn_abi.ret.is_ignore() { | |
| 219 | +if !fn_abi.ret.is_ignore() && fn_abi.ret.layout.is_sized() { | |
| 220 | 220 | classify_arg(cx, &mut fn_abi.ret, Size::from_bytes(32)); |
| 221 | 221 | } |
| 222 | 222 | |
| 223 | 223 | for arg in fn_abi.args.iter_mut() { |
| 224 | +if !arg.layout.is_sized() { | |
| 225 | +continue; | |
| 226 | +} | |
| 224 | 227 | if arg.is_ignore() { |
| 225 | 228 | // sparc64-unknown-linux-{gnu,musl,uclibc} doesn't ignore ZSTs. |
| 226 | 229 | if cx.target_spec().os == Os::Linux |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -280,7 +280,8 @@ macro_rules! test_transparent_unsized { | ||
| 280 | 280 | }; |
| 281 | 281 | } |
| 282 | 282 | |
| 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 | |
| 284 | 285 | mod unsized_ { |
| 285 | 286 | use super::*; |
| 286 | 287 | test_transparent_unsized!(str_, str); |