File tree 6 files changed +13
-7
lines changed
compiler/rustc_ty_utils/src
6 files changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -383,6 +383,8 @@ fn impl_associated_item_for_impl_trait_in_trait(
383
383
impl_assoc_ty. impl_defaultness ( tcx. impl_defaultness ( impl_fn_def_id) ) ;
384
384
385
385
// Copy generics_of the trait's associated item but the impl as the parent.
386
+ // FIXME(-Zlower-impl-trait-in-trait-to-assoc-ty) resolves to the trait instead of the impl
387
+ // generics.
386
388
impl_assoc_ty. generics_of ( {
387
389
let trait_assoc_generics = tcx. generics_of ( trait_assoc_def_id) ;
388
390
let trait_assoc_parent_count = trait_assoc_generics. parent_count ;
@@ -391,16 +393,10 @@ fn impl_associated_item_for_impl_trait_in_trait(
391
393
let parent_generics = tcx. generics_of ( impl_def_id) ;
392
394
let parent_count = parent_generics. parent_count + parent_generics. params . len ( ) ;
393
395
394
- let mut impl_fn_params = tcx. generics_of ( impl_fn_def_id) . params . clone ( ) ;
395
-
396
396
for param in & mut params {
397
- param. index = param. index + parent_count as u32 + impl_fn_params. len ( ) as u32
398
- - trait_assoc_parent_count as u32 ;
397
+ param. index = param. index + parent_count as u32 - trait_assoc_parent_count as u32 ;
399
398
}
400
399
401
- impl_fn_params. extend ( params) ;
402
- params = impl_fn_params;
403
-
404
400
let param_def_id_to_index =
405
401
params. iter ( ) . map ( |param| ( param. def_id , param. index ) ) . collect ( ) ;
406
402
Original file line number Diff line number Diff line change 1
1
// check-pass
2
2
// edition:2021
3
+ // [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
4
+ // revisions: current next
3
5
4
6
#![ feature( async_fn_in_trait) ]
5
7
#![ allow( incomplete_features) ]
Original file line number Diff line number Diff line change 1
1
// check-pass
2
2
// edition:2021
3
+ // [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
4
+ // revisions: current next
3
5
4
6
#![ feature( async_fn_in_trait, return_position_impl_trait_in_trait) ]
5
7
#![ allow( incomplete_features) ]
Original file line number Diff line number Diff line change 1
1
// check-pass
2
+ // [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
3
+ // revisions: current next
2
4
3
5
#![ feature( return_position_impl_trait_in_trait) ]
4
6
#![ allow( incomplete_features) ]
Original file line number Diff line number Diff line change 1
1
// check-pass
2
+ // [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
3
+ // revisions: current next
2
4
3
5
#![ feature( return_position_impl_trait_in_trait) ]
4
6
#![ allow( incomplete_features) ]
Original file line number Diff line number Diff line change 1
1
// check-pass
2
2
// edition: 2021
3
+ // [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
4
+ // revisions: current next
3
5
4
6
#![ feature( return_position_impl_trait_in_trait) ]
5
7
#![ allow( incomplete_features) ]
You can’t perform that action at this time.
0 commit comments