File tree Expand file tree Collapse file tree 6 files changed +13
-7
lines changed
compiler/rustc_ty_utils/src Expand file tree Collapse file tree 6 files changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -396,6 +396,8 @@ fn associated_type_for_impl_trait_in_impl(
396
396
impl_assoc_ty. impl_defaultness ( tcx. impl_defaultness ( impl_fn_def_id) ) ;
397
397
398
398
// Copy generics_of the trait's associated item but the impl as the parent.
399
+ // FIXME(-Zlower-impl-trait-in-trait-to-assoc-ty) resolves to the trait instead of the impl
400
+ // generics.
399
401
impl_assoc_ty. generics_of ( {
400
402
let trait_assoc_generics = tcx. generics_of ( trait_assoc_def_id) ;
401
403
let trait_assoc_parent_count = trait_assoc_generics. parent_count ;
@@ -404,16 +406,10 @@ fn associated_type_for_impl_trait_in_impl(
404
406
let parent_generics = tcx. generics_of ( impl_def_id) ;
405
407
let parent_count = parent_generics. parent_count + parent_generics. params . len ( ) ;
406
408
407
- let mut impl_fn_params = tcx. generics_of ( impl_fn_def_id) . params . clone ( ) ;
408
-
409
409
for param in & mut params {
410
- param. index = param. index + parent_count as u32 + impl_fn_params. len ( ) as u32
411
- - trait_assoc_parent_count as u32 ;
410
+ param. index = param. index + parent_count as u32 - trait_assoc_parent_count as u32 ;
412
411
}
413
412
414
- impl_fn_params. extend ( params) ;
415
- params = impl_fn_params;
416
-
417
413
let param_def_id_to_index =
418
414
params. iter ( ) . map ( |param| ( param. def_id , param. index ) ) . collect ( ) ;
419
415
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