Skip to content

Commit f1d778f

Browse files
committed
Also make expected param wrapped in format_args.
1 parent 65c36f6 commit f1d778f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/librustc_mir/interpret/validity.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ macro_rules! throw_validation_failure {
4242
macro_rules! try_validation {
4343
($e:expr, $what:expr, $where:expr $(, $expected:expr )?) => {{
4444
try_validation_pat!($e, $where, {
45-
_ => { "{}", $what } $( expected { $expected } )?,
45+
_ => { "{}", $what } $( expected { "{}", $expected } )?,
4646
})
4747
}};
4848
}
@@ -67,12 +67,12 @@ macro_rules! try_validation {
6767
/// ```
6868
///
6969
macro_rules! try_validation_pat {
70-
($e:expr, $where:expr, { $( $p:pat )|* => { $( $what_fmt:expr ),* } $( expected { $expected:expr } )? $( , )?}) => {{
70+
($e:expr, $where:expr, { $( $p:pat )|* => { $( $what_fmt:expr ),* } $( expected { $( $expected_fmt:expr ),* } )? $( , )?}) => {{
7171
match $e {
7272
Ok(x) => x,
7373
// We catch the error and turn it into a validation failure. We are okay with
7474
// allocation here as this can only slow down builds that fail anyway.
75-
$( Err(InterpErrorInfo { kind: $p, .. }) )|* => throw_validation_failure!(format_args!($( $what_fmt ),*), $where $(, $expected)?),
75+
$( Err(InterpErrorInfo { kind: $p, .. }) )|* => throw_validation_failure!(format_args!($( $what_fmt ),*), $where $(, format_args!($( $expected_fmt ),*))?),
7676
#[allow(unreachable_patterns)]
7777
Err(e) => Err::<!, _>(e)?,
7878
}

0 commit comments

Comments
 (0)