From 218caa410aa38c29984be31a5229b9fa717560ee Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:13 +0200 Subject: Merging upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- tests/ui/wasm/simd-to-array-80108.rs | 15 +++++++++++++ tests/ui/wasm/wasm-hang-issue-76281.rs | 12 +++++++++++ tests/ui/wasm/wasm-import-module.rs | 21 ++++++++++++++++++ tests/ui/wasm/wasm-import-module.stderr | 38 +++++++++++++++++++++++++++++++++ 4 files changed, 86 insertions(+) create mode 100644 tests/ui/wasm/simd-to-array-80108.rs create mode 100644 tests/ui/wasm/wasm-hang-issue-76281.rs create mode 100644 tests/ui/wasm/wasm-import-module.rs create mode 100644 tests/ui/wasm/wasm-import-module.stderr (limited to 'tests/ui/wasm') 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 + -- cgit v1.2.3