@@ -910,19 +910,24 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
910
910
) -> Ty < ' tcx > {
911
911
let tcx = self . tcx ( ) ;
912
912
let args = self . ast_path_args_for_ty ( span, did, item_segment) ;
913
- let ty = tcx. at ( span) . type_of ( did) ;
914
913
915
- if let DefKind :: TyAlias { lazy } = tcx. def_kind ( did)
916
- && ( lazy || ty. skip_binder ( ) . has_opaque_types ( ) )
917
- {
918
- // Type aliases referring to types that contain opaque types (but aren't just directly
919
- // referencing a single opaque type) as well as those defined in crates that have the
914
+ if let DefKind :: TyAlias { lazy : true } = tcx. def_kind ( did) {
915
+ // Type aliases defined in crates that have the
920
916
// feature `lazy_type_alias` enabled get encoded as a type alias that normalization will
921
917
// then actually instantiate the where bounds of.
922
918
let alias_ty = tcx. mk_alias_ty ( did, args) ;
923
919
Ty :: new_alias ( tcx, ty:: Weak , alias_ty)
924
920
} else {
925
- ty. instantiate ( tcx, args)
921
+ let ty = tcx. at ( span) . type_of ( did) ;
922
+ if ty. skip_binder ( ) . has_opaque_types ( ) {
923
+ // Type aliases referring to types that contain opaque types (but aren't just directly
924
+ // referencing a single opaque type) get encoded as a type alias that normalization will
925
+ // then actually instantiate the where bounds of.
926
+ let alias_ty = tcx. mk_alias_ty ( did, args) ;
927
+ Ty :: new_alias ( tcx, ty:: Weak , alias_ty)
928
+ } else {
929
+ ty. instantiate ( tcx, args)
930
+ }
926
931
}
927
932
}
928
933
0 commit comments