@@ -1099,7 +1099,7 @@ pub enum PredicateKind<'tcx> {
10991099 Subtype ( PolySubtypePredicate < ' tcx > ) ,
11001100
11011101 /// Constant initializer must evaluate successfully.
1102- ConstEvaluatable ( ty:: WithOptParam < DefId > , SubstsRef < ' tcx > ) ,
1102+ ConstEvaluatable ( ty:: WithOptConstParam < DefId > , SubstsRef < ' tcx > ) ,
11031103
11041104 /// Constants must be equal. The first component is the const that is expected.
11051105 ConstEquate ( & ' tcx Const < ' tcx > , & ' tcx Const < ' tcx > ) ,
@@ -1601,40 +1601,42 @@ pub type PlaceholderConst = Placeholder<BoundVar>;
16011601#[ derive( Copy , Clone , Debug , TypeFoldable , Lift , RustcEncodable , RustcDecodable ) ]
16021602#[ derive( PartialEq , Eq , PartialOrd , Ord ) ]
16031603#[ derive( Hash , HashStable ) ]
1604- pub struct WithOptParam < T > {
1604+ pub struct WithOptConstParam < T > {
16051605 pub did : T ,
16061606 /// The `DefId` of the corresponding generic paramter in case `did` is
16071607 /// a const argument.
16081608 ///
16091609 /// 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)`
16111611 /// to potentially update `param_did` in case it `None`.
1612- pub param_did : Option < DefId > ,
1612+ pub const_param_did : Option < DefId > ,
16131613}
16141614
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 }
16181618 }
16191619}
16201620
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 }
16241624 }
16251625
16261626 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 ( ) }
16281628 }
16291629}
16301630
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 } )
16341636 }
16351637
16361638 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 {
16381640 if let Some ( did) = self . did . as_local ( ) {
16391641 return Some ( ( did, param_did) ) ;
16401642 }
@@ -1643,7 +1645,7 @@ impl WithOptParam<DefId> {
16431645 None
16441646 }
16451647
1646- pub fn expect_local ( self ) -> WithOptParam < LocalDefId > {
1648+ pub fn expect_local ( self ) -> WithOptConstParam < LocalDefId > {
16471649 self . as_local ( ) . unwrap ( )
16481650 }
16491651
@@ -1652,7 +1654,7 @@ impl WithOptParam<DefId> {
16521654 }
16531655
16541656 pub fn ty_def_id ( self ) -> DefId {
1655- self . param_did . unwrap_or ( self . did )
1657+ self . const_param_did . unwrap_or ( self . did )
16561658 }
16571659}
16581660
0 commit comments