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

Commit eca1478

Browse files
committed
Match kind in try_validation_pat!.
Avoids having to repeat InterpErrorInfo { .. }
1 parent 656ab76 commit eca1478

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/librustc_mir/interpret/validity.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ macro_rules! try_validation {
4949
/// as a kind of validation blacklist:
5050
///
5151
/// ```rust
52-
/// let v = try_validation_pat(some_fn(), Foo | Bar | Baz, "some failure", path);
52+
/// let v = try_validation_pat!(some_fn(), Foo | Bar | Baz, "some failure", path);
5353
/// // Failures that match $p are thrown up as validation errors, but other errors are passed back
5454
/// // unchanged.
5555
/// ```
@@ -59,7 +59,7 @@ macro_rules! try_validation_pat {
5959
Ok(x) => x,
6060
// We catch the error and turn it into a validation failure. We are okay with
6161
// allocation here as this can only slow down builds that fail anyway.
62-
$( Err($p) )|* if true => throw_validation_failure!($what, $where $(, $details)?),
62+
$( Err(InterpErrorInfo { kind: $p, .. }) )|* if true => throw_validation_failure!($what, $where $(, $details)?),
6363
Err(e) => Err::<!, _>(e)?,
6464
}
6565
}};
@@ -494,7 +494,7 @@ impl<'rt, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> ValidityVisitor<'rt, 'mir, '
494494
// that lets us re-use `ref_to_mplace`).
495495
let place = try_validation_pat!(
496496
self.ecx.ref_to_mplace(self.ecx.read_immediate(value)?),
497-
InterpErrorInfo { kind: err_ub!(InvalidUndefBytes(..)), ..},
497+
err_ub!(InvalidUndefBytes(..)),
498498
"uninitialized raw pointer",
499499
self.path
500500
);

0 commit comments

Comments
 (0)