]> git.lizzy.rs Git - rust.git/commitdiff
Remove null places
authorJonas Schievink <jonasschievink@gmail.com>
Wed, 15 Apr 2020 23:23:29 +0000 (01:23 +0200)
committerJonas Schievink <jonasschievink@gmail.com>
Mon, 20 Apr 2020 19:18:20 +0000 (21:18 +0200)
src/librustc_middle/mir/interpret/value.rs
src/librustc_mir/interpret/place.rs

index f3c1c87dad484b5aead0f759570aa4a332644ac2..25fa3e5e8e0e350453ae068900801d3cab23047e 100644 (file)
@@ -188,11 +188,6 @@ pub fn erase_tag(self) -> 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 }
index ca7148714ac3a5087fbe94291793dafa270551e1..e961d4fce04c4bd436d06331a4ec1d4c6ae32e44 100644 (file)
@@ -135,12 +135,6 @@ fn from_scalar_ptr(ptr: Scalar<Tag>, align: Align) -> Self {
         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<Tag>, align: Align) -> Self {
         Self::from_scalar_ptr(ptr.into(), align)
@@ -260,12 +254,6 @@ pub fn assert_mem_place(self, cx: &impl HasDataLayout) -> MPlaceTy<'tcx, Tag> {
 }
 
 impl<Tag: ::std::fmt::Debug> Place<Tag> {
-    /// 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<Tag> {
         match self {
@@ -276,10 +264,6 @@ pub fn assert_mem_place(self) -> MemPlace<Tag> {
 }
 
 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 }