@@ -2024,8 +2024,8 @@ pub(crate) fn clean_middle_ty<'tcx>(
20242024 Tuple ( t. iter ( ) . map ( |t| clean_middle_ty ( bound_ty. rebind ( t) , cx, None , None ) ) . collect ( ) )
20252025 }
20262026
2027- ty:: Alias ( ty:: Projection , ref data) => {
2028- clean_projection ( bound_ty. rebind ( * data) , cx, parent_def_id)
2027+ ty:: Alias ( ty:: Projection , data) => {
2028+ clean_projection ( bound_ty. rebind ( data) , cx, parent_def_id)
20292029 }
20302030
20312031 ty:: Alias ( ty:: Inherent , alias_ty) => {
@@ -2053,8 +2053,21 @@ pub(crate) fn clean_middle_ty<'tcx>(
20532053 }
20542054
20552055 ty:: Alias ( ty:: Weak , data) => {
2056- let ty = cx. tcx . type_of ( data. def_id ) . subst ( cx. tcx , data. substs ) ;
2057- clean_middle_ty ( bound_ty. rebind ( ty) , cx, None , None )
2056+ if cx. tcx . features ( ) . lazy_type_alias {
2057+ // Weak type alias `data` represents the `type X` in `type X = Y`. If we need `Y`,
2058+ // we need to use `type_of`.
2059+ let path = external_path (
2060+ cx,
2061+ data. def_id ,
2062+ false ,
2063+ ThinVec :: new ( ) ,
2064+ bound_ty. rebind ( data. substs ) ,
2065+ ) ;
2066+ Type :: Path { path }
2067+ } else {
2068+ let ty = cx. tcx . type_of ( data. def_id ) . subst ( cx. tcx , data. substs ) ;
2069+ clean_middle_ty ( bound_ty. rebind ( ty) , cx, None , None )
2070+ }
20582071 }
20592072
20602073 ty:: Param ( ref p) => {
0 commit comments