@@ -9,9 +9,18 @@ use rustc_hir::def_id::DefId;
99use rustc_macros:: HashStable ;
1010use rustc_target:: abi:: Size ;
1111
12+ /// An unevaluated, potentially generic, constant.
13+ #[ derive( Copy , Clone , Debug , Eq , PartialEq , PartialOrd , Ord , TyEncodable , TyDecodable ) ]
14+ #[ derive( Hash , HashStable ) ]
15+ pub struct Unevaluated < ' tcx > {
16+ pub def : ty:: WithOptConstParam < DefId > ,
17+ pub substs : SubstsRef < ' tcx > ,
18+ pub promoted : Option < Promoted > ,
19+ }
20+
1221/// Represents a constant in Rust.
13- #[ derive( Copy , Clone , Debug , Eq , PartialEq , PartialOrd , Ord , TyEncodable , TyDecodable , Hash ) ]
14- #[ derive( HashStable ) ]
22+ #[ derive( Copy , Clone , Debug , Eq , PartialEq , PartialOrd , Ord , TyEncodable , TyDecodable ) ]
23+ #[ derive( Hash , HashStable ) ]
1524pub enum ConstKind < ' tcx > {
1625 /// A const generic parameter.
1726 Param ( ty:: ParamConst ) ,
@@ -27,7 +36,7 @@ pub enum ConstKind<'tcx> {
2736
2837 /// Used in the HIR by using `Unevaluated` everywhere and later normalizing to one of the other
2938 /// variants when the code is monomorphic enough for that.
30- Unevaluated ( ty :: WithOptConstParam < DefId > , SubstsRef < ' tcx > , Option < Promoted > ) ,
39+ Unevaluated ( Unevaluated < ' tcx > ) ,
3140
3241 /// Used to hold computed value.
3342 Value ( ConstValue < ' tcx > ) ,
@@ -93,7 +102,7 @@ impl<'tcx> ConstKind<'tcx> {
93102 tcx : TyCtxt < ' tcx > ,
94103 param_env : ParamEnv < ' tcx > ,
95104 ) -> Option < Result < ConstValue < ' tcx > , ErrorReported > > {
96- if let ConstKind :: Unevaluated ( def, substs, promoted) = self {
105+ if let ConstKind :: Unevaluated ( Unevaluated { def, substs, promoted } ) = self {
97106 use crate :: mir:: interpret:: ErrorHandled ;
98107
99108 // HACK(eddyb) this erases lifetimes even though `const_eval_resolve`
0 commit comments