diff --git a/src/librustc_codegen_ssa/back/write.rs b/src/librustc_codegen_ssa/back/write.rs index 35c5812e1f3bf..ca349a7890a58 100644 --- a/src/librustc_codegen_ssa/back/write.rs +++ b/src/librustc_codegen_ssa/back/write.rs @@ -1528,7 +1528,7 @@ fn start_executing_work( } } -pub const CODEGEN_WORKER_ID: usize = ::std::usize::MAX; +pub const CODEGEN_WORKER_ID: usize = usize::MAX; /// `FatalError` is explicitly not `Send`. #[must_use] diff --git a/src/librustc_codegen_ssa/base.rs b/src/librustc_codegen_ssa/base.rs index 0297415155553..8bd4ffd0a565e 100644 --- a/src/librustc_codegen_ssa/base.rs +++ b/src/librustc_codegen_ssa/base.rs @@ -507,7 +507,7 @@ fn get_argc_argv<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( } } -pub const CODEGEN_WORKER_ID: usize = ::std::usize::MAX; +pub const CODEGEN_WORKER_ID: usize = usize::MAX; pub fn codegen_crate( backend: B, diff --git a/src/librustc_errors/emitter.rs b/src/librustc_errors/emitter.rs index 3a7e108ddafa7..3f5738a93a96d 100644 --- a/src/librustc_errors/emitter.rs +++ b/src/librustc_errors/emitter.rs @@ -1361,7 +1361,7 @@ impl EmitterWriter { let mut multilines = FxHashMap::default(); // Get the left-side margin to remove it - let mut whitespace_margin = std::usize::MAX; + let mut whitespace_margin = usize::MAX; for line_idx in 0..annotated_file.lines.len() { let file = annotated_file.file.clone(); let line = &annotated_file.lines[line_idx]; @@ -1373,19 +1373,19 @@ impl EmitterWriter { } } } - if whitespace_margin == std::usize::MAX { + if whitespace_margin == usize::MAX { whitespace_margin = 0; } // Left-most column any visible span points at. - let mut span_left_margin = std::usize::MAX; + let mut span_left_margin = usize::MAX; for line in &annotated_file.lines { for ann in &line.annotations { span_left_margin = min(span_left_margin, ann.start_col); span_left_margin = min(span_left_margin, ann.end_col); } } - if span_left_margin == std::usize::MAX { + if span_left_margin == usize::MAX { span_left_margin = 0; } @@ -1421,7 +1421,7 @@ impl EmitterWriter { } else { termize::dimensions() .map(|(w, _)| w.saturating_sub(code_offset)) - .unwrap_or(std::usize::MAX) + .unwrap_or(usize::MAX) }; let margin = Margin::new( diff --git a/src/librustc_index/bit_set.rs b/src/librustc_index/bit_set.rs index 2a1a56076728e..46c38840516e2 100644 --- a/src/librustc_index/bit_set.rs +++ b/src/librustc_index/bit_set.rs @@ -307,7 +307,7 @@ impl<'a, T: Idx> BitIter<'a, T> { // additional state about whether we have started. BitIter { word: 0, - offset: std::usize::MAX - (WORD_BITS - 1), + offset: usize::MAX - (WORD_BITS - 1), iter: words.iter(), marker: PhantomData, } diff --git a/src/librustc_trait_selection/traits/object_safety.rs b/src/librustc_trait_selection/traits/object_safety.rs index 20b3fa908d201..a4c5ec2f17e66 100644 --- a/src/librustc_trait_selection/traits/object_safety.rs +++ b/src/librustc_trait_selection/traits/object_safety.rs @@ -616,7 +616,7 @@ fn receiver_is_dispatchable<'tcx>( // FIXME(mikeyhew) this is a total hack. Once object_safe_for_dispatch is stabilized, we can // replace this with `dyn Trait` let unsized_self_ty: Ty<'tcx> = - tcx.mk_ty_param(::std::u32::MAX, Symbol::intern("RustaceansAreAwesome")); + tcx.mk_ty_param(u32::MAX, Symbol::intern("RustaceansAreAwesome")); // `Receiver[Self => U]` let unsized_receiver_ty = diff --git a/src/librustc_trait_selection/traits/select.rs b/src/librustc_trait_selection/traits/select.rs index 3d95824cdf00e..827792585e3f4 100644 --- a/src/librustc_trait_selection/traits/select.rs +++ b/src/librustc_trait_selection/traits/select.rs @@ -3625,11 +3625,7 @@ struct ProvisionalEvaluation { impl<'tcx> Default for ProvisionalEvaluationCache<'tcx> { fn default() -> Self { - Self { - dfn: Cell::new(0), - reached_depth: Cell::new(std::usize::MAX), - map: Default::default(), - } + Self { dfn: Cell::new(0), reached_depth: Cell::new(usize::MAX), map: Default::default() } } } @@ -3728,7 +3724,7 @@ impl<'tcx> ProvisionalEvaluationCache<'tcx> { op(fresh_trait_ref, eval.result); } - self.reached_depth.set(std::usize::MAX); + self.reached_depth.set(usize::MAX); } } diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs index 13c6670f6b226..c5e9a288c9ce8 100644 --- a/src/librustc_typeck/collect.rs +++ b/src/librustc_typeck/collect.rs @@ -2620,13 +2620,13 @@ fn check_link_ordinal(tcx: TyCtxt<'_>, attr: &ast::Attribute) -> Option { _ => None, }; if let Some(Lit { kind: LitKind::Int(ordinal, LitIntType::Unsuffixed), .. }) = sole_meta_list { - if *ordinal <= std::usize::MAX as u128 { + if *ordinal <= usize::MAX as u128 { Some(*ordinal as usize) } else { let msg = format!("ordinal value in `link_ordinal` is too large: `{}`", &ordinal); tcx.sess .struct_span_err(attr.span, &msg) - .note("the value may not exceed `std::usize::MAX`") + .note("the value may not exceed `usize::MAX`") .emit(); None } diff --git a/src/test/ui/rfc-2627-raw-dylib/link-ordinal-too-large.stderr b/src/test/ui/rfc-2627-raw-dylib/link-ordinal-too-large.stderr index b3b22f9776df7..b9b877aa0566c 100644 --- a/src/test/ui/rfc-2627-raw-dylib/link-ordinal-too-large.stderr +++ b/src/test/ui/rfc-2627-raw-dylib/link-ordinal-too-large.stderr @@ -12,7 +12,7 @@ error: ordinal value in `link_ordinal` is too large: `18446744073709551616` LL | #[link_ordinal(18446744073709551616)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: the value may not exceed `std::usize::MAX` + = note: the value may not exceed `usize::MAX` error: aborting due to previous error