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> {
31333133 if let ObligationCauseCode :: ExprBindingObligation ( def_id, _, _, idx) = parent_code. deref ( )
31343134 && let predicates = self . tcx . predicates_of ( def_id) . instantiate_identity ( self . tcx )
31353135 && 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+ } )
31373140 {
31383141 let mut c = CollectAllMismatches {
31393142 infcx : self . infcx ,
31403143 param_env,
31413144 errors : vec ! [ ] ,
31423145 } ;
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 ) {
31483151 type_diffs = c. errors ;
31493152 }
31503153 }
You can’t perform that action at this time.
0 commit comments