Skip to content

Commit

Permalink
Function arguments should never get promoted
Browse files Browse the repository at this point in the history
  • Loading branch information
oli-obk committed Apr 7, 2019
1 parent dec0a98 commit 1f40580
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/librustc_mir/transform/qualify_consts.rs
Expand Up @@ -639,7 +639,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 => {
Expand Down
10 changes: 10 additions & 0 deletions 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() {}
8 changes: 8 additions & 0 deletions 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

0 comments on commit 1f40580

Please sign in to comment.