@@ -1213,11 +1213,20 @@ pub struct AliasTy<'tcx> {
12131213     pub  def_id :  DefId , 
12141214
12151215    /// This field exists to prevent the creation of `AliasTy` without using 
1216-      /// [TyCtxt::mk_alias_ty ]. 
1217-      pub ( super )   _use_mk_alias_ty_instead :  ( ) , 
1216+      /// [AliasTy::new ]. 
1217+      _use_alias_ty_new_instead :  ( ) , 
12181218} 
12191219
12201220impl < ' tcx >  AliasTy < ' tcx >  { 
1221+     pub  fn  new ( 
1222+         tcx :  TyCtxt < ' tcx > , 
1223+         def_id :  DefId , 
1224+         args :  impl  IntoIterator < Item :  Into < GenericArg < ' tcx > > > , 
1225+     )  -> ty:: AliasTy < ' tcx >  { 
1226+         let  args = tcx. check_and_mk_args ( def_id,  args) ; 
1227+         ty:: AliasTy  {  def_id,  args,  _use_alias_ty_new_instead :  ( )  } 
1228+     } 
1229+ 
12211230    pub  fn  kind ( self ,  tcx :  TyCtxt < ' tcx > )  -> ty:: AliasKind  { 
12221231        match  tcx. def_kind ( self . def_id )  { 
12231232            DefKind :: AssocTy 
@@ -1245,7 +1254,7 @@ impl<'tcx> AliasTy<'tcx> {
12451254    } 
12461255
12471256    pub  fn  with_self_ty ( self ,  tcx :  TyCtxt < ' tcx > ,  self_ty :  Ty < ' tcx > )  -> Self  { 
1248-         tcx . mk_alias_ty ( self . def_id ,  [ self_ty. into ( ) ] . into_iter ( ) . chain ( self . args . iter ( ) . skip ( 1 ) ) ) 
1257+         AliasTy :: new ( tcx ,   self . def_id ,  [ self_ty. into ( ) ] . into_iter ( ) . chain ( self . args . iter ( ) . skip ( 1 ) ) ) 
12491258    } 
12501259} 
12511260
@@ -1667,8 +1676,11 @@ impl<'tcx> ExistentialProjection<'tcx> {
16671676        debug_assert ! ( !self_ty. has_escaping_bound_vars( ) ) ; 
16681677
16691678        ty:: ProjectionPredicate  { 
1670-             projection_ty :  tcx
1671-                 . mk_alias_ty ( self . def_id ,  [ self_ty. into ( ) ] . into_iter ( ) . chain ( self . args ) ) , 
1679+             projection_ty :  AliasTy :: new ( 
1680+                 tcx, 
1681+                 self . def_id , 
1682+                 [ self_ty. into ( ) ] . into_iter ( ) . chain ( self . args ) , 
1683+             ) , 
16721684            term :  self . term , 
16731685        } 
16741686    } 
@@ -1971,7 +1983,7 @@ impl<'tcx> Ty<'tcx> {
19711983
19721984    #[ inline]  
19731985    pub  fn  new_opaque ( tcx :  TyCtxt < ' tcx > ,  def_id :  DefId ,  args :  GenericArgsRef < ' tcx > )  -> Ty < ' tcx >  { 
1974-         Ty :: new_alias ( tcx,  ty:: Opaque ,  tcx . mk_alias_ty ( def_id,  args) ) 
1986+         Ty :: new_alias ( tcx,  ty:: Opaque ,  AliasTy :: new ( tcx ,   def_id,  args) ) 
19751987    } 
19761988
19771989    /// Constructs a `TyKind::Error` type with current `ErrorGuaranteed` 
@@ -2135,7 +2147,7 @@ impl<'tcx> Ty<'tcx> {
21352147        item_def_id :  DefId , 
21362148        args :  impl  IntoIterator < Item :  Into < GenericArg < ' tcx > > > , 
21372149    )  -> Ty < ' tcx >  { 
2138-         Ty :: new_alias ( tcx,  ty:: Projection ,  tcx . mk_alias_ty ( item_def_id,  args) ) 
2150+         Ty :: new_alias ( tcx,  ty:: Projection ,  AliasTy :: new ( tcx ,   item_def_id,  args) ) 
21392151    } 
21402152
21412153    #[ inline]  
0 commit comments