@@ -2,10 +2,7 @@ use std::fmt;
2
2
use rustc_macros:: HashStable ;
3
3
use rustc_apfloat:: { Float , ieee:: { Double , Single } } ;
4
4
5
- use crate :: ty:: { Ty , InferConst , ParamConst , layout:: { HasDataLayout , Size } , subst:: SubstsRef } ;
6
- use crate :: ty:: PlaceholderConst ;
7
- use crate :: hir:: def_id:: DefId ;
8
- use crate :: ty:: { BoundVar , DebruijnIndex } ;
5
+ use crate :: ty:: { Ty , layout:: { HasDataLayout , Size } } ;
9
6
10
7
use super :: { InterpResult , Pointer , PointerArithmetic , Allocation , AllocId , sign_extend, truncate} ;
11
8
@@ -23,18 +20,6 @@ pub struct RawConst<'tcx> {
23
20
#[ derive( Copy , Clone , Debug , Eq , PartialEq , PartialOrd , Ord ,
24
21
RustcEncodable , RustcDecodable , Hash , HashStable ) ]
25
22
pub enum ConstValue < ' tcx > {
26
- /// A const generic parameter.
27
- Param ( ParamConst ) ,
28
-
29
- /// Infer the value of the const.
30
- Infer ( InferConst < ' tcx > ) ,
31
-
32
- /// Bound const variable, used only when preparing a trait query.
33
- Bound ( DebruijnIndex , BoundVar ) ,
34
-
35
- /// A placeholder const - universally quantified higher-ranked const.
36
- Placeholder ( PlaceholderConst ) ,
37
-
38
23
/// Used only for types with `layout::abi::Scalar` ABI and ZSTs.
39
24
///
40
25
/// Not using the enum `Value` to encode that this must not be `Undef`.
@@ -55,10 +40,6 @@ pub enum ConstValue<'tcx> {
55
40
/// Offset into `alloc`
56
41
offset : Size ,
57
42
} ,
58
-
59
- /// Used in the HIR by using `Unevaluated` everywhere and later normalizing to one of the other
60
- /// variants when the code is monomorphic enough for that.
61
- Unevaluated ( DefId , SubstsRef < ' tcx > ) ,
62
43
}
63
44
64
45
#[ cfg( target_arch = "x86_64" ) ]
@@ -68,26 +49,11 @@ impl<'tcx> ConstValue<'tcx> {
68
49
#[ inline]
69
50
pub fn try_to_scalar ( & self ) -> Option < Scalar > {
70
51
match * self {
71
- ConstValue :: Param ( _) |
72
- ConstValue :: Infer ( _) |
73
- ConstValue :: Bound ( ..) |
74
- ConstValue :: Placeholder ( _) |
75
52
ConstValue :: ByRef { .. } |
76
- ConstValue :: Unevaluated ( ..) |
77
53
ConstValue :: Slice { .. } => None ,
78
54
ConstValue :: Scalar ( val) => Some ( val) ,
79
55
}
80
56
}
81
-
82
- #[ inline]
83
- pub fn try_to_bits ( & self , size : Size ) -> Option < u128 > {
84
- self . try_to_scalar ( ) ?. to_bits ( size) . ok ( )
85
- }
86
-
87
- #[ inline]
88
- pub fn try_to_ptr ( & self ) -> Option < Pointer > {
89
- self . try_to_scalar ( ) ?. to_ptr ( ) . ok ( )
90
- }
91
57
}
92
58
93
59
/// A `Scalar` represents an immediate, primitive value existing outside of a
0 commit comments