@@ -42,7 +42,7 @@ macro_rules! throw_validation_failure {
4242macro_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///
6969macro_rules! try_validation_pat {
70- ( $e: expr, $where: expr, { $( $p: pat ) |* => { $what : tt } $( expected { $expected: expr } ) ? $( , ) ?} ) => { {
70+ ( $e: expr, $where: expr, { $( $p: pat ) |* => { $( $what_fmt : expr ) , * } $( expected { $expected: 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!( $what , $where $( , $expected) ?) ,
75+ $( Err ( InterpErrorInfo { kind: $p, .. } ) ) |* => throw_validation_failure!( format_args! ( $ ( $what_fmt ) , * ) , $where $( , $expected) ?) ,
7676 #[ allow( unreachable_patterns) ]
7777 Err ( e) => Err :: <!, _>( e) ?,
7878 }
0 commit comments