Skip to content

Commit 9e2be77

Browse files
authored
Rollup merge of rust-lang#103122 - ouz-a:mir-technical-debt, r=oli-obk
Remove misc_cast and validate types when casting Continuing our work in rust-lang#102675 r? ````@oli-obk````
2 parents fa1a635 + 0d004f4 commit 9e2be77

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/shims/intrinsics/simd.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -437,13 +437,13 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
437437
let val = match (op.layout.ty.kind(), dest.layout.ty.kind()) {
438438
// Int-to-(int|float): always safe
439439
(ty::Int(_) | ty::Uint(_), ty::Int(_) | ty::Uint(_) | ty::Float(_)) =>
440-
this.misc_cast(&op, dest.layout.ty)?,
440+
this.int_to_int_or_float(&op, dest.layout.ty)?,
441441
// Float-to-float: always safe
442442
(ty::Float(_), ty::Float(_)) =>
443-
this.misc_cast(&op, dest.layout.ty)?,
443+
this.float_to_float_or_int(&op, dest.layout.ty)?,
444444
// Float-to-int in safe mode
445445
(ty::Float(_), ty::Int(_) | ty::Uint(_)) if safe_cast =>
446-
this.misc_cast(&op, dest.layout.ty)?,
446+
this.float_to_float_or_int(&op, dest.layout.ty)?,
447447
// Float-to-int in unchecked mode
448448
(ty::Float(FloatTy::F32), ty::Int(_) | ty::Uint(_)) if !safe_cast =>
449449
this.float_to_int_unchecked(op.to_scalar().to_f32()?, dest.layout.ty)?.into(),

0 commit comments

Comments
 (0)