@@ -12,10 +12,8 @@ use rustc_data_structures::intern::Interned;
1212use rustc_data_structures:: sync:: Lrc ;
1313use rustc_data_structures:: undo_log:: UndoLogs ;
1414use rustc_data_structures:: unify as ut;
15- use rustc_hir:: def_id:: DefId ;
1615use rustc_index:: vec:: IndexVec ;
1716use rustc_middle:: infer:: unify_key:: { RegionVidKey , UnifiedRegion } ;
18- use rustc_middle:: ty:: subst:: SubstsRef ;
1917use rustc_middle:: ty:: ReStatic ;
2018use rustc_middle:: ty:: { self , Ty , TyCtxt } ;
2119use rustc_middle:: ty:: { ReLateBound , ReVar } ;
@@ -169,8 +167,7 @@ pub struct Verify<'tcx> {
169167#[ derive( Copy , Clone , PartialEq , Eq , Hash , TypeFoldable , TypeVisitable ) ]
170168pub enum GenericKind < ' tcx > {
171169 Param ( ty:: ParamTy ) ,
172- Projection ( ty:: AliasTy < ' tcx > ) ,
173- Opaque ( DefId , SubstsRef < ' tcx > ) ,
170+ Alias ( ty:: AliasKind , ty:: AliasTy < ' tcx > ) ,
174171}
175172
176173/// Describes the things that some `GenericKind` value `G` is known to
@@ -749,9 +746,9 @@ impl<'tcx> fmt::Debug for GenericKind<'tcx> {
749746 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
750747 match * self {
751748 GenericKind :: Param ( ref p) => write ! ( f, "{:?}" , p) ,
752- GenericKind :: Projection ( ref p) => write ! ( f, "{:?}" , p) ,
753- GenericKind :: Opaque ( def_id , substs ) => ty:: tls:: with ( |tcx| {
754- write ! ( f, "{}" , tcx. def_path_str_with_substs( def_id, tcx. lift( substs) . unwrap( ) ) )
749+ GenericKind :: Alias ( ty :: Projection , ref p) => write ! ( f, "{:?}" , p) ,
750+ GenericKind :: Alias ( ty :: Opaque , ref p ) => ty:: tls:: with ( |tcx| {
751+ write ! ( f, "{}" , tcx. def_path_str_with_substs( p . def_id, tcx. lift( p . substs) . unwrap( ) ) )
755752 } ) ,
756753 }
757754 }
@@ -761,9 +758,9 @@ impl<'tcx> fmt::Display for GenericKind<'tcx> {
761758 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
762759 match * self {
763760 GenericKind :: Param ( ref p) => write ! ( f, "{}" , p) ,
764- GenericKind :: Projection ( ref p) => write ! ( f, "{}" , p) ,
765- GenericKind :: Opaque ( def_id , substs ) => ty:: tls:: with ( |tcx| {
766- write ! ( f, "{}" , tcx. def_path_str_with_substs( def_id, tcx. lift( substs) . unwrap( ) ) )
761+ GenericKind :: Alias ( ty :: Projection , ref p) => write ! ( f, "{}" , p) ,
762+ GenericKind :: Alias ( ty :: Opaque , ref p ) => ty:: tls:: with ( |tcx| {
763+ write ! ( f, "{}" , tcx. def_path_str_with_substs( p . def_id, tcx. lift( p . substs) . unwrap( ) ) )
767764 } ) ,
768765 }
769766 }
@@ -773,8 +770,7 @@ impl<'tcx> GenericKind<'tcx> {
773770 pub fn to_ty ( & self , tcx : TyCtxt < ' tcx > ) -> Ty < ' tcx > {
774771 match * self {
775772 GenericKind :: Param ( ref p) => p. to_ty ( tcx) ,
776- GenericKind :: Projection ( ref p) => tcx. mk_projection ( p. def_id , p. substs ) ,
777- GenericKind :: Opaque ( def_id, substs) => tcx. mk_opaque ( def_id, substs) ,
773+ GenericKind :: Alias ( kind, data) => tcx. mk_ty ( ty:: Alias ( kind, data) ) ,
778774 }
779775 }
780776}
0 commit comments