@@ -43,14 +43,21 @@ pub enum ConstValue<'tcx> {
4343 end : usize ,
4444 } ,
4545
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+ } ,
5461
5562 /// Used in the HIR by using `Unevaluated` everywhere and later normalizing to one of the other
5663 /// variants when the code is monomorphic enough for that.
@@ -67,7 +74,7 @@ impl<'tcx> ConstValue<'tcx> {
6774 ConstValue :: Param ( _) |
6875 ConstValue :: Infer ( _) |
6976 ConstValue :: Placeholder ( _) |
70- ConstValue :: ByRef ( .. ) |
77+ ConstValue :: ByRef { .. } |
7178 ConstValue :: Unevaluated ( ..) |
7279 ConstValue :: Slice { .. } => None ,
7380 ConstValue :: Scalar ( val) => Some ( val) ,
0 commit comments