Rollup merge of #139498 - alexcrichton:wasm-zst-safe, r=wesleywiser
Ignore zero-sized types in wasm future-compat warning This commit fixes a false positive of the warning triggered for #138762 and the fix is to codify that zero-sized types are "safe" in both the old and new ABIs.
This commit is contained in:
commit
8b7a2897c8
2 changed files with 11 additions and 0 deletions
|
@ -111,6 +111,11 @@ fn wasm_abi_safe<'tcx>(tcx: TyCtxt<'tcx>, arg: &ArgAbi<'tcx, Ty<'tcx>>) -> bool
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Zero-sized types are dropped in both ABIs, so they're safe
|
||||||
|
if arg.layout.is_zst() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,3 +39,9 @@ pub fn call_other_fun(x: MyType) {
|
||||||
unsafe { other_fun(x) } //~ERROR: wasm ABI transition
|
unsafe { other_fun(x) } //~ERROR: wasm ABI transition
|
||||||
//~^WARN: previously accepted
|
//~^WARN: previously accepted
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Zero-sized types are safe in both ABIs
|
||||||
|
#[repr(C)]
|
||||||
|
pub struct MyZstType;
|
||||||
|
#[allow(improper_ctypes_definitions)]
|
||||||
|
pub extern "C" fn zst_safe(_x: (), _y: MyZstType) {}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue