From 5bb1afc7e701594d655e3f7271adb87624b0b2ae Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Thu, 23 Apr 2020 20:13:53 +0200 Subject: [PATCH] add back Scalar::null_ptr --- src/librustc_middle/mir/interpret/value.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/librustc_middle/mir/interpret/value.rs b/src/librustc_middle/mir/interpret/value.rs index 25fa3e5e8e0e3..f3c1c87dad484 100644 --- a/src/librustc_middle/mir/interpret/value.rs +++ b/src/librustc_middle/mir/interpret/value.rs @@ -188,6 +188,11 @@ impl<'tcx, Tag> Scalar { } } + #[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 }