@@ -2024,8 +2024,8 @@ pub(crate) fn clean_middle_ty<'tcx>(
2024
2024
Tuple ( t. iter ( ) . map ( |t| clean_middle_ty ( bound_ty. rebind ( t) , cx, None , None ) ) . collect ( ) )
2025
2025
}
2026
2026
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)
2029
2029
}
2030
2030
2031
2031
ty:: Alias ( ty:: Inherent , alias_ty) => {
@@ -2053,8 +2053,21 @@ pub(crate) fn clean_middle_ty<'tcx>(
2053
2053
}
2054
2054
2055
2055
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
+ }
2058
2071
}
2059
2072
2060
2073
ty:: Param ( ref p) => {
0 commit comments