@@ -12,8 +12,10 @@ 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 ;
1516use rustc_index:: vec:: IndexVec ;
1617use rustc_middle:: infer:: unify_key:: { RegionVidKey , UnifiedRegion } ;
18+ use rustc_middle:: ty:: subst:: SubstsRef ;
1719use rustc_middle:: ty:: ReStatic ;
1820use rustc_middle:: ty:: { self , Ty , TyCtxt } ;
1921use rustc_middle:: ty:: { ReLateBound , ReVar } ;
@@ -168,6 +170,7 @@ pub struct Verify<'tcx> {
168170pub enum GenericKind < ' tcx > {
169171 Param ( ty:: ParamTy ) ,
170172 Projection ( ty:: ProjectionTy < ' tcx > ) ,
173+ Opaque ( DefId , SubstsRef < ' tcx > ) ,
171174}
172175
173176/// Describes the things that some `GenericKind` value `G` is known to
@@ -747,6 +750,9 @@ impl<'tcx> fmt::Debug for GenericKind<'tcx> {
747750 match * self {
748751 GenericKind :: Param ( ref p) => write ! ( f, "{:?}" , p) ,
749752 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( ) ) )
755+ } ) ,
750756 }
751757 }
752758}
@@ -756,6 +762,9 @@ impl<'tcx> fmt::Display for GenericKind<'tcx> {
756762 match * self {
757763 GenericKind :: Param ( ref p) => write ! ( f, "{}" , p) ,
758764 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( ) ) )
767+ } ) ,
759768 }
760769 }
761770}
@@ -765,6 +774,7 @@ impl<'tcx> GenericKind<'tcx> {
765774 match * self {
766775 GenericKind :: Param ( ref p) => p. to_ty ( tcx) ,
767776 GenericKind :: Projection ( ref p) => tcx. mk_projection ( p. item_def_id , p. substs ) ,
777+ GenericKind :: Opaque ( def_id, substs) => tcx. mk_opaque ( def_id, substs) ,
768778 }
769779 }
770780}
0 commit comments