summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-04-08 01:18:12 +0000
committerbors <bors@rust-lang.org>2019-04-08 01:18:12 +0000
commit3750348daff89741e3153e0e120aa70a45ff5b68 (patch)
tree576d92e46ee6da7e3bfd45db6125d1d1c264fc72 /src/test
parent474e7a6486758ea6fc761893b1a49cd9076fb0ab (diff)
parent01e83943f9dbcd421826eaed5fa04df8e1bb5570 (diff)
downloadrust-3750348daff89741e3153e0e120aa70a45ff5b68.tar.gz
rust-3750348daff89741e3153e0e120aa70a45ff5b68.zip
Auto merge of #59724 - oli-obk:const_arg_ice, r=eddyb
Function arguments should never get promoted

fixes https://github.com/rust-lang/rust/issues/59469
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/consts/const_arg_local.rs13
-rw-r--r--src/test/ui/consts/const_arg_local.stderr8
-rw-r--r--src/test/ui/consts/const_arg_promotable.rs12
-rw-r--r--src/test/ui/consts/const_arg_promotable.stderr8
-rw-r--r--src/test/ui/consts/const_arg_wrapper.rs12
-rw-r--r--src/test/ui/consts/const_arg_wrapper.stderr8
6 files changed, 61 insertions, 0 deletions
diff --git a/src/test/ui/consts/const_arg_local.rs b/src/test/ui/consts/const_arg_local.rs
new file mode 100644
index 00000000000..0da4b44a968
--- /dev/null
+++ b/src/test/ui/consts/const_arg_local.rs
@@ -0,0 +1,13 @@
+// only-x86_64
+
+#[cfg(target_arch = "x86")]
+use std::arch::x86::*;
+#[cfg(target_arch = "x86_64")]
+use std::arch::x86_64::*;
+
+unsafe fn pclmul(a: __m128i, b: __m128i) -> __m128i {
+    let imm8 = 3;
+    _mm_clmulepi64_si128(a, b, imm8) //~ ERROR argument 3 is required to be a constant
+}
+
+fn main() {}
diff --git a/src/test/ui/consts/const_arg_local.stderr b/src/test/ui/consts/const_arg_local.stderr
new file mode 100644
index 00000000000..197b2f082e5
--- /dev/null
+++ b/src/test/ui/consts/const_arg_local.stderr
@@ -0,0 +1,8 @@
+error: argument 3 is required to be a constant
+  --> $DIR/const_arg_local.rs:10:5
+   |
+LL |     _mm_clmulepi64_si128(a, b, imm8)
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/consts/const_arg_promotable.rs b/src/test/ui/consts/const_arg_promotable.rs
new file mode 100644
index 00000000000..25f45104d6a
--- /dev/null
+++ b/src/test/ui/consts/const_arg_promotable.rs
@@ -0,0 +1,12 @@
+// only-x86_64
+
+#[cfg(target_arch = "x86")]
+use std::arch::x86::*;
+#[cfg(target_arch = "x86_64")]
+use std::arch::x86_64::*;
+
+unsafe fn pclmul(a: __m128i, b: __m128i) -> __m128i {
+    _mm_clmulepi64_si128(a, b, *&mut 42) //~ ERROR argument 3 is required to be a constant
+}
+
+fn main() {}
diff --git a/src/test/ui/consts/const_arg_promotable.stderr b/src/test/ui/consts/const_arg_promotable.stderr
new file mode 100644
index 00000000000..5de3ee6654a
--- /dev/null
+++ b/src/test/ui/consts/const_arg_promotable.stderr
@@ -0,0 +1,8 @@
+error: argument 3 is required to be a constant
+  --> $DIR/const_arg_promotable.rs:9:5
+   |
+LL |     _mm_clmulepi64_si128(a, b, *&mut 42)
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/consts/const_arg_wrapper.rs b/src/test/ui/consts/const_arg_wrapper.rs
new file mode 100644
index 00000000000..92ff264cd2b
--- /dev/null
+++ b/src/test/ui/consts/const_arg_wrapper.rs
@@ -0,0 +1,12 @@
+// only-x86_64
+
+#[cfg(target_arch = "x86")]
+use std::arch::x86::*;
+#[cfg(target_arch = "x86_64")]
+use std::arch::x86_64::*;
+
+unsafe fn pclmul(a: __m128i, b: __m128i, imm8: i32) -> __m128i {
+    _mm_clmulepi64_si128(a, b, imm8) //~ ERROR argument 3 is required to be a constant
+}
+
+fn main() {}
diff --git a/src/test/ui/consts/const_arg_wrapper.stderr b/src/test/ui/consts/const_arg_wrapper.stderr
new file mode 100644
index 00000000000..4acf2f0f4d1
--- /dev/null
+++ b/src/test/ui/consts/const_arg_wrapper.stderr
@@ -0,0 +1,8 @@
+error: argument 3 is required to be a constant
+  --> $DIR/const_arg_wrapper.rs:9:5
+   |
+LL |     _mm_clmulepi64_si128(a, b, imm8)
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+