Skip to content

Commit

Permalink
add back Scalar::null_ptr
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Apr 23, 2020
1 parent 413a129 commit 5bb1afc
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/librustc_middle/mir/interpret/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,11 @@ impl<'tcx, Tag> Scalar<Tag> {
}
}

#[inline]
pub fn null_ptr(cx: &impl HasDataLayout) -> Self {
Scalar::Raw { data: 0, size: cx.data_layout().pointer_size.bytes() as u8 }
}

#[inline]
pub fn zst() -> Self {
Scalar::Raw { data: 0, size: 0 }
Expand Down

0 comments on commit 5bb1afc

Please sign in to comment.