Skip to content

Commit 96e2934

Browse files
authored
Rollup merge of #70503 - RalfJung:null, r=varkor
rename Scalar::{ptr_null -> null_ptr} and add "machine_" prefix like elsewhere "NULL pointer" is just much more common terminology than "pointer-null". Also I forgot two methods when renaming all the `Scalar` things to `(to|from)_machine_(u|i)size`.
2 parents a0d6eed + 01dbaed commit 96e2934

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/librustc/mir/interpret/pointer.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@ pub trait PointerArithmetic: layout::HasDataLayout {
4646
}
4747

4848
#[inline]
49-
fn usize_max(&self) -> u64 {
49+
fn machine_usize_max(&self) -> u64 {
5050
let max_usize_plus_1 = 1u128 << self.pointer_size().bits();
5151
u64::try_from(max_usize_plus_1 - 1).unwrap()
5252
}
5353

5454
#[inline]
55-
fn isize_max(&self) -> i64 {
55+
fn machine_isize_max(&self) -> i64 {
5656
let max_isize_plus_1 = 1u128 << (self.pointer_size().bits() - 1);
5757
i64::try_from(max_isize_plus_1 - 1).unwrap()
5858
}

src/librustc/mir/interpret/value.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ impl<'tcx, Tag> Scalar<Tag> {
192192
}
193193

194194
#[inline]
195-
pub fn ptr_null(cx: &impl HasDataLayout) -> Self {
195+
pub fn null_ptr(cx: &impl HasDataLayout) -> Self {
196196
Scalar::Raw { data: 0, size: cx.data_layout().pointer_size.bytes() as u8 }
197197
}
198198

src/librustc_mir/interpret/place.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ impl<Tag> MemPlace<Tag> {
139139
/// Produces a Place that will error if attempted to be read from or written to
140140
#[inline(always)]
141141
fn null(cx: &impl HasDataLayout) -> Self {
142-
Self::from_scalar_ptr(Scalar::ptr_null(cx), Align::from_bytes(1).unwrap())
142+
Self::from_scalar_ptr(Scalar::null_ptr(cx), Align::from_bytes(1).unwrap())
143143
}
144144

145145
#[inline(always)]

0 commit comments

Comments
 (0)