@@ -539,7 +539,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
539
539
540
540
match self . infcx . leak_check ( outer_universe, Some ( snapshot) ) {
541
541
Ok ( ( ) ) => { }
542
- Err ( _) => return Ok ( EvaluatedToErr ) ,
542
+ Err ( _) => return Ok ( EvaluatedToErr ( 4 ) ) ,
543
543
}
544
544
545
545
if self . infcx . opaque_types_added_in_snapshot ( snapshot) {
@@ -571,10 +571,10 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
571
571
for mut obligation in predicates {
572
572
obligation. set_depth_from_parent ( stack. depth ( ) ) ;
573
573
let eval = self . evaluate_predicate_recursively ( stack, obligation. clone ( ) ) ?;
574
- if let EvaluatedToErr = eval {
574
+ if let EvaluatedToErr ( _ ) = eval {
575
575
// fast-path - EvaluatedToErr is the top of the lattice,
576
576
// so we don't need to look on the other predicates.
577
- return Ok ( EvaluatedToErr ) ;
577
+ return Ok ( EvaluatedToErr ( 5 ) ) ;
578
578
} else {
579
579
result = cmp:: max ( result, eval) ;
580
580
}
@@ -603,8 +603,9 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
603
603
None => self . check_recursion_limit ( & obligation, & obligation) ?,
604
604
}
605
605
606
- ensure_sufficient_stack ( || {
606
+ let x = ensure_sufficient_stack ( || {
607
607
let bound_predicate = obligation. predicate . kind ( ) ;
608
+ tracing:: info!( ?bound_predicate, "zxcv" ) ;
608
609
match bound_predicate. skip_binder ( ) {
609
610
ty:: PredicateKind :: Clause ( ty:: ClauseKind :: Trait ( t) ) => {
610
611
let t = bound_predicate. rebind ( t) ;
@@ -623,7 +624,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
623
624
self . evaluate_predicates_recursively ( previous_stack, nested)
624
625
}
625
626
Err ( effects:: EvaluationFailure :: Ambiguous ) => Ok ( EvaluatedToAmbig ) ,
626
- Err ( effects:: EvaluationFailure :: NoSolution ) => Ok ( EvaluatedToErr ) ,
627
+ Err ( effects:: EvaluationFailure :: NoSolution ) => Ok ( EvaluatedToErr ( 6 ) ) ,
627
628
}
628
629
} )
629
630
}
@@ -635,7 +636,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
635
636
Ok ( Ok ( InferOk { obligations, .. } ) ) => {
636
637
self . evaluate_predicates_recursively ( previous_stack, obligations)
637
638
}
638
- Ok ( Err ( _) ) => Ok ( EvaluatedToErr ) ,
639
+ Ok ( Err ( _) ) => Ok ( EvaluatedToErr ( 7 ) ) ,
639
640
Err ( ..) => Ok ( EvaluatedToAmbig ) ,
640
641
}
641
642
}
@@ -647,7 +648,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
647
648
Ok ( Ok ( InferOk { obligations, .. } ) ) => {
648
649
self . evaluate_predicates_recursively ( previous_stack, obligations)
649
650
}
650
- Ok ( Err ( _) ) => Ok ( EvaluatedToErr ) ,
651
+ Ok ( Err ( _) ) => Ok ( EvaluatedToErr ( 8 ) ) ,
651
652
Err ( ..) => Ok ( EvaluatedToAmbig ) ,
652
653
}
653
654
}
@@ -760,7 +761,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
760
761
if self . tcx ( ) . is_dyn_compatible ( trait_def_id) {
761
762
Ok ( EvaluatedToOk )
762
763
} else {
763
- Ok ( EvaluatedToErr )
764
+ Ok ( EvaluatedToErr ( 9 ) )
764
765
}
765
766
}
766
767
@@ -827,7 +828,9 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
827
828
}
828
829
ProjectAndUnifyResult :: FailedNormalization => Ok ( EvaluatedToAmbig ) ,
829
830
ProjectAndUnifyResult :: Recursive => Ok ( EvaluatedToAmbigStackDependent ) ,
830
- ProjectAndUnifyResult :: MismatchedProjectionTypes ( _) => Ok ( EvaluatedToErr ) ,
831
+ ProjectAndUnifyResult :: MismatchedProjectionTypes ( _) => {
832
+ Ok ( EvaluatedToErr ( 10 ) )
833
+ }
831
834
}
832
835
}
833
836
@@ -840,8 +843,8 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
840
843
) {
841
844
Ok ( ( ) ) => Ok ( EvaluatedToOk ) ,
842
845
Err ( NotConstEvaluatable :: MentionsInfer ) => Ok ( EvaluatedToAmbig ) ,
843
- Err ( NotConstEvaluatable :: MentionsParam ) => Ok ( EvaluatedToErr ) ,
844
- Err ( _) => Ok ( EvaluatedToErr ) ,
846
+ Err ( NotConstEvaluatable :: MentionsParam ) => Ok ( EvaluatedToErr ( 11 ) ) ,
847
+ Err ( _) => Ok ( EvaluatedToErr ( 12 ) ) ,
845
848
}
846
849
}
847
850
@@ -929,20 +932,24 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
929
932
previous_stack,
930
933
inf_ok. into_obligations ( ) ,
931
934
) ,
932
- Err ( _) => Ok ( EvaluatedToErr ) ,
935
+ Err ( _) => Ok ( EvaluatedToErr ( 13 ) ) ,
933
936
}
934
937
}
935
938
( Err ( EvaluateConstErr :: InvalidConstParamTy ( ..) ) , _)
936
- | ( _, Err ( EvaluateConstErr :: InvalidConstParamTy ( ..) ) ) => Ok ( EvaluatedToErr ) ,
939
+ | ( _, Err ( EvaluateConstErr :: InvalidConstParamTy ( ..) ) ) => {
940
+ Ok ( EvaluatedToErr ( 14 ) )
941
+ }
937
942
( Err ( EvaluateConstErr :: EvaluationFailure ( ..) ) , _)
938
- | ( _, Err ( EvaluateConstErr :: EvaluationFailure ( ..) ) ) => Ok ( EvaluatedToErr ) ,
943
+ | ( _, Err ( EvaluateConstErr :: EvaluationFailure ( ..) ) ) => {
944
+ Ok ( EvaluatedToErr ( 15 ) )
945
+ }
939
946
( Err ( EvaluateConstErr :: HasGenericsOrInfers ) , _)
940
947
| ( _, Err ( EvaluateConstErr :: HasGenericsOrInfers ) ) => {
941
948
if c1. has_non_region_infer ( ) || c2. has_non_region_infer ( ) {
942
949
Ok ( EvaluatedToAmbig )
943
950
} else {
944
951
// Two different constants using generic parameters ~> error.
945
- Ok ( EvaluatedToErr )
952
+ Ok ( EvaluatedToErr ( 16 ) )
946
953
}
947
954
}
948
955
}
@@ -986,11 +993,12 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
986
993
previous_stack,
987
994
inf_ok. into_obligations ( ) ,
988
995
) ,
989
- Err ( _) => Ok ( EvaluatedToErr ) ,
996
+ Err ( _) => Ok ( EvaluatedToErr ( 17 ) ) ,
990
997
}
991
998
}
992
999
}
993
- } )
1000
+ } ) ;
1001
+ x
994
1002
}
995
1003
996
1004
#[ instrument( skip( self , previous_stack) , level = "debug" , ret) ]
@@ -1048,7 +1056,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
1048
1056
// normalize these obligations before evaluating.
1049
1057
// so we will try to normalize the obligation and evaluate again.
1050
1058
// we will replace it with new solver in the future.
1051
- if EvaluationResult :: EvaluatedToErr = = result
1059
+ if let EvaluationResult :: EvaluatedToErr ( _ ) = result
1052
1060
&& fresh_trait_pred. has_aliases ( )
1053
1061
&& fresh_trait_pred. is_global ( )
1054
1062
{
@@ -1216,7 +1224,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
1216
1224
Ok ( Some ( c) ) => self . evaluate_candidate ( stack, & c) ,
1217
1225
Ok ( None ) => Ok ( EvaluatedToAmbig ) ,
1218
1226
Err ( Overflow ( OverflowError :: Canonical ) ) => Err ( OverflowError :: Canonical ) ,
1219
- Err ( ..) => Ok ( EvaluatedToErr ) ,
1227
+ Err ( ..) => Ok ( EvaluatedToErr ( 20 ) ) ,
1220
1228
}
1221
1229
}
1222
1230
@@ -1264,7 +1272,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
1264
1272
selection. nested_obligations ( ) . into_iter ( ) ,
1265
1273
)
1266
1274
}
1267
- Err ( ..) => Ok ( EvaluatedToErr ) ,
1275
+ Err ( ..) => Ok ( EvaluatedToErr ( 21 ) ) ,
1268
1276
}
1269
1277
} ) ?;
1270
1278
@@ -1697,7 +1705,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
1697
1705
self . evaluation_probe ( |this| {
1698
1706
match this. match_where_clause_trait_ref ( stack. obligation , where_clause_trait_ref) {
1699
1707
Ok ( obligations) => this. evaluate_predicates_recursively ( stack. list ( ) , obligations) ,
1700
- Err ( ( ) ) => Ok ( EvaluatedToErr ) ,
1708
+ Err ( ( ) ) => Ok ( EvaluatedToErr ( 22 ) ) ,
1701
1709
}
1702
1710
} )
1703
1711
}
@@ -2951,6 +2959,7 @@ impl<'o, 'tcx> TraitObligationStack<'o, 'tcx> {
2951
2959
/// provisional results added from the subtree that encountered the
2952
2960
/// error. When we pop the node at `reached_depth` from the stack, we
2953
2961
/// can commit all the things that remain in the provisional cache.
2962
+ #[ derive( Debug ) ]
2954
2963
struct ProvisionalEvaluationCache < ' tcx > {
2955
2964
/// next "depth first number" to issue -- just a counter
2956
2965
dfn : Cell < usize > ,
@@ -3128,7 +3137,7 @@ impl<'tcx> ProvisionalEvaluationCache<'tcx> {
3128
3137
}
3129
3138
}
3130
3139
3131
- #[ derive( Copy , Clone ) ]
3140
+ #[ derive( Copy , Clone , Debug ) ]
3132
3141
struct TraitObligationStackList < ' o , ' tcx > {
3133
3142
cache : & ' o ProvisionalEvaluationCache < ' tcx > ,
3134
3143
head : Option < & ' o TraitObligationStack < ' o , ' tcx > > ,
0 commit comments