@@ -118,8 +118,7 @@ fn gather_explicit_predicates_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Gen
118118
119119 let impl_assoc_identity_args = ty:: GenericArgs :: identity_for_item ( tcx, def_id) ;
120120 let impl_def_id = tcx. parent ( fn_def_id) ;
121- let impl_trait_ref_args =
122- tcx. impl_trait_ref ( impl_def_id) . unwrap ( ) . instantiate_identity ( ) . args ;
121+ let impl_trait_ref_args = tcx. impl_trait_ref ( impl_def_id) . instantiate_identity ( ) . args ;
123122
124123 let impl_assoc_args =
125124 impl_assoc_identity_args. rebase_onto ( tcx, impl_def_id, impl_trait_ref_args) ;
@@ -162,9 +161,8 @@ fn gather_explicit_predicates_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Gen
162161 if let Some ( of_trait) = impl_. of_trait
163162 && of_trait. defaultness . is_default ( )
164163 {
165- is_default_impl_trait = tcx
166- . impl_trait_ref ( def_id)
167- . map ( |t| ty:: Binder :: dummy ( t. instantiate_identity ( ) ) ) ;
164+ is_default_impl_trait =
165+ Some ( ty:: Binder :: dummy ( tcx. impl_trait_ref ( def_id) . instantiate_identity ( ) ) ) ;
168166 }
169167 }
170168 ItemKind :: Trait ( _, _, _, _, _, self_bounds, ..)
@@ -352,10 +350,8 @@ fn gather_explicit_predicates_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Gen
352350 // for details.
353351 if let Node :: Item ( & Item { kind : ItemKind :: Impl ( impl_) , .. } ) = node {
354352 let self_ty = tcx. type_of ( def_id) . instantiate_identity ( ) ;
355- let trait_ref = impl_
356- . of_trait
357- . is_some ( )
358- . then ( || tcx. impl_trait_ref ( def_id) . unwrap ( ) . instantiate_identity ( ) ) ;
353+ let trait_ref =
354+ impl_. of_trait . is_some ( ) . then ( || tcx. impl_trait_ref ( def_id) . instantiate_identity ( ) ) ;
359355 cgp:: setup_constraining_predicates (
360356 tcx,
361357 & mut predicates,
@@ -467,7 +463,7 @@ fn const_evaluatable_predicates_of<'tcx>(
467463 {
468464 if impl_. of_trait . is_some ( ) {
469465 debug ! ( "visit impl trait_ref" ) ;
470- let trait_ref = tcx. impl_trait_ref ( def_id) . unwrap ( ) ;
466+ let trait_ref = tcx. impl_trait_ref ( def_id) ;
471467 trait_ref. instantiate_identity ( ) . visit_with ( & mut collector) ;
472468 }
473469
0 commit comments