Skip to content

Commit ccc0cd8

Browse files
committed
Function arguments should never get promoted
1 parent a11083e commit ccc0cd8

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

src/librustc_mir/transform/qualify_consts.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,7 @@ impl<'a, 'tcx> Checker<'a, 'tcx> {
639639
per_local.insert(local);
640640
}
641641
}
642-
cx.per_local[IsNotPromotable].insert(local);
642+
cx.per_local[IsNotConst].insert(local);
643643
}
644644

645645
LocalKind::Var if mode == Mode::Fn => {
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#[cfg(target_arch = "x86")]
2+
use std::arch::x86::*;
3+
#[cfg(target_arch = "x86_64")]
4+
use std::arch::x86_64::*;
5+
6+
unsafe fn pclmul(a: __m128i, b: __m128i, imm8: i32) -> __m128i {
7+
_mm_clmulepi64_si128(a, b, imm8) //~ ERROR argument 3 is required to be a constant
8+
}
9+
10+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
error: argument 3 is required to be a constant
2+
--> $DIR/const_arg_wrapper.rs:7:5
3+
|
4+
LL | _mm_clmulepi64_si128(a, b, imm8)
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6+
7+
error: aborting due to previous error
8+

0 commit comments

Comments
 (0)