From a417f963fe58e2f6ba5e93be7fa960afa238720c Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Thu, 16 Apr 2020 01:23:29 +0200 Subject: [PATCH] Remove null places --- src/librustc_middle/mir/interpret/value.rs | 5 ----- src/librustc_mir/interpret/place.rs | 16 ---------------- 2 files changed, 21 deletions(-) diff --git a/src/librustc_middle/mir/interpret/value.rs b/src/librustc_middle/mir/interpret/value.rs index f3c1c87dad48..25fa3e5e8e0e 100644 --- a/src/librustc_middle/mir/interpret/value.rs +++ b/src/librustc_middle/mir/interpret/value.rs @@ -188,11 +188,6 @@ 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 } diff --git a/src/librustc_mir/interpret/place.rs b/src/librustc_mir/interpret/place.rs index ca7148714ac3..e961d4fce04c 100644 --- a/src/librustc_mir/interpret/place.rs +++ b/src/librustc_mir/interpret/place.rs @@ -135,12 +135,6 @@ impl MemPlace { MemPlace { ptr, align, meta: MemPlaceMeta::None } } - /// Produces a Place that will error if attempted to be read from or written to - #[inline(always)] - fn null(cx: &impl HasDataLayout) -> Self { - Self::from_scalar_ptr(Scalar::null_ptr(cx), Align::from_bytes(1).unwrap()) - } - #[inline(always)] pub fn from_ptr(ptr: Pointer, align: Align) -> Self { Self::from_scalar_ptr(ptr.into(), align) @@ -260,12 +254,6 @@ impl<'tcx, Tag: ::std::fmt::Debug + Copy> OpTy<'tcx, Tag> { } impl Place { - /// Produces a Place that will error if attempted to be read from or written to - #[inline(always)] - fn null(cx: &impl HasDataLayout) -> Self { - Place::Ptr(MemPlace::null(cx)) - } - #[inline] pub fn assert_mem_place(self) -> MemPlace { match self { @@ -276,10 +264,6 @@ impl Place { } impl<'tcx, Tag: ::std::fmt::Debug> PlaceTy<'tcx, Tag> { - pub fn null(cx: &impl HasDataLayout, layout: TyAndLayout<'tcx>) -> Self { - Self { place: Place::null(cx), layout } - } - #[inline] pub fn assert_mem_place(self) -> MPlaceTy<'tcx, Tag> { MPlaceTy { mplace: self.place.assert_mem_place(), layout: self.layout }