Skip to content

Commit e66e37c

Browse files
committed
Don't duplicate body of try_validation.
1 parent 326d38f commit e66e37c

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/librustc_mir/interpret/validity.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,7 @@ macro_rules! throw_validation_failure {
3939
/// Returns a validation failure for any Err value of $e.
4040
macro_rules! try_validation {
4141
($e:expr, $what:expr, $where:expr $(, $details:expr )?) => {{
42-
match $e {
43-
Ok(x) => x,
44-
// We catch the error and turn it into a validation failure. We are okay with
45-
// allocation here as this can only slow down builds that fail anyway.
46-
Err(_) => throw_validation_failure!($what, $where $(, $details)?),
47-
}
42+
try_validation_pat!($e, _, $what, $where $(, $details )?)
4843
}};
4944
}
5045
/// Like try_validation, but will throw a validation error if any of the patterns in $p are
@@ -60,6 +55,8 @@ macro_rules! try_validation_pat {
6055
($e:expr, $( $p:pat )|*, $what:expr, $where:expr $(, $details:expr )?) => {{
6156
match $e {
6257
Ok(x) => x,
58+
// We catch the error and turn it into a validation failure. We are okay with
59+
// allocation here as this can only slow down builds that fail anyway.
6360
$( Err($p) )|* if true => throw_validation_failure!($what, $where $(, $details)?),
6461
Err(e) => Err::<!, _>(e)?,
6562
}

0 commit comments

Comments
 (0)