@@ -43,14 +43,21 @@ pub enum ConstValue<'tcx> {
43
43
end : usize ,
44
44
} ,
45
45
46
- /// An allocation together with a pointer into the allocation.
47
- /// Invariant: the pointer's `AllocId` resolves to the allocation.
48
- /// The alignment exists to allow `const_field` to have `ByRef` access to nonprimitive fields
49
- /// of `repr(packed)` structs. The alignment may be lower than the type of this constant.
50
- /// This permits reads with lower alignment than what the type would normally require.
51
- /// FIXME(RalfJ,oli-obk): The alignment checks are part of miri, but const eval doesn't really
52
- /// need them. Disabling them may be too hard though.
53
- ByRef ( Pointer , Align , & ' tcx Allocation ) ,
46
+ /// A value not represented/representable by `Scalar` or `Slice`
47
+ ByRef {
48
+ /// The alignment exists to allow `const_field` to have `ByRef` access to nonprimitive
49
+ /// fields of `repr(packed)` structs. The alignment may be lower than the type of this
50
+ /// constant. This permits reads with lower alignment than what the type would normally
51
+ /// require.
52
+ /// FIXME(RalfJ,oli-obk): The alignment checks are part of miri, but const eval doesn't
53
+ /// really need them. Disabling them may be too hard though.
54
+ align : Align ,
55
+ /// Offset into `alloc`
56
+ offset : Size ,
57
+ /// The backing memory of the value, may contain more memory than needed for just the value
58
+ /// in order to share `Allocation`s between values
59
+ alloc : & ' tcx Allocation ,
60
+ } ,
54
61
55
62
/// Used in the HIR by using `Unevaluated` everywhere and later normalizing to one of the other
56
63
/// variants when the code is monomorphic enough for that.
@@ -67,7 +74,7 @@ impl<'tcx> ConstValue<'tcx> {
67
74
ConstValue :: Param ( _) |
68
75
ConstValue :: Infer ( _) |
69
76
ConstValue :: Placeholder ( _) |
70
- ConstValue :: ByRef ( .. ) |
77
+ ConstValue :: ByRef { .. } |
71
78
ConstValue :: Unevaluated ( ..) |
72
79
ConstValue :: Slice { .. } => None ,
73
80
ConstValue :: Scalar ( val) => Some ( val) ,
0 commit comments