tweak some bug!s

This commit is contained in:
Ralf Jung 2022-06-04 11:15:36 -04:00
parent c7b0452ece
commit 9e00fb0d89
3 changed files with 6 additions and 6 deletions

View File

@ -169,7 +169,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
sym::needs_drop => self.tcx.types.bool, sym::needs_drop => self.tcx.types.bool,
sym::type_id => self.tcx.types.u64, sym::type_id => self.tcx.types.u64,
sym::type_name => self.tcx.mk_static_str(), sym::type_name => self.tcx.mk_static_str(),
_ => bug!("already checked for nullary intrinsics"), _ => bug!(),
}; };
let val = let val =
self.tcx.const_eval_global_id(self.param_env, gid, Some(self.tcx.span))?; self.tcx.const_eval_global_id(self.param_env, gid, Some(self.tcx.span))?;
@ -215,7 +215,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
sym::add_with_overflow => BinOp::Add, sym::add_with_overflow => BinOp::Add,
sym::sub_with_overflow => BinOp::Sub, sym::sub_with_overflow => BinOp::Sub,
sym::mul_with_overflow => BinOp::Mul, sym::mul_with_overflow => BinOp::Mul,
_ => bug!("Already checked for int ops"), _ => bug!(),
}; };
self.binop_with_overflow(bin_op, &lhs, &rhs, dest)?; self.binop_with_overflow(bin_op, &lhs, &rhs, dest)?;
} }
@ -251,7 +251,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
sym::unchecked_mul => BinOp::Mul, sym::unchecked_mul => BinOp::Mul,
sym::unchecked_div => BinOp::Div, sym::unchecked_div => BinOp::Div,
sym::unchecked_rem => BinOp::Rem, sym::unchecked_rem => BinOp::Rem,
_ => bug!("Already checked for int ops"), _ => bug!(),
}; };
let (val, overflowed, _ty) = self.overflowing_binary_op(bin_op, &l, &r)?; let (val, overflowed, _ty) = self.overflowing_binary_op(bin_op, &l, &r)?;
if overflowed { if overflowed {

View File

@ -70,7 +70,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
} }
} }
bug!("no non-`#[track_caller]` frame found") span_bug!(self.cur_span(), "no non-`#[track_caller]` frame found")
} }
/// Allocate a `const core::panic::Location` with the provided filename and line/column numbers. /// Allocate a `const core::panic::Location` with the provided filename and line/column numbers.

View File

@ -154,14 +154,14 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
let result = match bin_op { let result = match bin_op {
Shl => l.checked_shl(r).unwrap(), Shl => l.checked_shl(r).unwrap(),
Shr => l.checked_shr(r).unwrap(), Shr => l.checked_shr(r).unwrap(),
_ => bug!("it has already been checked that this is a shift op"), _ => bug!(),
}; };
result as u128 result as u128
} else { } else {
match bin_op { match bin_op {
Shl => l.checked_shl(r).unwrap(), Shl => l.checked_shl(r).unwrap(),
Shr => l.checked_shr(r).unwrap(), Shr => l.checked_shr(r).unwrap(),
_ => bug!("it has already been checked that this is a shift op"), _ => bug!(),
} }
}; };
let truncated = self.truncate(result, left_layout); let truncated = self.truncate(result, left_layout);