@@ -907,19 +907,21 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
907907 did : DefId ,
908908 item_segment : & hir:: PathSegment < ' _ > ,
909909 ) -> Ty < ' tcx > {
910+ let tcx = self . tcx ( ) ;
910911 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) ;
912913
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 ( ) )
915916 {
916917 // 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
918920 // 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)
921923 } else {
922- ty. instantiate ( self . tcx ( ) , args)
924+ ty. instantiate ( tcx, args)
923925 }
924926 }
925927
@@ -2158,7 +2160,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
21582160 }
21592161 Res :: Def (
21602162 DefKind :: Enum
2161- | DefKind :: TyAlias
2163+ | DefKind :: TyAlias { .. }
21622164 | DefKind :: Struct
21632165 | DefKind :: Union
21642166 | DefKind :: ForeignTy ,
0 commit comments