Skip to content

Commit 29c372b

Browse files
committed
Add more documentation
1 parent f7f5952 commit 29c372b

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/librustc_mir/const_eval/eval_queries.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,12 @@ pub(super) fn op_to_const<'tcx>(
124124
ConstValue::ByRef { alloc, offset: ptr.offset }
125125
}
126126
Scalar::Raw { data, .. } => {
127-
assert_eq!(data, mplace.layout.align.abi.bytes().into());
127+
assert_eq!(
128+
data,
129+
mplace.layout.align.abi.bytes().into(),
130+
"this MPlaceTy must come from `try_as_mplace` being used on a zst, so we know what
131+
value this integer address must have",
132+
);
128133
assert!(mplace.layout.is_zst());
129134
ConstValue::Scalar(Scalar::zst())
130135
}

src/librustc_mir/interpret/place.rs

+2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ use super::{
2121
};
2222

2323
#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq, HashStable)]
24+
/// Information required for the sound usage of a `MemPlace`.
2425
pub enum MemPlaceMeta<Tag = (), Id = AllocId> {
26+
/// The unsized payload (e.g. length for slices or vtable pointer for trait objects).
2527
Unsized(Scalar<Tag, Id>),
2628
/// `Sized` types or unsized `extern type`
2729
None,

0 commit comments

Comments
 (0)