Skip to content

Commit 2ee2157

Browse files
committed
miri engine: turn error sanity checks into assertions
1 parent 1902d1e commit 2ee2157

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

src/librustc_mir/interpret/validity.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -825,11 +825,10 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
825825
// Run it.
826826
match visitor.visit_value(op) {
827827
Ok(()) => Ok(()),
828+
// We should only get validation errors here. Avoid other errors as
829+
// those do not show *where* in the value the issue lies.
828830
Err(err) if matches!(err.kind, err_ub!(ValidationFailure { .. })) => Err(err),
829-
Err(err) if cfg!(debug_assertions) => {
830-
bug!("Unexpected error during validation: {}", err)
831-
}
832-
Err(err) => Err(err),
831+
Err(err) => bug!("Unexpected error during validation: {}", err),
833832
}
834833
}
835834

src/librustc_mir/transform/const_prop.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -404,8 +404,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
404404
// Some errors shouldn't come up because creating them causes
405405
// an allocation, which we should avoid. When that happens,
406406
// dedicated error variants should be introduced instead.
407-
// Only test this in debug builds though to avoid disruptions.
408-
debug_assert!(
407+
assert!(
409408
!error.kind.allocates(),
410409
"const-prop encountered allocating error: {}",
411410
error

0 commit comments

Comments
 (0)