@@ -11,7 +11,7 @@ use std::ops::RangeInclusive;
1111
1212use rustc_data_structures:: fx:: FxHashSet ;
1313use rustc_hir as hir;
14- use rustc_middle:: mir:: interpret:: { InterpError , InterpErrorInfo } ;
14+ use rustc_middle:: mir:: interpret:: InterpError ;
1515use rustc_middle:: ty;
1616use rustc_middle:: ty:: layout:: TyAndLayout ;
1717use rustc_span:: symbol:: { sym, Symbol } ;
@@ -83,14 +83,17 @@ macro_rules! try_validation {
8383 Ok ( x) => x,
8484 // We catch the error and turn it into a validation failure. We are okay with
8585 // allocation here as this can only slow down builds that fail anyway.
86- $( $( Err ( InterpErrorInfo { kind: $p, .. } ) ) |+ =>
87- throw_validation_failure!(
88- $where,
89- { $( $what_fmt ) ,+ } $( expected { $( $expected_fmt ) ,+ } ) ?
90- ) ,
91- ) +
92- #[ allow( unreachable_patterns) ]
93- Err ( e) => Err :: <!, _>( e) ?,
86+ Err ( e) => match e. kind( ) {
87+ $(
88+ $( $p) |+ =>
89+ throw_validation_failure!(
90+ $where,
91+ { $( $what_fmt ) ,+ } $( expected { $( $expected_fmt ) ,+ } ) ?
92+ )
93+ ) ,+,
94+ #[ allow( unreachable_patterns) ]
95+ _ => Err :: <!, _>( e) ?,
96+ }
9497 }
9598 } } ;
9699}
@@ -877,7 +880,7 @@ impl<'rt, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> ValueVisitor<'mir, 'tcx, M>
877880 Err ( err) => {
878881 // For some errors we might be able to provide extra information.
879882 // (This custom logic does not fit the `try_validation!` macro.)
880- match err. kind {
883+ match err. kind ( ) {
881884 err_ub ! ( InvalidUninitBytes ( Some ( access) ) ) => {
882885 // Some byte was uninitialized, determine which
883886 // element that byte belongs to so we can
@@ -935,10 +938,10 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
935938 match visitor. visit_value ( op) {
936939 Ok ( ( ) ) => Ok ( ( ) ) ,
937940 // Pass through validation failures.
938- Err ( err) if matches ! ( err. kind, err_ub!( ValidationFailure { .. } ) ) => Err ( err) ,
941+ Err ( err) if matches ! ( err. kind( ) , err_ub!( ValidationFailure { .. } ) ) => Err ( err) ,
939942 // Also pass through InvalidProgram, those just indicate that we could not
940943 // validate and each caller will know best what to do with them.
941- Err ( err) if matches ! ( err. kind, InterpError :: InvalidProgram ( _) ) => Err ( err) ,
944+ Err ( err) if matches ! ( err. kind( ) , InterpError :: InvalidProgram ( _) ) => Err ( err) ,
942945 // Avoid other errors as those do not show *where* in the value the issue lies.
943946 Err ( err) => {
944947 err. print_backtrace ( ) ;
0 commit comments