@@ -907,19 +907,21 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
907
907
did : DefId ,
908
908
item_segment : & hir:: PathSegment < ' _ > ,
909
909
) -> Ty < ' tcx > {
910
+ let tcx = self . tcx ( ) ;
910
911
let args = self . ast_path_args_for_ty ( span, did, item_segment) ;
911
- let ty = self . tcx ( ) . at ( span) . type_of ( did) ;
912
+ let ty = tcx. at ( span) . type_of ( did) ;
912
913
913
- if matches ! ( self . tcx ( ) . def_kind ( did ) , DefKind :: TyAlias )
914
- && ( ty . skip_binder ( ) . has_opaque_types ( ) || self . tcx ( ) . features ( ) . lazy_type_alias )
914
+ if let DefKind :: TyAlias { lazy } = tcx . def_kind ( did )
915
+ && ( lazy || ty . skip_binder ( ) . has_opaque_types ( ) )
915
916
{
916
917
// Type aliases referring to types that contain opaque types (but aren't just directly
917
- // referencing a single opaque type) get encoded as a type alias that normalization will
918
+ // referencing a single opaque type) as well as those defined in crates that have the
919
+ // feature `lazy_type_alias` enabled get encoded as a type alias that normalization will
918
920
// then actually instantiate the where bounds of.
919
- let alias_ty = self . tcx ( ) . mk_alias_ty ( did, args) ;
920
- Ty :: new_alias ( self . tcx ( ) , ty:: Weak , alias_ty)
921
+ let alias_ty = tcx. mk_alias_ty ( did, args) ;
922
+ Ty :: new_alias ( tcx, ty:: Weak , alias_ty)
921
923
} else {
922
- ty. instantiate ( self . tcx ( ) , args)
924
+ ty. instantiate ( tcx, args)
923
925
}
924
926
}
925
927
@@ -2158,7 +2160,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
2158
2160
}
2159
2161
Res :: Def (
2160
2162
DefKind :: Enum
2161
- | DefKind :: TyAlias
2163
+ | DefKind :: TyAlias { .. }
2162
2164
| DefKind :: Struct
2163
2165
| DefKind :: Union
2164
2166
| DefKind :: ForeignTy ,
0 commit comments