Skip to content

Commit f7778d3

Browse files
committed
Use assoc integer constants in librustc_*
1 parent cf8df01 commit f7778d3

File tree

8 files changed

+14
-18
lines changed

8 files changed

+14
-18
lines changed

src/librustc_codegen_ssa/back/write.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1528,7 +1528,7 @@ fn start_executing_work<B: ExtraBackendMethods>(
15281528
}
15291529
}
15301530

1531-
pub const CODEGEN_WORKER_ID: usize = ::std::usize::MAX;
1531+
pub const CODEGEN_WORKER_ID: usize = usize::MAX;
15321532

15331533
/// `FatalError` is explicitly not `Send`.
15341534
#[must_use]

src/librustc_codegen_ssa/base.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ fn get_argc_argv<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
507507
}
508508
}
509509

510-
pub const CODEGEN_WORKER_ID: usize = ::std::usize::MAX;
510+
pub const CODEGEN_WORKER_ID: usize = usize::MAX;
511511

512512
pub fn codegen_crate<B: ExtraBackendMethods>(
513513
backend: B,

src/librustc_errors/emitter.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -1361,7 +1361,7 @@ impl EmitterWriter {
13611361
let mut multilines = FxHashMap::default();
13621362

13631363
// Get the left-side margin to remove it
1364-
let mut whitespace_margin = std::usize::MAX;
1364+
let mut whitespace_margin = usize::MAX;
13651365
for line_idx in 0..annotated_file.lines.len() {
13661366
let file = annotated_file.file.clone();
13671367
let line = &annotated_file.lines[line_idx];
@@ -1373,19 +1373,19 @@ impl EmitterWriter {
13731373
}
13741374
}
13751375
}
1376-
if whitespace_margin == std::usize::MAX {
1376+
if whitespace_margin == usize::MAX {
13771377
whitespace_margin = 0;
13781378
}
13791379

13801380
// Left-most column any visible span points at.
1381-
let mut span_left_margin = std::usize::MAX;
1381+
let mut span_left_margin = usize::MAX;
13821382
for line in &annotated_file.lines {
13831383
for ann in &line.annotations {
13841384
span_left_margin = min(span_left_margin, ann.start_col);
13851385
span_left_margin = min(span_left_margin, ann.end_col);
13861386
}
13871387
}
1388-
if span_left_margin == std::usize::MAX {
1388+
if span_left_margin == usize::MAX {
13891389
span_left_margin = 0;
13901390
}
13911391

@@ -1421,7 +1421,7 @@ impl EmitterWriter {
14211421
} else {
14221422
termize::dimensions()
14231423
.map(|(w, _)| w.saturating_sub(code_offset))
1424-
.unwrap_or(std::usize::MAX)
1424+
.unwrap_or(usize::MAX)
14251425
};
14261426

14271427
let margin = Margin::new(

src/librustc_index/bit_set.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ impl<'a, T: Idx> BitIter<'a, T> {
307307
// additional state about whether we have started.
308308
BitIter {
309309
word: 0,
310-
offset: std::usize::MAX - (WORD_BITS - 1),
310+
offset: usize::MAX - (WORD_BITS - 1),
311311
iter: words.iter(),
312312
marker: PhantomData,
313313
}

src/librustc_trait_selection/traits/object_safety.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,7 @@ fn receiver_is_dispatchable<'tcx>(
616616
// FIXME(mikeyhew) this is a total hack. Once object_safe_for_dispatch is stabilized, we can
617617
// replace this with `dyn Trait`
618618
let unsized_self_ty: Ty<'tcx> =
619-
tcx.mk_ty_param(::std::u32::MAX, Symbol::intern("RustaceansAreAwesome"));
619+
tcx.mk_ty_param(u32::MAX, Symbol::intern("RustaceansAreAwesome"));
620620

621621
// `Receiver[Self => U]`
622622
let unsized_receiver_ty =

src/librustc_trait_selection/traits/select.rs

+2-6
Original file line numberDiff line numberDiff line change
@@ -3625,11 +3625,7 @@ struct ProvisionalEvaluation {
36253625

36263626
impl<'tcx> Default for ProvisionalEvaluationCache<'tcx> {
36273627
fn default() -> Self {
3628-
Self {
3629-
dfn: Cell::new(0),
3630-
reached_depth: Cell::new(std::usize::MAX),
3631-
map: Default::default(),
3632-
}
3628+
Self { dfn: Cell::new(0), reached_depth: Cell::new(usize::MAX), map: Default::default() }
36333629
}
36343630
}
36353631

@@ -3728,7 +3724,7 @@ impl<'tcx> ProvisionalEvaluationCache<'tcx> {
37283724
op(fresh_trait_ref, eval.result);
37293725
}
37303726

3731-
self.reached_depth.set(std::usize::MAX);
3727+
self.reached_depth.set(usize::MAX);
37323728
}
37333729
}
37343730

src/librustc_typeck/collect.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2620,13 +2620,13 @@ fn check_link_ordinal(tcx: TyCtxt<'_>, attr: &ast::Attribute) -> Option<usize> {
26202620
_ => None,
26212621
};
26222622
if let Some(Lit { kind: LitKind::Int(ordinal, LitIntType::Unsuffixed), .. }) = sole_meta_list {
2623-
if *ordinal <= std::usize::MAX as u128 {
2623+
if *ordinal <= usize::MAX as u128 {
26242624
Some(*ordinal as usize)
26252625
} else {
26262626
let msg = format!("ordinal value in `link_ordinal` is too large: `{}`", &ordinal);
26272627
tcx.sess
26282628
.struct_span_err(attr.span, &msg)
2629-
.note("the value may not exceed `std::usize::MAX`")
2629+
.note("the value may not exceed `usize::MAX`")
26302630
.emit();
26312631
None
26322632
}

src/test/ui/rfc-2627-raw-dylib/link-ordinal-too-large.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ error: ordinal value in `link_ordinal` is too large: `18446744073709551616`
1212
LL | #[link_ordinal(18446744073709551616)]
1313
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1414
|
15-
= note: the value may not exceed `std::usize::MAX`
15+
= note: the value may not exceed `usize::MAX`
1616

1717
error: aborting due to previous error
1818

0 commit comments

Comments
 (0)