@@ -90,15 +90,7 @@ enum ProjectionCandidate<'tcx> {
9090 /// From an "impl" (or a "pseudo-impl" returned by select)
9191 Select ( Selection < ' tcx > ) ,
9292
93- ImplTraitInTrait ( ImplTraitInTraitCandidate < ' tcx > ) ,
94- }
95-
96- #[ derive( PartialEq , Eq , Debug ) ]
97- enum ImplTraitInTraitCandidate < ' tcx > {
98- // The `impl Trait` from a trait function's default body
99- Trait ,
100- // A concrete type provided from a trait's `impl Trait` from an impl
101- Impl ( ImplSourceUserDefinedData < ' tcx , PredicateObligation < ' tcx > > ) ,
93+ ImplTraitInTrait ( ImplSourceUserDefinedData < ' tcx , PredicateObligation < ' tcx > > ) ,
10294}
10395
10496enum ProjectionCandidateSet < ' tcx > {
@@ -1292,17 +1284,6 @@ fn assemble_candidate_for_impl_trait_in_trait<'cx, 'tcx>(
12921284 let tcx = selcx. tcx ( ) ;
12931285 if tcx. def_kind ( obligation. predicate . def_id ) == DefKind :: ImplTraitPlaceholder {
12941286 let trait_fn_def_id = tcx. impl_trait_in_trait_parent ( obligation. predicate . def_id ) ;
1295- // If we are trying to project an RPITIT with trait's default `Self` parameter,
1296- // then we must be within a default trait body.
1297- if obligation. predicate . self_ty ( )
1298- == ty:: InternalSubsts :: identity_for_item ( tcx, obligation. predicate . def_id ) . type_at ( 0 )
1299- && tcx. associated_item ( trait_fn_def_id) . defaultness ( tcx) . has_value ( )
1300- {
1301- candidate_set. push_candidate ( ProjectionCandidate :: ImplTraitInTrait (
1302- ImplTraitInTraitCandidate :: Trait ,
1303- ) ) ;
1304- return ;
1305- }
13061287
13071288 let trait_def_id = tcx. parent ( trait_fn_def_id) ;
13081289 let trait_substs =
@@ -1313,9 +1294,7 @@ fn assemble_candidate_for_impl_trait_in_trait<'cx, 'tcx>(
13131294 let _ = selcx. infcx . commit_if_ok ( |_| {
13141295 match selcx. select ( & obligation. with ( tcx, trait_predicate) ) {
13151296 Ok ( Some ( super :: ImplSource :: UserDefined ( data) ) ) => {
1316- candidate_set. push_candidate ( ProjectionCandidate :: ImplTraitInTrait (
1317- ImplTraitInTraitCandidate :: Impl ( data) ,
1318- ) ) ;
1297+ candidate_set. push_candidate ( ProjectionCandidate :: ImplTraitInTrait ( data) ) ;
13191298 Ok ( ( ) )
13201299 }
13211300 Ok ( None ) => {
@@ -1777,18 +1756,9 @@ fn confirm_candidate<'cx, 'tcx>(
17771756 ProjectionCandidate :: Select ( impl_source) => {
17781757 confirm_select_candidate ( selcx, obligation, impl_source)
17791758 }
1780- ProjectionCandidate :: ImplTraitInTrait ( ImplTraitInTraitCandidate :: Impl ( data) ) => {
1759+ ProjectionCandidate :: ImplTraitInTrait ( data) => {
17811760 confirm_impl_trait_in_trait_candidate ( selcx, obligation, data)
17821761 }
1783- // If we're projecting an RPITIT for a default trait body, that's just
1784- // the same def-id, but as an opaque type (with regular RPIT semantics).
1785- ProjectionCandidate :: ImplTraitInTrait ( ImplTraitInTraitCandidate :: Trait ) => Progress {
1786- term : selcx
1787- . tcx ( )
1788- . mk_opaque ( obligation. predicate . def_id , obligation. predicate . substs )
1789- . into ( ) ,
1790- obligations : vec ! [ ] ,
1791- } ,
17921762 } ;
17931763
17941764 // When checking for cycle during evaluation, we compare predicates with
0 commit comments