diff options
| author | jumbatm <jumbatm@gmail.com> | 2020-05-01 20:07:17 +1000 |
|---|---|---|
| committer | jumbatm <jumbatm@gmail.com> | 2020-05-01 21:52:43 +1000 |
| commit | 65c36f6e386cd3fad6515e66ddc4721328ae6ef9 (patch) | |
| tree | 026d6d23e0c6b3abf0a119e5c520c2afe8d8344a /src | |
| parent | 425a99f1eb233659403329fb4f117b1d39c7362c (diff) | |
| download | rust-65c36f6e386cd3fad6515e66ddc4721328ae6ef9.tar.gz rust-65c36f6e386cd3fad6515e66ddc4721328ae6ef9.zip | |
Wrap try_validation_pat! args in format_args!
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc_mir/interpret/validity.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/librustc_mir/interpret/validity.rs b/src/librustc_mir/interpret/validity.rs index c64458bd989..731f6e6aede 100644 --- a/src/librustc_mir/interpret/validity.rs +++ b/src/librustc_mir/interpret/validity.rs @@ -42,7 +42,7 @@ macro_rules! throw_validation_failure { macro_rules! try_validation { ($e:expr, $what:expr, $where:expr $(, $expected:expr )?) => {{ try_validation_pat!($e, $where, { - _ => { $what } $( expected { $expected } )?, + _ => { "{}", $what } $( expected { $expected } )?, }) }}; } @@ -67,12 +67,12 @@ macro_rules! try_validation { /// ``` /// macro_rules! try_validation_pat { - ($e:expr, $where:expr, { $( $p:pat )|* => { $what:tt } $( expected { $expected:expr } )? $( , )?}) => {{ + ($e:expr, $where:expr, { $( $p:pat )|* => { $( $what_fmt:expr ),* } $( expected { $expected:expr } )? $( , )?}) => {{ match $e { Ok(x) => x, // We catch the error and turn it into a validation failure. We are okay with // allocation here as this can only slow down builds that fail anyway. - $( Err(InterpErrorInfo { kind: $p, .. }) )|* => throw_validation_failure!($what, $where $(, $expected)?), + $( Err(InterpErrorInfo { kind: $p, .. }) )|* => throw_validation_failure!(format_args!($( $what_fmt ),*), $where $(, $expected)?), #[allow(unreachable_patterns)] Err(e) => Err::<!, _>(e)?, } |
