@@ -1099,7 +1099,7 @@ pub enum PredicateKind<'tcx> {
1099
1099
Subtype ( PolySubtypePredicate < ' tcx > ) ,
1100
1100
1101
1101
/// Constant initializer must evaluate successfully.
1102
- ConstEvaluatable ( ty:: WithOptParam < DefId > , SubstsRef < ' tcx > ) ,
1102
+ ConstEvaluatable ( ty:: WithOptConstParam < DefId > , SubstsRef < ' tcx > ) ,
1103
1103
1104
1104
/// Constants must be equal. The first component is the const that is expected.
1105
1105
ConstEquate ( & ' tcx Const < ' tcx > , & ' tcx Const < ' tcx > ) ,
@@ -1601,40 +1601,42 @@ pub type PlaceholderConst = Placeholder<BoundVar>;
1601
1601
#[ derive( Copy , Clone , Debug , TypeFoldable , Lift , RustcEncodable , RustcDecodable ) ]
1602
1602
#[ derive( PartialEq , Eq , PartialOrd , Ord ) ]
1603
1603
#[ derive( Hash , HashStable ) ]
1604
- pub struct WithOptParam < T > {
1604
+ pub struct WithOptConstParam < T > {
1605
1605
pub did : T ,
1606
1606
/// The `DefId` of the corresponding generic paramter in case `did` is
1607
1607
/// a const argument.
1608
1608
///
1609
1609
/// Note that even if `did` is a const argument, this may still be `None`.
1610
- /// All queries taking `WithOptParam ` start by calling `tcx.opt_const_param_of(def.did)`
1610
+ /// All queries taking `WithOptConstParam ` start by calling `tcx.opt_const_param_of(def.did)`
1611
1611
/// to potentially update `param_did` in case it `None`.
1612
- pub param_did : Option < DefId > ,
1612
+ pub const_param_did : Option < DefId > ,
1613
1613
}
1614
1614
1615
- impl < T > WithOptParam < T > {
1616
- pub fn dummy ( did : T ) -> WithOptParam < T > {
1617
- WithOptParam { did, param_did : None }
1615
+ impl < T > WithOptConstParam < T > {
1616
+ pub fn dummy ( did : T ) -> WithOptConstParam < T > {
1617
+ WithOptConstParam { did, const_param_did : None }
1618
1618
}
1619
1619
}
1620
1620
1621
- impl WithOptParam < LocalDefId > {
1622
- pub fn to_global ( self ) -> WithOptParam < DefId > {
1623
- WithOptParam { did : self . did . to_def_id ( ) , param_did : self . param_did }
1621
+ impl WithOptConstParam < LocalDefId > {
1622
+ pub fn to_global ( self ) -> WithOptConstParam < DefId > {
1623
+ WithOptConstParam { did : self . did . to_def_id ( ) , const_param_did : self . const_param_did }
1624
1624
}
1625
1625
1626
1626
pub fn ty_def_id ( self ) -> DefId {
1627
- if let Some ( did) = self . param_did { did } else { self . did . to_def_id ( ) }
1627
+ if let Some ( did) = self . const_param_did { did } else { self . did . to_def_id ( ) }
1628
1628
}
1629
1629
}
1630
1630
1631
- impl WithOptParam < DefId > {
1632
- pub fn as_local ( self ) -> Option < WithOptParam < LocalDefId > > {
1633
- self . did . as_local ( ) . map ( |did| WithOptParam { did, param_did : self . param_did } )
1631
+ impl WithOptConstParam < DefId > {
1632
+ pub fn as_local ( self ) -> Option < WithOptConstParam < LocalDefId > > {
1633
+ self . did
1634
+ . as_local ( )
1635
+ . map ( |did| WithOptConstParam { did, const_param_did : self . const_param_did } )
1634
1636
}
1635
1637
1636
1638
pub fn as_const_arg ( self ) -> Option < ( LocalDefId , DefId ) > {
1637
- if let Some ( param_did) = self . param_did {
1639
+ if let Some ( param_did) = self . const_param_did {
1638
1640
if let Some ( did) = self . did . as_local ( ) {
1639
1641
return Some ( ( did, param_did) ) ;
1640
1642
}
@@ -1643,7 +1645,7 @@ impl WithOptParam<DefId> {
1643
1645
None
1644
1646
}
1645
1647
1646
- pub fn expect_local ( self ) -> WithOptParam < LocalDefId > {
1648
+ pub fn expect_local ( self ) -> WithOptConstParam < LocalDefId > {
1647
1649
self . as_local ( ) . unwrap ( )
1648
1650
}
1649
1651
@@ -1652,7 +1654,7 @@ impl WithOptParam<DefId> {
1652
1654
}
1653
1655
1654
1656
pub fn ty_def_id ( self ) -> DefId {
1655
- self . param_did . unwrap_or ( self . did )
1657
+ self . const_param_did . unwrap_or ( self . did )
1656
1658
}
1657
1659
}
1658
1660
0 commit comments