Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit a417f96

Browse files
Remove null places
1 parent 4eaf535 commit a417f96

File tree

2 files changed

+0
-21
lines changed

2 files changed

+0
-21
lines changed

src/librustc_middle/mir/interpret/value.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -188,11 +188,6 @@ 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-
196191
#[inline]
197192
pub fn zst() -> Self {
198193
Scalar::Raw { data: 0, size: 0 }

src/librustc_mir/interpret/place.rs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -135,12 +135,6 @@ impl<Tag> MemPlace<Tag> {
135135
MemPlace { ptr, align, meta: MemPlaceMeta::None }
136136
}
137137

138-
/// Produces a Place that will error if attempted to be read from or written to
139-
#[inline(always)]
140-
fn null(cx: &impl HasDataLayout) -> Self {
141-
Self::from_scalar_ptr(Scalar::null_ptr(cx), Align::from_bytes(1).unwrap())
142-
}
143-
144138
#[inline(always)]
145139
pub fn from_ptr(ptr: Pointer<Tag>, align: Align) -> Self {
146140
Self::from_scalar_ptr(ptr.into(), align)
@@ -260,12 +254,6 @@ impl<'tcx, Tag: ::std::fmt::Debug + Copy> OpTy<'tcx, Tag> {
260254
}
261255

262256
impl<Tag: ::std::fmt::Debug> Place<Tag> {
263-
/// Produces a Place that will error if attempted to be read from or written to
264-
#[inline(always)]
265-
fn null(cx: &impl HasDataLayout) -> Self {
266-
Place::Ptr(MemPlace::null(cx))
267-
}
268-
269257
#[inline]
270258
pub fn assert_mem_place(self) -> MemPlace<Tag> {
271259
match self {
@@ -276,10 +264,6 @@ impl<Tag: ::std::fmt::Debug> Place<Tag> {
276264
}
277265

278266
impl<'tcx, Tag: ::std::fmt::Debug> PlaceTy<'tcx, Tag> {
279-
pub fn null(cx: &impl HasDataLayout, layout: TyAndLayout<'tcx>) -> Self {
280-
Self { place: Place::null(cx), layout }
281-
}
282-
283267
#[inline]
284268
pub fn assert_mem_place(self) -> MPlaceTy<'tcx, Tag> {
285269
MPlaceTy { mplace: self.place.assert_mem_place(), layout: self.layout }

0 commit comments

Comments
 (0)