about summary refs log tree commit diff
diff options
context:
space:
mode:
authorjumbatm <30644300+jumbatm@users.noreply.github.com>2020-12-12 13:26:43 +1000
committerjumbatm <30644300+jumbatm@users.noreply.github.com>2021-01-12 03:31:00 +1000
commit6318db1c5a06a08a6b4063b25a63df3c328a5bd7 (patch)
tree413a3e9a60ae1e2f1fc8355c8c65ba0501c2ca94
parenta2cd91ceb0f156cb442d75e12dc77c3d064cdde4 (diff)
downloadrust-6318db1c5a06a08a6b4063b25a63df3c328a5bd7.tar.gz
rust-6318db1c5a06a08a6b4063b25a63df3c328a5bd7.zip
Add test case for wasm non-clash.
-rw-r--r--src/test/ui/lint/clashing-extern-fn-wasm.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/test/ui/lint/clashing-extern-fn-wasm.rs b/src/test/ui/lint/clashing-extern-fn-wasm.rs
new file mode 100644
index 00000000000..eeb2b8eae25
--- /dev/null
+++ b/src/test/ui/lint/clashing-extern-fn-wasm.rs
@@ -0,0 +1,21 @@
+// check-pass
+#![crate_type = "lib"]
+
+#[cfg(target_arch = "wasm32")]
+mod wasm_non_clash {
+    mod a {
+        #[link(wasm_import_module = "a")]
+        extern "C" {
+            pub fn foo();
+        }
+    }
+
+    mod b {
+        #[link(wasm_import_module = "b")]
+        extern "C" {
+            pub fn foo() -> usize;
+            // #79581: These declarations shouldn't clash because foreign fn names are mangled
+            // on wasm32.
+        }
+    }
+}