Skip to content

Commit f0c3cf2

Browse files
committed
cover some more nearby cases
1 parent 6db7e34 commit f0c3cf2

File tree

6 files changed

+8
-10
lines changed

6 files changed

+8
-10
lines changed

src/librustc/dep_graph/graph.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ impl DepGraph {
524524
edge_list_indices.push((start, end));
525525
}
526526

527-
debug_assert!(edge_list_data.len() <= ::std::u32::MAX as usize);
527+
debug_assert!(edge_list_data.len() <= u32::MAX as usize);
528528
debug_assert_eq!(edge_list_data.len(), total_edge_count);
529529

530530
SerializedDepGraph { nodes, fingerprints, edge_list_indices, edge_list_data }

src/librustc/ty/layout.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ use rustc_span::DUMMY_SP;
77

88
use std::cmp;
99
use std::fmt;
10-
use std::i128;
1110
use std::iter;
1211
use std::mem;
1312
use std::ops::Bound;
@@ -1001,7 +1000,7 @@ impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx>> {
10011000
}
10021001
}
10031002

1004-
let (mut min, mut max) = (i128::max_value(), i128::min_value());
1003+
let (mut min, mut max) = (i128::MAX, i128::MIN);
10051004
let discr_type = def.repr.discr_type();
10061005
let bits = Integer::from_attr(self, discr_type).size().bits();
10071006
for (i, discr) in def.discriminants(tcx) {
@@ -1021,7 +1020,7 @@ impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx>> {
10211020
}
10221021
}
10231022
// We might have no inhabited variants, so pretend there's at least one.
1024-
if (min, max) == (i128::max_value(), i128::min_value()) {
1023+
if (min, max) == (i128::MAX, i128::MIN) {
10251024
min = 0;
10261025
max = 0;
10271026
}

src/librustc/ty/print/pretty.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -920,7 +920,7 @@ pub trait PrettyPrinter<'tcx>:
920920
}
921921
(ConstValue::Scalar(Scalar::Raw { data, .. }), ty::Uint(ui)) => {
922922
let bit_size = Integer::from_attr(&self.tcx(), UnsignedInt(*ui)).size();
923-
let max = truncate(u128::max_value(), bit_size);
923+
let max = truncate(u128::MAX, bit_size);
924924

925925
let ui_str = ui.name_str();
926926
if data == max {

src/librustc/ty/query/on_disk_cache.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ struct AbsoluteBytePos(u32);
9292

9393
impl AbsoluteBytePos {
9494
fn new(pos: usize) -> AbsoluteBytePos {
95-
debug_assert!(pos <= ::std::u32::MAX as usize);
95+
debug_assert!(pos <= u32::MAX as usize);
9696
AbsoluteBytePos(pos as u32)
9797
}
9898

src/librustc/ty/util.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ fn signed_min(size: Size) -> i128 {
5050
}
5151

5252
fn signed_max(size: Size) -> i128 {
53-
i128::max_value() >> (128 - size.bits())
53+
i128::MAX >> (128 - size.bits())
5454
}
5555

5656
fn unsigned_max(size: Size) -> u128 {
57-
u128::max_value() >> (128 - size.bits())
57+
u128::MAX >> (128 - size.bits())
5858
}
5959

6060
fn int_size_and_signed<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> (Size, bool) {
@@ -77,7 +77,7 @@ impl<'tcx> Discr<'tcx> {
7777
let min = signed_min(size);
7878
let max = signed_max(size);
7979
let val = sign_extend(self.val, size) as i128;
80-
assert!(n < (i128::max_value() as u128));
80+
assert!(n < (i128::MAX as u128));
8181
let n = n as i128;
8282
let oflo = val > max - n;
8383
let val = if oflo { min + (n - (max - val) - 1) } else { val + n };

src/librustc_mir/dataflow/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ use std::borrow::Borrow;
1616
use std::fmt;
1717
use std::io;
1818
use std::path::PathBuf;
19-
use std::usize;
2019

2120
pub use self::at_location::{FlowAtLocation, FlowsAtLocation};
2221
pub(crate) use self::drop_flag_effects::*;

0 commit comments

Comments
 (0)