Skip to content

Commit b107eb5

Browse files
authored
Rollup merge of rust-lang#71479 - RalfJung:scalar-null-ptr, r=jonas-schievink
add back Scalar::null_ptr We were a bit overeager with removing this in rust-lang#71005, Miri uses this function quite a bit. The important part is that the `Place::null` methods are gone. :) r? @jonas-schievink @oli-obk Fixes rust-lang#71474
2 parents 5f9ffb9 + 5bb1afc commit b107eb5

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)