diff options
| author | jumbatm <jumbatm@gmail.com> | 2020-04-29 09:45:13 +1000 |
|---|---|---|
| committer | jumbatm <jumbatm@gmail.com> | 2020-05-01 21:52:43 +1000 |
| commit | bc7b7140b9a5ea4e764c9f53a915d26baa4326be (patch) | |
| tree | 6c3e42e46720a24c23f5ee32ec31d055f3085479 | |
| parent | e66e37cbf1806f4e0b7a9e6935c8198b3a6c4b2f (diff) | |
| download | rust-bc7b7140b9a5ea4e764c9f53a915d26baa4326be.tar.gz rust-bc7b7140b9a5ea4e764c9f53a915d26baa4326be.zip | |
Don't fail for UndefinedBehaviourInfo in validation.
| -rw-r--r-- | src/librustc_mir/interpret/validity.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/librustc_mir/interpret/validity.rs b/src/librustc_mir/interpret/validity.rs index 42cdb1dc2a6..d6202638fd9 100644 --- a/src/librustc_mir/interpret/validity.rs +++ b/src/librustc_mir/interpret/validity.rs @@ -842,9 +842,12 @@ impl<'mir, 'tcx: 'mir, 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. + // Allow validation failures to be returned. Err(err) if matches!(err.kind, err_ub!(ValidationFailure { .. })) => Err(err), + // Also allow InvalidProgram to be returned, because it's likely that different callers + // will want to do different things in this situation. + Err(err) if matches!(err.kind, InterpError::InvalidProgram(_)) => Err(err), + // Avoid other errors as those do not show *where* in the value the issue lies. Err(err) => bug!("Unexpected error during validation: {}", err), } } |
