@@ -12,10 +12,8 @@ use rustc_data_structures::intern::Interned;
12
12
use rustc_data_structures:: sync:: Lrc ;
13
13
use rustc_data_structures:: undo_log:: UndoLogs ;
14
14
use rustc_data_structures:: unify as ut;
15
- use rustc_hir:: def_id:: DefId ;
16
15
use rustc_index:: vec:: IndexVec ;
17
16
use rustc_middle:: infer:: unify_key:: { RegionVidKey , UnifiedRegion } ;
18
- use rustc_middle:: ty:: subst:: SubstsRef ;
19
17
use rustc_middle:: ty:: ReStatic ;
20
18
use rustc_middle:: ty:: { self , Ty , TyCtxt } ;
21
19
use rustc_middle:: ty:: { ReLateBound , ReVar } ;
@@ -169,8 +167,7 @@ pub struct Verify<'tcx> {
169
167
#[ derive( Copy , Clone , PartialEq , Eq , Hash , TypeFoldable , TypeVisitable ) ]
170
168
pub enum GenericKind < ' tcx > {
171
169
Param ( ty:: ParamTy ) ,
172
- Projection ( ty:: AliasTy < ' tcx > ) ,
173
- Opaque ( DefId , SubstsRef < ' tcx > ) ,
170
+ Alias ( ty:: AliasKind , ty:: AliasTy < ' tcx > ) ,
174
171
}
175
172
176
173
/// Describes the things that some `GenericKind` value `G` is known to
@@ -749,9 +746,9 @@ impl<'tcx> fmt::Debug for GenericKind<'tcx> {
749
746
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
750
747
match * self {
751
748
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( ) ) )
755
752
} ) ,
756
753
}
757
754
}
@@ -761,9 +758,9 @@ impl<'tcx> fmt::Display for GenericKind<'tcx> {
761
758
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
762
759
match * self {
763
760
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( ) ) )
767
764
} ) ,
768
765
}
769
766
}
@@ -773,8 +770,7 @@ impl<'tcx> GenericKind<'tcx> {
773
770
pub fn to_ty ( & self , tcx : TyCtxt < ' tcx > ) -> Ty < ' tcx > {
774
771
match * self {
775
772
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) ) ,
778
774
}
779
775
}
780
776
}
0 commit comments