@@ -499,7 +499,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
499
499
let bitmask_len = u32:: try_from ( bitmask_len) . unwrap ( ) ;
500
500
for i in 0 ..dest_len {
501
501
let bit_i = simd_bitmask_index ( i, dest_len, this. data_layout ( ) . endian ) ;
502
- let mask = mask & 1u64 . checked_shl ( bit_i) . unwrap ( ) ;
502
+ let mask = mask & 1u64 . strict_shl ( bit_i) ;
503
503
let yes = this. read_immediate ( & this. project_index ( & yes, i. into ( ) ) ?) ?;
504
504
let no = this. read_immediate ( & this. project_index ( & no, i. into ( ) ) ?) ?;
505
505
let dest = this. project_index ( & dest, i. into ( ) ) ?;
@@ -511,7 +511,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
511
511
// If the mask is "padded", ensure that padding is all-zero.
512
512
// This deliberately does not use `simd_bitmask_index`; these bits are outside
513
513
// the bitmask. It does not matter in which order we check them.
514
- let mask = mask & 1u64 . checked_shl ( i ) . unwrap ( ) ;
514
+ let mask = mask & 1u64 . strict_shl ( i ) ;
515
515
if mask != 0 {
516
516
throw_ub_format ! (
517
517
"a SIMD bitmask less than 8 bits long must be filled with 0s for the remaining bits"
@@ -535,9 +535,8 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
535
535
for i in 0 ..op_len {
536
536
let op = this. read_immediate ( & this. project_index ( & op, i. into ( ) ) ?) ?;
537
537
if simd_element_to_bool ( op) ? {
538
- res |= 1u64
539
- . checked_shl ( simd_bitmask_index ( i, op_len, this. data_layout ( ) . endian ) )
540
- . unwrap ( ) ;
538
+ let bit_i = simd_bitmask_index ( i, op_len, this. data_layout ( ) . endian ) ;
539
+ res |= 1u64 . strict_shl ( bit_i) ;
541
540
}
542
541
}
543
542
// Write the result, depending on the `dest` type.
@@ -653,8 +652,8 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
653
652
654
653
let val = if src_index < left_len {
655
654
this. read_immediate ( & this. project_index ( & left, src_index) ?) ?
656
- } else if src_index < left_len. checked_add ( right_len) . unwrap ( ) {
657
- let right_idx = src_index. checked_sub ( left_len) . unwrap ( ) ;
655
+ } else if src_index < left_len. strict_add ( right_len) {
656
+ let right_idx = src_index. strict_sub ( left_len) ;
658
657
this. read_immediate ( & this. project_index ( & right, right_idx) ?) ?
659
658
} else {
660
659
throw_ub_format ! (
@@ -693,8 +692,8 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
693
692
694
693
let val = if src_index < left_len {
695
694
this. read_immediate ( & this. project_index ( & left, src_index) ?) ?
696
- } else if src_index < left_len. checked_add ( right_len) . unwrap ( ) {
697
- let right_idx = src_index. checked_sub ( left_len) . unwrap ( ) ;
695
+ } else if src_index < left_len. strict_add ( right_len) {
696
+ let right_idx = src_index. strict_sub ( left_len) ;
698
697
this. read_immediate ( & this. project_index ( & right, right_idx) ?) ?
699
698
} else {
700
699
throw_ub_format ! (
0 commit comments