@@ -9,9 +9,18 @@ use rustc_hir::def_id::DefId;
9
9
use rustc_macros:: HashStable ;
10
10
use rustc_target:: abi:: Size ;
11
11
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
+
12
21
/// 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 ) ]
15
24
pub enum ConstKind < ' tcx > {
16
25
/// A const generic parameter.
17
26
Param ( ty:: ParamConst ) ,
@@ -27,7 +36,7 @@ pub enum ConstKind<'tcx> {
27
36
28
37
/// Used in the HIR by using `Unevaluated` everywhere and later normalizing to one of the other
29
38
/// variants when the code is monomorphic enough for that.
30
- Unevaluated ( ty :: WithOptConstParam < DefId > , SubstsRef < ' tcx > , Option < Promoted > ) ,
39
+ Unevaluated ( Unevaluated < ' tcx > ) ,
31
40
32
41
/// Used to hold computed value.
33
42
Value ( ConstValue < ' tcx > ) ,
@@ -93,7 +102,7 @@ impl<'tcx> ConstKind<'tcx> {
93
102
tcx : TyCtxt < ' tcx > ,
94
103
param_env : ParamEnv < ' tcx > ,
95
104
) -> Option < Result < ConstValue < ' tcx > , ErrorReported > > {
96
- if let ConstKind :: Unevaluated ( def, substs, promoted) = self {
105
+ if let ConstKind :: Unevaluated ( Unevaluated { def, substs, promoted } ) = self {
97
106
use crate :: mir:: interpret:: ErrorHandled ;
98
107
99
108
// HACK(eddyb) this erases lifetimes even though `const_eval_resolve`
0 commit comments