This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed
compiler/rustc_trait_selection/src/traits/error_reporting Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -3133,18 +3133,21 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
3133
3133
if let ObligationCauseCode :: ExprBindingObligation ( def_id, _, _, idx) = parent_code. deref ( )
3134
3134
&& let predicates = self . tcx . predicates_of ( def_id) . instantiate_identity ( self . tcx )
3135
3135
&& let Some ( pred) = predicates. predicates . get ( * idx)
3136
- && let ty:: PredicateKind :: Clause ( ty:: Clause :: Trait ( trait_pred) ) = pred. kind ( ) . skip_binder ( )
3136
+ && let Ok ( trait_pred) = pred. kind ( ) . try_map_bound ( |pred| match pred {
3137
+ ty:: PredicateKind :: Clause ( ty:: Clause :: Trait ( trait_pred) ) => Ok ( trait_pred) ,
3138
+ _ => Err ( ( ) ) ,
3139
+ } )
3137
3140
{
3138
3141
let mut c = CollectAllMismatches {
3139
3142
infcx : self . infcx ,
3140
3143
param_env,
3141
3144
errors : vec ! [ ] ,
3142
3145
} ;
3143
- if let ty :: PredicateKind :: Clause ( ty :: Clause :: Trait (
3144
- predicate
3145
- ) ) = predicate . kind ( ) . skip_binder ( )
3146
- {
3147
- if let Ok ( _) = c. relate ( trait_pred, predicate ) {
3146
+ if let Ok ( trait_predicate ) = predicate . kind ( ) . try_map_bound ( |pred| match pred {
3147
+ ty :: PredicateKind :: Clause ( ty :: Clause :: Trait ( trait_pred ) ) => Ok ( trait_pred ) ,
3148
+ _ => Err ( ( ) ) ,
3149
+ } ) {
3150
+ if let Ok ( _) = c. relate ( trait_pred, trait_predicate ) {
3148
3151
type_diffs = c. errors ;
3149
3152
}
3150
3153
}
You can’t perform that action at this time.
0 commit comments