Is it guaranteed that a ZST argument has no effect on a function's ABI? For example, are the following two functions guaranteed to have the same ABI?
extern "C" {
fn foo(a: u8, b: u16);
fn bar(a: u8, x: (), b: u16);
}
Is it guaranteed that a ZST argument has no effect on a function's ABI? For example, are the following two functions guaranteed to have the same ABI?
extern "C" {
fn foo(a: u8, b: u16);
fn bar(a: u8, x: (), b: u16);
}
I don't think so:
ZSTs in function argument position are definitely not just ignored, at least one ABI passes them as pointers. I reported a bug about rustc mishandling that a while ago and it got fixed here: fix handling of ZST in win64 ABI on windows-msvc targets by RalfJung · Pull Request #135204 · rust-lang/rust · GitHub