summaryrefslogtreecommitdiffstats
path: root/src/test/ui/wasm
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
commit698f8c2f01ea549d77d7dc3338a12e04c11057b9 (patch)
tree173a775858bd501c378080a10dca74132f05bc50 /src/test/ui/wasm
parentInitial commit. (diff)
downloadrustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.tar.xz
rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.zip
Adding upstream version 1.64.0+dfsg1.upstream/1.64.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/ui/wasm')
-rw-r--r--src/test/ui/wasm/simd-to-array-80108.rs15
-rw-r--r--src/test/ui/wasm/wasm-hang-issue-76281.rs12
-rw-r--r--src/test/ui/wasm/wasm-import-module.rs21
-rw-r--r--src/test/ui/wasm/wasm-import-module.stderr38
4 files changed, 86 insertions, 0 deletions
diff --git a/src/test/ui/wasm/simd-to-array-80108.rs b/src/test/ui/wasm/simd-to-array-80108.rs
new file mode 100644
index 000000000..0576c2e6b
--- /dev/null
+++ b/src/test/ui/wasm/simd-to-array-80108.rs
@@ -0,0 +1,15 @@
+// only-wasm32
+// compile-flags: --crate-type=lib -Copt-level=2
+// build-pass
+#![feature(repr_simd)]
+
+// Regression test for #80108
+
+#[repr(simd)]
+pub struct Vector([i32; 4]);
+
+impl Vector {
+ pub const fn to_array(self) -> [i32; 4] {
+ self.0
+ }
+}
diff --git a/src/test/ui/wasm/wasm-hang-issue-76281.rs b/src/test/ui/wasm/wasm-hang-issue-76281.rs
new file mode 100644
index 000000000..a4adfa6d0
--- /dev/null
+++ b/src/test/ui/wasm/wasm-hang-issue-76281.rs
@@ -0,0 +1,12 @@
+// only-wasm32
+// compile-flags: -C opt-level=2
+// build-pass
+
+// Regression test for #76281.
+// This seems like an issue related to LLVM rather than
+// libs-impl so place here.
+
+fn main() {
+ let mut v: Vec<&()> = Vec::new();
+ v.sort_by_key(|&r| r as *const ());
+}
diff --git a/src/test/ui/wasm/wasm-import-module.rs b/src/test/ui/wasm/wasm-import-module.rs
new file mode 100644
index 000000000..bff08847d
--- /dev/null
+++ b/src/test/ui/wasm/wasm-import-module.rs
@@ -0,0 +1,21 @@
+#![feature(link_cfg)]
+
+#[link(name = "...", wasm_import_module)] //~ ERROR: must be of the form
+extern "C" {}
+
+#[link(name = "...", wasm_import_module(x))] //~ ERROR: must be of the form
+extern "C" {}
+
+#[link(name = "...", wasm_import_module())] //~ ERROR: must be of the form
+extern "C" {}
+
+#[link(wasm_import_module = "foo", name = "bar")] //~ ERROR: `wasm_import_module` is incompatible with other arguments
+extern "C" {}
+
+#[link(wasm_import_module = "foo", kind = "dylib")] //~ ERROR: `wasm_import_module` is incompatible with other arguments
+extern "C" {}
+
+#[link(wasm_import_module = "foo", cfg(FALSE))] //~ ERROR: `wasm_import_module` is incompatible with other arguments
+extern "C" {}
+
+fn main() {}
diff --git a/src/test/ui/wasm/wasm-import-module.stderr b/src/test/ui/wasm/wasm-import-module.stderr
new file mode 100644
index 000000000..e792c33e9
--- /dev/null
+++ b/src/test/ui/wasm/wasm-import-module.stderr
@@ -0,0 +1,38 @@
+error: wasm import module must be of the form `wasm_import_module = "string"`
+ --> $DIR/wasm-import-module.rs:3:22
+ |
+LL | #[link(name = "...", wasm_import_module)]
+ | ^^^^^^^^^^^^^^^^^^
+
+error: wasm import module must be of the form `wasm_import_module = "string"`
+ --> $DIR/wasm-import-module.rs:6:22
+ |
+LL | #[link(name = "...", wasm_import_module(x))]
+ | ^^^^^^^^^^^^^^^^^^^^^
+
+error: wasm import module must be of the form `wasm_import_module = "string"`
+ --> $DIR/wasm-import-module.rs:9:22
+ |
+LL | #[link(name = "...", wasm_import_module())]
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error: `wasm_import_module` is incompatible with other arguments in `#[link]` attributes
+ --> $DIR/wasm-import-module.rs:12:8
+ |
+LL | #[link(wasm_import_module = "foo", name = "bar")]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: `wasm_import_module` is incompatible with other arguments in `#[link]` attributes
+ --> $DIR/wasm-import-module.rs:15:8
+ |
+LL | #[link(wasm_import_module = "foo", kind = "dylib")]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: `wasm_import_module` is incompatible with other arguments in `#[link]` attributes
+ --> $DIR/wasm-import-module.rs:18:8
+ |
+LL | #[link(wasm_import_module = "foo", cfg(FALSE))]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 6 previous errors
+