@@ -90,15 +90,7 @@ enum ProjectionCandidate<'tcx> {
90
90
/// From an "impl" (or a "pseudo-impl" returned by select)
91
91
Select ( Selection < ' tcx > ) ,
92
92
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 > > ) ,
102
94
}
103
95
104
96
enum ProjectionCandidateSet < ' tcx > {
@@ -1292,17 +1284,6 @@ fn assemble_candidate_for_impl_trait_in_trait<'cx, 'tcx>(
1292
1284
let tcx = selcx. tcx ( ) ;
1293
1285
if tcx. def_kind ( obligation. predicate . def_id ) == DefKind :: ImplTraitPlaceholder {
1294
1286
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
- }
1306
1287
1307
1288
let trait_def_id = tcx. parent ( trait_fn_def_id) ;
1308
1289
let trait_substs =
@@ -1313,9 +1294,7 @@ fn assemble_candidate_for_impl_trait_in_trait<'cx, 'tcx>(
1313
1294
let _ = selcx. infcx . commit_if_ok ( |_| {
1314
1295
match selcx. select ( & obligation. with ( tcx, trait_predicate) ) {
1315
1296
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) ) ;
1319
1298
Ok ( ( ) )
1320
1299
}
1321
1300
Ok ( None ) => {
@@ -1777,18 +1756,9 @@ fn confirm_candidate<'cx, 'tcx>(
1777
1756
ProjectionCandidate :: Select ( impl_source) => {
1778
1757
confirm_select_candidate ( selcx, obligation, impl_source)
1779
1758
}
1780
- ProjectionCandidate :: ImplTraitInTrait ( ImplTraitInTraitCandidate :: Impl ( data) ) => {
1759
+ ProjectionCandidate :: ImplTraitInTrait ( data) => {
1781
1760
confirm_impl_trait_in_trait_candidate ( selcx, obligation, data)
1782
1761
}
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
- } ,
1792
1762
} ;
1793
1763
1794
1764
// When checking for cycle during evaluation, we compare predicates with
0 commit comments