Skip to content

Commit bc7b714

Browse files
committed
Don't fail for UndefinedBehaviourInfo in validation.
1 parent e66e37c commit bc7b714

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/librustc_mir/interpret/validity.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -842,9 +842,12 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
842842
// Run it.
843843
match visitor.visit_value(op) {
844844
Ok(()) => Ok(()),
845-
// We should only get validation errors here. Avoid other errors as
846-
// those do not show *where* in the value the issue lies.
845+
// Allow validation failures to be returned.
847846
Err(err) if matches!(err.kind, err_ub!(ValidationFailure { .. })) => Err(err),
847+
// Also allow InvalidProgram to be returned, because it's likely that different callers
848+
// will want to do different things in this situation.
849+
Err(err) if matches!(err.kind, InterpError::InvalidProgram(_)) => Err(err),
850+
// Avoid other errors as those do not show *where* in the value the issue lies.
848851
Err(err) => bug!("Unexpected error during validation: {}", err),
849852
}
850853
}

0 commit comments

Comments
 (0)