Skip to content

Commit 5bb1afc

Browse files
committed
add back Scalar::null_ptr
1 parent 413a129 commit 5bb1afc

File tree

1 file changed

+5
-0
lines changed
  • src/librustc_middle/mir/interpret

1 file changed

+5
-0
lines changed

src/librustc_middle/mir/interpret/value.rs

+5
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,11 @@ impl<'tcx, Tag> Scalar<Tag> {
188188
}
189189
}
190190

191+
#[inline]
192+
pub fn null_ptr(cx: &impl HasDataLayout) -> Self {
193+
Scalar::Raw { data: 0, size: cx.data_layout().pointer_size.bytes() as u8 }
194+
}
195+
191196
#[inline]
192197
pub fn zst() -> Self {
193198
Scalar::Raw { data: 0, size: 0 }

0 commit comments

Comments
 (0)