Skip to content

Commit 0416f12

Browse files
committed
Error on non-constant simd_insert/simd_extract index
1 parent 4971028 commit 0416f12

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

src/intrinsics/simd.rs

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,10 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>(
121121
let idx_const = if let Some(idx_const) = crate::constant::mir_operand_get_const_val(fx, idx) {
122122
idx_const
123123
} else {
124-
fx.tcx.sess.span_warn(
125-
fx.mir.span,
126-
"`#[rustc_arg_required_const(..)]` is not yet supported. Calling this function will panic.",
124+
fx.tcx.sess.span_fatal(
125+
span,
126+
"Index argument for `simd_insert` is not a constant",
127127
);
128-
crate::trap::trap_unimplemented(fx, "`#[rustc_arg_required_const(..)]` is not yet supported.");
129-
return;
130128
};
131129

132130
let idx = idx_const.val.try_to_bits(Size::from_bytes(4 /* u32*/)).expect(&format!("kind not scalar: {:?}", idx_const));
@@ -145,13 +143,10 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>(
145143
let idx_const = if let Some(idx_const) = crate::constant::mir_operand_get_const_val(fx, idx) {
146144
idx_const
147145
} else {
148-
fx.tcx.sess.span_warn(
149-
fx.mir.span,
150-
"`#[rustc_arg_required_const(..)]` is not yet supported. Calling this function will panic.",
146+
fx.tcx.sess.span_fatal(
147+
span,
148+
"Index argument for `simd_extract` is not a constant",
151149
);
152-
let val = crate::trap::trap_unimplemented_ret_value(fx, ret.layout(), "`#[rustc_arg_required_const(..)]` is not yet supported.");
153-
ret.write_cvalue(fx, val);
154-
return;
155150
};
156151

157152
let idx = idx_const.val.try_to_bits(Size::from_bytes(4 /* u32*/)).expect(&format!("kind not scalar: {:?}", idx_const));

0 commit comments

Comments
 (0)