Skip to content

Commit

Permalink
Add more documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
oli-obk committed Jan 7, 2020
1 parent f7f5952 commit 29c372b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/librustc_mir/const_eval/eval_queries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,12 @@ pub(super) fn op_to_const<'tcx>(
ConstValue::ByRef { alloc, offset: ptr.offset }
}
Scalar::Raw { data, .. } => {
assert_eq!(data, mplace.layout.align.abi.bytes().into());
assert_eq!(
data,
mplace.layout.align.abi.bytes().into(),
"this MPlaceTy must come from `try_as_mplace` being used on a zst, so we know what
value this integer address must have",
);
assert!(mplace.layout.is_zst());
ConstValue::Scalar(Scalar::zst())
}
Expand Down
2 changes: 2 additions & 0 deletions src/librustc_mir/interpret/place.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ use super::{
};

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

0 comments on commit 29c372b

Please sign in to comment.