@@ -11,7 +11,7 @@ use std::ops::RangeInclusive;
11
11
12
12
use rustc_data_structures:: fx:: FxHashSet ;
13
13
use rustc_hir as hir;
14
- use rustc_middle:: mir:: interpret:: { InterpError , InterpErrorInfo } ;
14
+ use rustc_middle:: mir:: interpret:: InterpError ;
15
15
use rustc_middle:: ty;
16
16
use rustc_middle:: ty:: layout:: TyAndLayout ;
17
17
use rustc_span:: symbol:: { sym, Symbol } ;
@@ -83,14 +83,17 @@ macro_rules! try_validation {
83
83
Ok ( x) => x,
84
84
// We catch the error and turn it into a validation failure. We are okay with
85
85
// 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
+ }
94
97
}
95
98
} } ;
96
99
}
@@ -877,7 +880,7 @@ impl<'rt, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> ValueVisitor<'mir, 'tcx, M>
877
880
Err ( err) => {
878
881
// For some errors we might be able to provide extra information.
879
882
// (This custom logic does not fit the `try_validation!` macro.)
880
- match err. kind {
883
+ match err. kind ( ) {
881
884
err_ub ! ( InvalidUninitBytes ( Some ( access) ) ) => {
882
885
// Some byte was uninitialized, determine which
883
886
// element that byte belongs to so we can
@@ -935,10 +938,10 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
935
938
match visitor. visit_value ( op) {
936
939
Ok ( ( ) ) => Ok ( ( ) ) ,
937
940
// 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) ,
939
942
// Also pass through InvalidProgram, those just indicate that we could not
940
943
// 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) ,
942
945
// Avoid other errors as those do not show *where* in the value the issue lies.
943
946
Err ( err) => {
944
947
err. print_backtrace ( ) ;
0 commit comments