Skip to content

Commit afc9cf3

Browse files
committed
miri engine: turn error sanity checks into assertions
1 parent 3dbade6 commit afc9cf3

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

src/librustc_mir/interpret/validity.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -817,11 +817,10 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
817817
// Run it.
818818
match visitor.visit_value(op) {
819819
Ok(()) => Ok(()),
820+
// We should only get validation errors here. Avoid other errors as
821+
// those do not show *where* in the value the issue lies.
820822
Err(err) if matches!(err.kind, err_unsup!(ValidationFailure { .. })) => Err(err),
821-
Err(err) if cfg!(debug_assertions) => {
822-
bug!("Unexpected error during validation: {}", err)
823-
}
824-
Err(err) => Err(err),
823+
Err(err) => bug!("Unexpected error during validation: {}", err),
825824
}
826825
}
827826

src/librustc_mir/transform/const_prop.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -407,8 +407,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
407407
// Some errors shouldn't come up because creating them causes
408408
// an allocation, which we should avoid. When that happens,
409409
// dedicated error variants should be introduced instead.
410-
// Only test this in debug builds though to avoid disruptions.
411-
debug_assert!(
410+
assert!(
412411
!error.kind.allocates(),
413412
"const-prop encountered allocating error: {}",
414413
error

0 commit comments

Comments
 (0)