miri engine: turn error sanity checks into assertions
This commit is contained in:
parent
1902d1e0de
commit
2ee2157e29
2 changed files with 4 additions and 6 deletions
|
@ -825,11 +825,10 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
|
|||
// Run it.
|
||||
match visitor.visit_value(op) {
|
||||
Ok(()) => Ok(()),
|
||||
// We should only get validation errors here. Avoid other errors as
|
||||
// those do not show *where* in the value the issue lies.
|
||||
Err(err) if matches!(err.kind, err_ub!(ValidationFailure { .. })) => Err(err),
|
||||
Err(err) if cfg!(debug_assertions) => {
|
||||
bug!("Unexpected error during validation: {}", err)
|
||||
}
|
||||
Err(err) => Err(err),
|
||||
Err(err) => bug!("Unexpected error during validation: {}", err),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -404,8 +404,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
|
|||
// Some errors shouldn't come up because creating them causes
|
||||
// an allocation, which we should avoid. When that happens,
|
||||
// dedicated error variants should be introduced instead.
|
||||
// Only test this in debug builds though to avoid disruptions.
|
||||
debug_assert!(
|
||||
assert!(
|
||||
!error.kind.allocates(),
|
||||
"const-prop encountered allocating error: {}",
|
||||
error
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue