@@ -1577,50 +1577,15 @@ pub type PlaceholderConst = Placeholder<BoundVar>;
15771577/// know their corresponding parameters. We (ab)use this by
15781578/// calling `type_of(param_did)` for these arguments.
15791579#[ derive( Copy , Clone , Debug , RustcEncodable , RustcDecodable ) ]
1580+ #[ derive( PartialEq , Eq , PartialOrd , Ord ) ]
1581+ #[ derive( Hash , HashStable ) ]
15801582pub struct WithOptParam < T > {
15811583 pub did : T ,
15821584 /// The `DefId` of the corresponding generic paramter in case `did` is
15831585 /// a const argument.
1584- ///
1585- /// This must always be equal to `tcx.const_param_of(did)`.
15861586 pub param_did : Option < DefId > ,
15871587}
15881588
1589- // We manually implement most traits for `WithOptParam`
1590- // as the `param_did` is redundant.
1591-
1592- impl < T : PartialEq > PartialEq for WithOptParam < T > {
1593- fn eq ( & self , other : & Self ) -> bool {
1594- self . did == other. did
1595- }
1596- }
1597-
1598- impl < T : Hash > Hash for WithOptParam < T > {
1599- fn hash < H : Hasher > ( & self , state : & mut H ) {
1600- self . did . hash ( state) ;
1601- }
1602- }
1603-
1604- impl < CTX , T : HashStable < CTX > > HashStable < CTX > for WithOptParam < T > {
1605- fn hash_stable ( & self , hcx : & mut CTX , hasher : & mut StableHasher ) {
1606- self . did . hash_stable ( hcx, hasher) ;
1607- }
1608- }
1609-
1610- impl < T : Eq > Eq for WithOptParam < T > { }
1611-
1612- impl < T : PartialOrd > PartialOrd for WithOptParam < T > {
1613- fn partial_cmp ( & self , other : & Self ) -> Option < Ordering > {
1614- self . did . partial_cmp ( & other. did )
1615- }
1616- }
1617-
1618- impl < T : Ord > Ord for WithOptParam < T > {
1619- fn cmp ( & self , other : & Self ) -> Ordering {
1620- self . did . cmp ( & other. did )
1621- }
1622- }
1623-
16241589impl < ' tcx > TyCtxt < ' tcx > {
16251590 #[ inline( always) ]
16261591 pub fn with_opt_param < T : IntoQueryParam < DefId > + Copy > ( self , did : T ) -> WithOptParam < T > {
0 commit comments