about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2025-04-07 12:35:02 -0700
committerAlex Crichton <alex@alexcrichton.com>2025-04-17 07:42:55 -0700
commitf9091e24a0af713378ee705c86689c1435d0b157 (patch)
treef34b1f5804aa00eda406f6f8c9c194f8f77a35ea /tests
parente0883a2a6c8e4afcb6e26a182885f687ba63a7f5 (diff)
downloadrust-f9091e24a0af713378ee705c86689c1435d0b157.tar.gz
rust-f9091e24a0af713378ee705c86689c1435d0b157.zip
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.
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/lint/wasm_c_abi_transition.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/ui/lint/wasm_c_abi_transition.rs b/tests/ui/lint/wasm_c_abi_transition.rs
index 1fe81679e65..6a933a0de03 100644
--- a/tests/ui/lint/wasm_c_abi_transition.rs
+++ b/tests/ui/lint/wasm_c_abi_transition.rs
@@ -39,3 +39,9 @@ pub fn call_other_fun(x: MyType) {
     unsafe { other_fun(x) } //~ERROR: wasm ABI transition
     //~^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) {}