about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbjorn3 <bjorn3@users.noreply.github.com>2020-10-16 14:03:29 +0200
committerbjorn3 <bjorn3@users.noreply.github.com>2020-10-16 14:03:29 +0200
commit0416f122aae296e7fa78cff64b5df683be1dfc2f (patch)
tree4c805f80611c3a3b120e7c5a8ab72b2e5122da02
parent49710287756b85edb5a0d82a210ab26973aec746 (diff)
downloadrust-0416f122aae296e7fa78cff64b5df683be1dfc2f.tar.gz
rust-0416f122aae296e7fa78cff64b5df683be1dfc2f.zip
Error on non-constant simd_insert/simd_extract index
-rw-r--r--src/intrinsics/simd.rs17
1 files changed, 6 insertions, 11 deletions
diff --git a/src/intrinsics/simd.rs b/src/intrinsics/simd.rs
index e9d3cc8d256..b4269f4fafa 100644
--- a/src/intrinsics/simd.rs
+++ b/src/intrinsics/simd.rs
@@ -121,12 +121,10 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>(
             let idx_const = if let Some(idx_const) = crate::constant::mir_operand_get_const_val(fx, idx) {
                 idx_const
             } else {
-                fx.tcx.sess.span_warn(
-                    fx.mir.span,
-                    "`#[rustc_arg_required_const(..)]` is not yet supported. Calling this function will panic.",
+                fx.tcx.sess.span_fatal(
+                    span,
+                    "Index argument for `simd_insert` is not a constant",
                 );
-                crate::trap::trap_unimplemented(fx, "`#[rustc_arg_required_const(..)]` is not yet supported.");
-                return;
             };
 
             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>(
             let idx_const = if let Some(idx_const) = crate::constant::mir_operand_get_const_val(fx, idx) {
                 idx_const
             } else {
-                fx.tcx.sess.span_warn(
-                    fx.mir.span,
-                    "`#[rustc_arg_required_const(..)]` is not yet supported. Calling this function will panic.",
+                fx.tcx.sess.span_fatal(
+                    span,
+                    "Index argument for `simd_extract` is not a constant",
                 );
-                let val = crate::trap::trap_unimplemented_ret_value(fx, ret.layout(), "`#[rustc_arg_required_const(..)]` is not yet supported.");
-                ret.write_cvalue(fx, val);
-                return;
             };
 
             let idx = idx_const.val.try_to_bits(Size::from_bytes(4 /* u32*/)).expect(&format!("kind not scalar: {:?}", idx_const));