@@ -574,16 +574,16 @@ rustc_index::newtype_index! {
574574 pub struct TyVid { }
575575}
576576
577- /// An **int**egral (`u32`, `i32`, `usize`, etc.) type **v**ariable **ID**.
578- # [ derive ( Clone , Copy , PartialEq , Eq , PartialOrd , Ord , Hash , Encodable , Decodable ) ]
579- pub struct IntVid {
580- pub index : u32 ,
577+ rustc_index :: newtype_index! {
578+ /// An **int**egral (`u32`, `i32`, `usize`, etc.) type **v**ariable **ID**.
579+ # [ debug_format = "?{}i" ]
580+ pub struct IntVid { }
581581}
582582
583- /// An **float**ing-point (`f32` or `f64`) type **v**ariable **ID**.
584- # [ derive ( Clone , Copy , PartialEq , Eq , PartialOrd , Ord , Hash , Encodable , Decodable ) ]
585- pub struct FloatVid {
586- pub index : u32 ,
583+ rustc_index :: newtype_index! {
584+ /// A **float**ing-point (`f32` or `f64`) type **v**ariable **ID**.
585+ # [ debug_format = "?{}f" ]
586+ pub struct FloatVid { }
587587}
588588
589589/// A placeholder for a type that hasn't been inferred yet.
@@ -645,11 +645,11 @@ impl UnifyKey for IntVid {
645645 type Value = Option < IntVarValue > ;
646646 #[ inline] // make this function eligible for inlining - it is quite hot.
647647 fn index ( & self ) -> u32 {
648- self . index
648+ self . as_u32 ( )
649649 }
650650 #[ inline]
651651 fn from_index ( i : u32 ) -> IntVid {
652- IntVid { index : i }
652+ IntVid :: from_u32 ( i )
653653 }
654654 fn tag ( ) -> & ' static str {
655655 "IntVid"
@@ -662,11 +662,11 @@ impl UnifyKey for FloatVid {
662662 type Value = Option < FloatVarValue > ;
663663 #[ inline]
664664 fn index ( & self ) -> u32 {
665- self . index
665+ self . as_u32 ( )
666666 }
667667 #[ inline]
668668 fn from_index ( i : u32 ) -> FloatVid {
669- FloatVid { index : i }
669+ FloatVid :: from_u32 ( i )
670670 }
671671 fn tag ( ) -> & ' static str {
672672 "FloatVid"
@@ -770,18 +770,6 @@ impl fmt::Debug for FloatVarValue {
770770 }
771771}
772772
773- impl fmt:: Debug for IntVid {
774- fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
775- write ! ( f, "?{}i" , self . index)
776- }
777- }
778-
779- impl fmt:: Debug for FloatVid {
780- fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
781- write ! ( f, "?{}f" , self . index)
782- }
783- }
784-
785773impl fmt:: Debug for Variance {
786774 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
787775 f. write_str ( match * self {
0 commit comments