diff options
Diffstat (limited to 'compiler/rustc_const_eval/src')
| -rw-r--r-- | compiler/rustc_const_eval/src/interpret/discriminant.rs | 3 | ||||
| -rw-r--r-- | compiler/rustc_const_eval/src/interpret/operand.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_const_eval/src/interpret/operator.rs | 8 |
3 files changed, 6 insertions, 7 deletions
diff --git a/compiler/rustc_const_eval/src/interpret/discriminant.rs b/compiler/rustc_const_eval/src/interpret/discriminant.rs index 704f597cfdb..caacc6f57d3 100644 --- a/compiler/rustc_const_eval/src/interpret/discriminant.rs +++ b/compiler/rustc_const_eval/src/interpret/discriminant.rs @@ -295,8 +295,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { &niche_start_val, )? .to_scalar() - .try_to_int() - .unwrap(); + .assert_int(); Ok(Some((tag, tag_field))) } } diff --git a/compiler/rustc_const_eval/src/interpret/operand.rs b/compiler/rustc_const_eval/src/interpret/operand.rs index 8283c29207f..604b78358b3 100644 --- a/compiler/rustc_const_eval/src/interpret/operand.rs +++ b/compiler/rustc_const_eval/src/interpret/operand.rs @@ -249,7 +249,7 @@ impl<'tcx, Prov: Provenance> ImmTy<'tcx, Prov> { } /// Return the immediate as a `ScalarInt`. Ensures that it has the size that the layout of the - /// immediate indcates. + /// immediate indicates. #[inline] pub fn to_scalar_int(&self) -> InterpResult<'tcx, ScalarInt> { let s = self.to_scalar().to_scalar_int()?; diff --git a/compiler/rustc_const_eval/src/interpret/operator.rs b/compiler/rustc_const_eval/src/interpret/operator.rs index 1a126d1fbb0..9af755e40de 100644 --- a/compiler/rustc_const_eval/src/interpret/operator.rs +++ b/compiler/rustc_const_eval/src/interpret/operator.rs @@ -155,10 +155,10 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { let l = left.to_scalar_int()?; let r = right.to_scalar_int()?; // Prepare to convert the values to signed or unsigned form. - let l_signed = || l.try_to_int(left.layout.size).unwrap(); - let l_unsigned = || l.try_to_uint(left.layout.size).unwrap(); - let r_signed = || r.try_to_int(right.layout.size).unwrap(); - let r_unsigned = || r.try_to_uint(right.layout.size).unwrap(); + let l_signed = || l.assert_int(left.layout.size); + let l_unsigned = || l.assert_uint(left.layout.size); + let r_signed = || r.assert_int(right.layout.size); + let r_unsigned = || r.assert_uint(right.layout.size); let throw_ub_on_overflow = match bin_op { AddUnchecked => Some(sym::unchecked_add), |
