Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 894a83d

Browse files
jumbatmRalfJungoli-obk
committed
Apply suggestions from code review
Co-Authored-By: Ralf Jung <post@ralfj.de> Co-Authored-By: Oliver Scherer <github35764891676564198441@oli-obk.de>
1 parent 5b1d600 commit 894a83d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/librustc_mir/interpret/validity.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ macro_rules! try_validation {
4848
/// as a kind of validation blacklist:
4949
///
5050
/// ```rust
51-
/// let v = try_validation_pat(some_fn(), Foo | Bar | Baz, "some failure", "some place");
51+
/// let v = try_validation_pat(some_fn(), Foo | Bar | Baz, "some failure", path);
5252
/// // Failures that match $p are thrown up as validation errors, but other errors are passed back
5353
/// // unchanged.
5454
/// ```
@@ -59,7 +59,7 @@ macro_rules! try_validation_pat {
5959
// We catch the error and turn it into a validation failure. We are okay with
6060
// allocation here as this can only slow down builds that fail anyway.
6161
$( Err($p) )|* if true => throw_validation_failure!($what, $where $(, $details)?),
62-
Err(e) => Err::<!, _>(e)?,
62+
Err(e) => Err::<!, _>(e)?,
6363
}
6464
}};
6565
}
@@ -843,10 +843,10 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
843843
// Run it.
844844
match visitor.visit_value(op) {
845845
Ok(()) => Ok(()),
846-
// Allow validation failures to be returned.
846+
// Pass through validation failures.
847847
Err(err) if matches!(err.kind, err_ub!(ValidationFailure { .. })) => Err(err),
848-
// Also allow InvalidProgram to be returned, because it's likely that different callers
849-
// will want to do different things in this situation.
848+
// Also pass through InvalidProgram, those just indicate that we could not
849+
// validate and each caller will know best what to do with them.
850850
Err(err) if matches!(err.kind, InterpError::InvalidProgram(_)) => Err(err),
851851
// Avoid other errors as those do not show *where* in the value the issue lies.
852852
Err(err) => bug!("Unexpected error during validation: {}", err),

0 commit comments

Comments
 (0)