diff options
| author | Oliver Scherer <github35764891676564198441@oli-obk.de> | 2019-04-05 13:53:43 +0200 |
|---|---|---|
| committer | Pietro Albini <pietro@pietroalbini.org> | 2019-04-07 22:40:06 +0200 |
| commit | 0bf2164df69efebb79c7a1926b99ea35c58fc3ea (patch) | |
| tree | 6ef0db39180373646c5e308dc3626f413794597a /src | |
| parent | 16e2c163b9be2d15f48f616cd128b6f8cdf29839 (diff) | |
| download | rust-0bf2164df69efebb79c7a1926b99ea35c58fc3ea.tar.gz rust-0bf2164df69efebb79c7a1926b99ea35c58fc3ea.zip | |
Function arguments should never get promoted
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc_mir/transform/qualify_consts.rs | 2 | ||||
| -rw-r--r-- | src/test/ui/consts/const_arg_wrapper.rs | 10 | ||||
| -rw-r--r-- | src/test/ui/consts/const_arg_wrapper.stderr | 8 |
3 files changed, 19 insertions, 1 deletions
diff --git a/src/librustc_mir/transform/qualify_consts.rs b/src/librustc_mir/transform/qualify_consts.rs index f7b7754cea7..e9fafc1fd90 100644 --- a/src/librustc_mir/transform/qualify_consts.rs +++ b/src/librustc_mir/transform/qualify_consts.rs @@ -628,7 +628,7 @@ impl<'a, 'tcx> Checker<'a, 'tcx> { per_local.insert(local); } } - cx.per_local[IsNotPromotable].insert(local); + cx.per_local[IsNotConst].insert(local); } LocalKind::Var if mode == Mode::Fn => { 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..3804102966e --- /dev/null +++ b/src/test/ui/consts/const_arg_wrapper.rs @@ -0,0 +1,10 @@ +#[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..5d0cae8cc2a --- /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:7:5 + | +LL | _mm_clmulepi64_si128(a, b, imm8) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + |
