about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2025-03-03 03:41:03 +0000
committerbors <bors@rust-lang.org>2025-03-03 03:41:03 +0000
commit81d8edc2000aa38b08ad09fce22d90f1990b6459 (patch)
tree5d8ec74d6b4e87f59d322a08c024abb94ddcae75 /tests
parentdaf59857d6d2b87af4b846316bf1561a6083ed51 (diff)
parent59fe0c77bb87da1b42cbb6bcc81c2ca90a8e6493 (diff)
downloadrust-81d8edc2000aa38b08ad09fce22d90f1990b6459.tar.gz
rust-81d8edc2000aa38b08ad09fce22d90f1990b6459.zip
Auto merge of #137900 - matthiaskrgr:rollup-rvan5ao, r=matthiaskrgr
Rollup of 10 pull requests

Successful merges:

 - #137375 (Minor internal comments fix for `BufRead::read_line`)
 - #137641 (More precisely document `Global::deallocate()`'s safety.)
 - #137755 (doc: update Wasmtime flags)
 - #137851 (improve `simd_select` error message when used with invalid mask type)
 - #137860 (rustc_target: Add msync target feature and enable it on powerpcspe targets)
 - #137871 (fix `RangeBounds::is_empty` documentation)
 - #137873 (Disable `f16` on Aarch64 without `neon`)
 - #137876 (Adjust triagebot.toml entries for `rustc_mir_build/src/builder/`)
 - #137883 (edit mailmap)
 - #137886 (`name()` and `trimmed_name()` for `stable_mir::crate_def::DefId`)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/check-cfg/target_feature.stderr1
-rw-r--r--tests/ui/simd/intrinsic/generic-gather.rs52
-rw-r--r--tests/ui/simd/intrinsic/generic-gather.stderr39
-rw-r--r--tests/ui/simd/intrinsic/generic-select.rs4
-rw-r--r--tests/ui/simd/intrinsic/generic-select.stderr8
5 files changed, 100 insertions, 4 deletions
diff --git a/tests/ui/check-cfg/target_feature.stderr b/tests/ui/check-cfg/target_feature.stderr
index 8675f7a61c7..5b82d3f539f 100644
--- a/tests/ui/check-cfg/target_feature.stderr
+++ b/tests/ui/check-cfg/target_feature.stderr
@@ -151,6 +151,7 @@ LL |     cfg!(target_feature = "_UNEXPECTED_VALUE");
 `mp`
 `mp1e2`
 `msa`
+`msync`
 `mte`
 `multivalue`
 `mutable-globals`
diff --git a/tests/ui/simd/intrinsic/generic-gather.rs b/tests/ui/simd/intrinsic/generic-gather.rs
new file mode 100644
index 00000000000..118d8029483
--- /dev/null
+++ b/tests/ui/simd/intrinsic/generic-gather.rs
@@ -0,0 +1,52 @@
+//@ build-fail
+//@ ignore-emscripten
+
+// Test that the simd_{gather,scatter} intrinsics produce ok-ish error
+// messages when misused.
+
+#![feature(repr_simd, core_intrinsics)]
+#![allow(non_camel_case_types)]
+
+use std::intrinsics::simd::{simd_gather, simd_scatter};
+
+#[repr(simd)]
+#[derive(Copy, Clone, PartialEq, Debug)]
+struct x4<T>(pub [T; 4]);
+
+fn main() {
+    let mut x = [0_f32, 1., 2., 3., 4., 5., 6., 7.];
+
+    let default = x4([-3_f32, -3., -3., -3.]);
+    let s_strided = x4([0_f32, 2., -3., 6.]);
+
+    let mask = x4([-1_i32, -1, 0, -1]);
+    let umask = x4([0u16; 4]);
+    let fmask = x4([0_f32; 4]);
+
+    let pointer = x.as_mut_ptr();
+    let pointers =
+        unsafe { x4([pointer.offset(0), pointer.offset(2), pointer.offset(4), pointer.offset(6)]) };
+
+    unsafe {
+        simd_gather(default, mask, mask);
+        //~^ ERROR expected element type `i32` of second argument `x4<i32>` to be a pointer to the element type `f32`
+
+        simd_gather(default, pointers, umask);
+        //~^ ERROR expected element type `u16` of third argument `x4<u16>` to be a signed integer type
+
+        simd_gather(default, pointers, fmask);
+        //~^ ERROR expected element type `f32` of third argument `x4<f32>` to be a signed integer type
+    }
+
+    unsafe {
+        let values = x4([42_f32, 43_f32, 44_f32, 45_f32]);
+        simd_scatter(values, mask, mask);
+        //~^ ERROR expected element type `i32` of second argument `x4<i32>` to be a pointer to the element type `f32` of the first argument `x4<f32>`, found `i32` != `*mut f32`
+
+        simd_scatter(values, pointers, umask);
+        //~^ ERROR expected element type `u16` of third argument `x4<u16>` to be a signed integer type
+
+        simd_scatter(values, pointers, fmask);
+        //~^ ERROR expected element type `f32` of third argument `x4<f32>` to be a signed integer type
+    }
+}
diff --git a/tests/ui/simd/intrinsic/generic-gather.stderr b/tests/ui/simd/intrinsic/generic-gather.stderr
new file mode 100644
index 00000000000..81e10fc9875
--- /dev/null
+++ b/tests/ui/simd/intrinsic/generic-gather.stderr
@@ -0,0 +1,39 @@
+error[E0511]: invalid monomorphization of `simd_gather` intrinsic: expected element type `i32` of second argument `x4<i32>` to be a pointer to the element type `f32` of the first argument `x4<f32>`, found `i32` != `*_ f32`
+  --> $DIR/generic-gather.rs:31:9
+   |
+LL |         simd_gather(default, mask, mask);
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_gather` intrinsic: expected element type `u16` of third argument `x4<u16>` to be a signed integer type
+  --> $DIR/generic-gather.rs:34:9
+   |
+LL |         simd_gather(default, pointers, umask);
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_gather` intrinsic: expected element type `f32` of third argument `x4<f32>` to be a signed integer type
+  --> $DIR/generic-gather.rs:37:9
+   |
+LL |         simd_gather(default, pointers, fmask);
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_scatter` intrinsic: expected element type `i32` of second argument `x4<i32>` to be a pointer to the element type `f32` of the first argument `x4<f32>`, found `i32` != `*mut f32`
+  --> $DIR/generic-gather.rs:43:9
+   |
+LL |         simd_scatter(values, mask, mask);
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_scatter` intrinsic: expected element type `u16` of third argument `x4<u16>` to be a signed integer type
+  --> $DIR/generic-gather.rs:46:9
+   |
+LL |         simd_scatter(values, pointers, umask);
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_scatter` intrinsic: expected element type `f32` of third argument `x4<f32>` to be a signed integer type
+  --> $DIR/generic-gather.rs:49:9
+   |
+LL |         simd_scatter(values, pointers, fmask);
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 6 previous errors
+
+For more information about this error, try `rustc --explain E0511`.
diff --git a/tests/ui/simd/intrinsic/generic-select.rs b/tests/ui/simd/intrinsic/generic-select.rs
index 917ad3ca604..db14032f1f2 100644
--- a/tests/ui/simd/intrinsic/generic-select.rs
+++ b/tests/ui/simd/intrinsic/generic-select.rs
@@ -37,10 +37,10 @@ fn main() {
         //~^ ERROR mismatched lengths: mask length `8` != other vector length `4`
 
         simd_select(x, x, x);
-        //~^ ERROR mask element type is `u32`, expected `i_`
+        //~^ ERROR mask element type is `u32`, expected a signed integer type
 
         simd_select(z, z, z);
-        //~^ ERROR mask element type is `f32`, expected `i_`
+        //~^ ERROR mask element type is `f32`, expected a signed integer type
 
         simd_select(m4, 0u32, 1u32);
         //~^ ERROR found non-SIMD `u32`
diff --git a/tests/ui/simd/intrinsic/generic-select.stderr b/tests/ui/simd/intrinsic/generic-select.stderr
index c46584d117c..b9af86515fd 100644
--- a/tests/ui/simd/intrinsic/generic-select.stderr
+++ b/tests/ui/simd/intrinsic/generic-select.stderr
@@ -4,17 +4,21 @@ error[E0511]: invalid monomorphization of `simd_select` intrinsic: mismatched le
 LL |         simd_select(m8, x, x);
    |         ^^^^^^^^^^^^^^^^^^^^^
 
-error[E0511]: invalid monomorphization of `simd_select` intrinsic: mask element type is `u32`, expected `i_`
+error[E0511]: invalid monomorphization of `simd_select` intrinsic: found mask element type is `u32`, expected a signed integer type
   --> $DIR/generic-select.rs:39:9
    |
 LL |         simd_select(x, x, x);
    |         ^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: the mask may be widened, which only has the correct behavior for signed integers
 
-error[E0511]: invalid monomorphization of `simd_select` intrinsic: mask element type is `f32`, expected `i_`
+error[E0511]: invalid monomorphization of `simd_select` intrinsic: found mask element type is `f32`, expected a signed integer type
   --> $DIR/generic-select.rs:42:9
    |
 LL |         simd_select(z, z, z);
    |         ^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: the mask may be widened, which only has the correct behavior for signed integers
 
 error[E0511]: invalid monomorphization of `simd_select` intrinsic: expected SIMD argument type, found non-SIMD `u32`
   --> $DIR/generic-select.rs:45:9