Skip to content

Commit dd34e0c

Browse files
committed
Rename (un)signed to (un)signed_int
1 parent 9129f43 commit dd34e0c

File tree

6 files changed

+17
-16
lines changed

6 files changed

+17
-16
lines changed

compiler/rustc_const_eval/src/interpret/intrinsics.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
260260
// unsigned
261261
if is_add {
262262
// max unsigned
263-
Scalar::from_uint(size.unsigned_max(), Size::from_bits(num_bits))
263+
Scalar::from_uint(size.unsigned_int_max(), Size::from_bits(num_bits))
264264
} else {
265265
// underflow to 0
266266
Scalar::from_uint(0u128, Size::from_bits(num_bits))

compiler/rustc_const_eval/src/interpret/validity.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,7 @@ impl<'rt, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> ValidityVisitor<'rt, 'mir, '
627627
// At least one value is excluded.
628628
let valid_range = scalar_layout.valid_range;
629629
let WrappingRange { start, end } = valid_range;
630-
let max_value = op.layout.size.unsigned_max();
630+
let max_value = op.layout.size.unsigned_int_max();
631631
assert!(end <= max_value);
632632
// Determine the allowed range
633633
let value = self.read_scalar(op)?;

compiler/rustc_middle/src/ty/layout.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx>> {
514514
let scalar_unit = |value: Primitive| {
515515
let size = value.size(dl);
516516
assert!(size.bits() <= 128);
517-
Scalar { value, valid_range: WrappingRange { start: 0, end: size.unsigned_max() } }
517+
Scalar { value, valid_range: WrappingRange { start: 0, end: size.unsigned_int_max() } }
518518
};
519519
let scalar = |value: Primitive| tcx.intern_layout(Layout::scalar(self, scalar_unit(value)));
520520

@@ -1266,7 +1266,7 @@ impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx>> {
12661266
}
12671267
}
12681268

1269-
let tag_mask = ity.size().unsigned_max();
1269+
let tag_mask = ity.size().unsigned_int_max();
12701270
let tag = Scalar {
12711271
value: Int(ity, signed),
12721272
valid_range: WrappingRange {

compiler/rustc_middle/src/ty/util.rs

+6-5
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ impl<'tcx> Discr<'tcx> {
6262
pub fn checked_add(self, tcx: TyCtxt<'tcx>, n: u128) -> (Self, bool) {
6363
let (size, signed) = int_size_and_signed(tcx, self.ty);
6464
let (val, oflo) = if signed {
65-
let min = size.signed_min();
66-
let max = size.signed_max();
65+
let min = size.signed_int_min();
66+
let max = size.signed_int_max();
6767
let val = size.sign_extend(self.val) as i128;
6868
assert!(n < (i128::MAX as u128));
6969
let n = n as i128;
@@ -74,7 +74,7 @@ impl<'tcx> Discr<'tcx> {
7474
let val = size.truncate(val);
7575
(val, oflo)
7676
} else {
77-
let max = size.unsigned_max();
77+
let max = size.unsigned_int_max();
7878
let val = self.val;
7979
let oflo = val > max - n;
8080
let val = if oflo { n - (max - val) - 1 } else { val + n };
@@ -609,7 +609,8 @@ impl<'tcx> ty::TyS<'tcx> {
609609
let val = match self.kind() {
610610
ty::Int(_) | ty::Uint(_) => {
611611
let (size, signed) = int_size_and_signed(tcx, self);
612-
let val = if signed { size.signed_max() as u128 } else { size.unsigned_max() };
612+
let val =
613+
if signed { size.signed_int_max() as u128 } else { size.unsigned_int_max() };
613614
Some(val)
614615
}
615616
ty::Char => Some(std::char::MAX as u128),
@@ -628,7 +629,7 @@ impl<'tcx> ty::TyS<'tcx> {
628629
let val = match self.kind() {
629630
ty::Int(_) | ty::Uint(_) => {
630631
let (size, signed) = int_size_and_signed(tcx, self);
631-
let val = if signed { size.truncate(size.signed_min() as u128) } else { 0 };
632+
let val = if signed { size.truncate(size.signed_int_min() as u128) } else { 0 };
632633
Some(val)
633634
}
634635
ty::Char => Some(0),

compiler/rustc_mir_build/src/build/expr/as_rvalue.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
495495
fn neg_1_literal(&mut self, span: Span, ty: Ty<'tcx>) -> Operand<'tcx> {
496496
let param_ty = ty::ParamEnv::empty().and(ty);
497497
let size = self.tcx.layout_of(param_ty).unwrap().size;
498-
let literal = ty::Const::from_bits(self.tcx, size.unsigned_max(), param_ty);
498+
let literal = ty::Const::from_bits(self.tcx, size.unsigned_int_max(), param_ty);
499499

500500
self.literal_operand(span, literal)
501501
}

compiler/rustc_target/src/abi/mod.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -394,17 +394,17 @@ impl Size {
394394
}
395395

396396
#[inline]
397-
pub fn signed_min(&self) -> i128 {
397+
pub fn signed_int_min(&self) -> i128 {
398398
self.sign_extend(1_u128 << (self.bits() - 1)) as i128
399399
}
400400

401401
#[inline]
402-
pub fn signed_max(&self) -> i128 {
402+
pub fn signed_int_max(&self) -> i128 {
403403
i128::MAX >> (128 - self.bits())
404404
}
405405

406406
#[inline]
407-
pub fn unsigned_max(&self) -> u128 {
407+
pub fn unsigned_int_max(&self) -> u128 {
408408
u128::MAX >> (128 - self.bits())
409409
}
410410
}
@@ -790,7 +790,7 @@ impl WrappingRange {
790790
/// Returns `true` if `size` completely fills the range.
791791
#[inline]
792792
pub fn is_full_for(&self, size: Size) -> bool {
793-
let max_value = size.unsigned_max();
793+
let max_value = size.unsigned_int_max();
794794
debug_assert!(self.start <= max_value && self.end <= max_value);
795795
(self.start == 0 && self.end == max_value) || (self.end + 1 == self.start)
796796
}
@@ -1084,7 +1084,7 @@ impl Niche {
10841084
let Scalar { value, valid_range: v } = self.scalar;
10851085
let size = value.size(cx);
10861086
assert!(size.bits() <= 128);
1087-
let max_value = size.unsigned_max();
1087+
let max_value = size.unsigned_int_max();
10881088

10891089
// Find out how many values are outside the valid range.
10901090
let niche = v.end.wrapping_add(1)..v.start;
@@ -1097,7 +1097,7 @@ impl Niche {
10971097
let Scalar { value, valid_range: v } = self.scalar;
10981098
let size = value.size(cx);
10991099
assert!(size.bits() <= 128);
1100-
let max_value = size.unsigned_max();
1100+
let max_value = size.unsigned_int_max();
11011101

11021102
if count > max_value {
11031103
return None;

0 commit comments

Comments
 (0)