@@ -1577,50 +1577,15 @@ pub type PlaceholderConst = Placeholder<BoundVar>;
1577
1577
/// know their corresponding parameters. We (ab)use this by
1578
1578
/// calling `type_of(param_did)` for these arguments.
1579
1579
#[ derive( Copy , Clone , Debug , RustcEncodable , RustcDecodable ) ]
1580
+ #[ derive( PartialEq , Eq , PartialOrd , Ord ) ]
1581
+ #[ derive( Hash , HashStable ) ]
1580
1582
pub struct WithOptParam < T > {
1581
1583
pub did : T ,
1582
1584
/// The `DefId` of the corresponding generic paramter in case `did` is
1583
1585
/// a const argument.
1584
- ///
1585
- /// This must always be equal to `tcx.const_param_of(did)`.
1586
1586
pub param_did : Option < DefId > ,
1587
1587
}
1588
1588
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
-
1624
1589
impl < ' tcx > TyCtxt < ' tcx > {
1625
1590
#[ inline( always) ]
1626
1591
pub fn with_opt_param < T : IntoQueryParam < DefId > + Copy > ( self , did : T ) -> WithOptParam < T > {
0 commit comments