diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:03 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:03 +0000 |
commit | 64d98f8ee037282c35007b64c2649055c56af1db (patch) | |
tree | 5492bcf97fce41ee1c0b1cc2add283f3e66cdab0 /tests/ui/wasm | |
parent | Adding debian version 1.67.1+dfsg1-1. (diff) | |
download | rustc-64d98f8ee037282c35007b64c2649055c56af1db.tar.xz rustc-64d98f8ee037282c35007b64c2649055c56af1db.zip |
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/wasm')
-rw-r--r-- | tests/ui/wasm/simd-to-array-80108.rs | 15 | ||||
-rw-r--r-- | tests/ui/wasm/wasm-hang-issue-76281.rs | 12 | ||||
-rw-r--r-- | tests/ui/wasm/wasm-import-module.rs | 21 | ||||
-rw-r--r-- | tests/ui/wasm/wasm-import-module.stderr | 38 |
4 files changed, 86 insertions, 0 deletions
diff --git a/tests/ui/wasm/simd-to-array-80108.rs b/tests/ui/wasm/simd-to-array-80108.rs new file mode 100644 index 000000000..0576c2e6b --- /dev/null +++ b/tests/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/tests/ui/wasm/wasm-hang-issue-76281.rs b/tests/ui/wasm/wasm-hang-issue-76281.rs new file mode 100644 index 000000000..a4adfa6d0 --- /dev/null +++ b/tests/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/tests/ui/wasm/wasm-import-module.rs b/tests/ui/wasm/wasm-import-module.rs new file mode 100644 index 000000000..bff08847d --- /dev/null +++ b/tests/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/tests/ui/wasm/wasm-import-module.stderr b/tests/ui/wasm/wasm-import-module.stderr new file mode 100644 index 000000000..e792c33e9 --- /dev/null +++ b/tests/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 + |