Rollup merge of #70857 - faern:use-assoc-int-float-consts, r=dtolnay
Don't import integer and float modules, use assoc consts 2 Follow up to #70777. I missed quite a lot of places. Partially because I wanted to keep the size of the last PR down, and partially because my regexes were not good enough :) r? @dtolnay
This commit is contained in:
commit
89d661f15d
|
@ -608,7 +608,7 @@ unsafe impl<#[may_dangle] T, A: AllocRef> Drop for RawVec<T, A> {
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn alloc_guard(alloc_size: usize) -> Result<(), TryReserveError> {
|
fn alloc_guard(alloc_size: usize) -> Result<(), TryReserveError> {
|
||||||
if mem::size_of::<usize>() < 8 && alloc_size > core::isize::MAX as usize {
|
if mem::size_of::<usize>() < 8 && alloc_size > isize::MAX as usize {
|
||||||
Err(CapacityOverflow)
|
Err(CapacityOverflow)
|
||||||
} else {
|
} else {
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
|
@ -50,7 +50,7 @@ fn trait_object() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn float_nan_ne() {
|
fn float_nan_ne() {
|
||||||
let x = Arc::new(std::f32::NAN);
|
let x = Arc::new(f32::NAN);
|
||||||
assert!(x != x);
|
assert!(x != x);
|
||||||
assert!(!(x == x));
|
assert!(!(x == x));
|
||||||
}
|
}
|
||||||
|
|
|
@ -475,7 +475,7 @@ fn test_range_large() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_range_inclusive_max_value() {
|
fn test_range_inclusive_max_value() {
|
||||||
let max = std::usize::MAX;
|
let max = usize::MAX;
|
||||||
let map: BTreeMap<_, _> = vec![(max, 0)].into_iter().collect();
|
let map: BTreeMap<_, _> = vec![(max, 0)].into_iter().collect();
|
||||||
|
|
||||||
assert_eq!(map.range(max..=max).collect::<Vec<_>>(), &[(&max, &0)]);
|
assert_eq!(map.range(max..=max).collect::<Vec<_>>(), &[(&max, &0)]);
|
||||||
|
|
|
@ -50,7 +50,7 @@ fn trait_object() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn float_nan_ne() {
|
fn float_nan_ne() {
|
||||||
let x = Rc::new(std::f32::NAN);
|
let x = Rc::new(f32::NAN);
|
||||||
assert!(x != x);
|
assert!(x != x);
|
||||||
assert!(!(x == x));
|
assert!(!(x == x));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
use std::f64;
|
|
||||||
use test::Bencher;
|
use test::Bencher;
|
||||||
|
|
||||||
#[bench]
|
#[bench]
|
||||||
|
|
|
@ -5,7 +5,6 @@ mod strategy {
|
||||||
|
|
||||||
use core::num::flt2dec::MAX_SIG_DIGITS;
|
use core::num::flt2dec::MAX_SIG_DIGITS;
|
||||||
use core::num::flt2dec::{decode, DecodableFloat, Decoded, FullDecoded};
|
use core::num::flt2dec::{decode, DecodableFloat, Decoded, FullDecoded};
|
||||||
use std::f64;
|
|
||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
use std::vec::Vec;
|
use std::vec::Vec;
|
||||||
use test::Bencher;
|
use test::Bencher;
|
||||||
|
|
|
@ -76,7 +76,6 @@ fn test_cmp_by() {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_partial_cmp_by() {
|
fn test_partial_cmp_by() {
|
||||||
use core::cmp::Ordering;
|
use core::cmp::Ordering;
|
||||||
use core::f64;
|
|
||||||
|
|
||||||
let f = |x: i32, y: i32| (x * x).partial_cmp(&y);
|
let f = |x: i32, y: i32| (x * x).partial_cmp(&y);
|
||||||
let xs = || [1, 2, 3, 4].iter().copied();
|
let xs = || [1, 2, 3, 4].iter().copied();
|
||||||
|
@ -2894,7 +2893,7 @@ fn test_is_sorted() {
|
||||||
assert!(![1, 3, 2].iter().is_sorted());
|
assert!(![1, 3, 2].iter().is_sorted());
|
||||||
assert!([0].iter().is_sorted());
|
assert!([0].iter().is_sorted());
|
||||||
assert!(std::iter::empty::<i32>().is_sorted());
|
assert!(std::iter::empty::<i32>().is_sorted());
|
||||||
assert!(![0.0, 1.0, std::f32::NAN].iter().is_sorted());
|
assert!(![0.0, 1.0, f32::NAN].iter().is_sorted());
|
||||||
assert!([-2, -1, 0, 3].iter().is_sorted());
|
assert!([-2, -1, 0, 3].iter().is_sorted());
|
||||||
assert!(![-2i32, -1, 0, 3].iter().is_sorted_by_key(|n| n.abs()));
|
assert!(![-2i32, -1, 0, 3].iter().is_sorted_by_key(|n| n.abs()));
|
||||||
assert!(!["c", "bb", "aaa"].iter().is_sorted());
|
assert!(!["c", "bb", "aaa"].iter().is_sorted());
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
use core::num::dec2flt::rawfp::RawFloat;
|
use core::num::dec2flt::rawfp::RawFloat;
|
||||||
use core::num::dec2flt::rawfp::{fp_to_float, next_float, prev_float, round_normal};
|
use core::num::dec2flt::rawfp::{fp_to_float, next_float, prev_float, round_normal};
|
||||||
use core::num::diy_float::Fp;
|
use core::num::diy_float::Fp;
|
||||||
use std::f32;
|
|
||||||
use std::f64;
|
|
||||||
|
|
||||||
fn integer_decode(f: f64) -> (u64, i16, i8) {
|
fn integer_decode(f: f64) -> (u64, i16, i8) {
|
||||||
RawFloat::integer_decode(f)
|
RawFloat::integer_decode(f)
|
||||||
|
|
|
@ -205,8 +205,6 @@ test_impl_from! { test_u32f64, u32, f64 }
|
||||||
// Float -> Float
|
// Float -> Float
|
||||||
#[test]
|
#[test]
|
||||||
fn test_f32f64() {
|
fn test_f32f64() {
|
||||||
use core::f32;
|
|
||||||
|
|
||||||
let max: f64 = f32::MAX.into();
|
let max: f64 = f32::MAX.into();
|
||||||
assert_eq!(max as f32, f32::MAX);
|
assert_eq!(max as f32, f32::MAX);
|
||||||
assert!(max.is_normal());
|
assert!(max.is_normal());
|
||||||
|
@ -704,5 +702,5 @@ macro_rules! test_float {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
test_float!(f32, f32, ::core::f32::INFINITY, ::core::f32::NEG_INFINITY, ::core::f32::NAN);
|
test_float!(f32, f32, f32::INFINITY, f32::NEG_INFINITY, f32::NAN);
|
||||||
test_float!(f64, f64, ::core::f64::INFINITY, ::core::f64::NEG_INFINITY, ::core::f64::NAN);
|
test_float!(f64, f64, f64::INFINITY, f64::NEG_INFINITY, f64::NAN);
|
||||||
|
|
|
@ -61,25 +61,23 @@ fn test_range_inclusive() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_range_is_empty() {
|
fn test_range_is_empty() {
|
||||||
use core::f32::*;
|
|
||||||
|
|
||||||
assert!(!(0.0..10.0).is_empty());
|
assert!(!(0.0..10.0).is_empty());
|
||||||
assert!((-0.0..0.0).is_empty());
|
assert!((-0.0..0.0).is_empty());
|
||||||
assert!((10.0..0.0).is_empty());
|
assert!((10.0..0.0).is_empty());
|
||||||
|
|
||||||
assert!(!(NEG_INFINITY..INFINITY).is_empty());
|
assert!(!(f32::NEG_INFINITY..f32::INFINITY).is_empty());
|
||||||
assert!((EPSILON..NAN).is_empty());
|
assert!((f32::EPSILON..f32::NAN).is_empty());
|
||||||
assert!((NAN..EPSILON).is_empty());
|
assert!((f32::NAN..f32::EPSILON).is_empty());
|
||||||
assert!((NAN..NAN).is_empty());
|
assert!((f32::NAN..f32::NAN).is_empty());
|
||||||
|
|
||||||
assert!(!(0.0..=10.0).is_empty());
|
assert!(!(0.0..=10.0).is_empty());
|
||||||
assert!(!(-0.0..=0.0).is_empty());
|
assert!(!(-0.0..=0.0).is_empty());
|
||||||
assert!((10.0..=0.0).is_empty());
|
assert!((10.0..=0.0).is_empty());
|
||||||
|
|
||||||
assert!(!(NEG_INFINITY..=INFINITY).is_empty());
|
assert!(!(f32::NEG_INFINITY..=f32::INFINITY).is_empty());
|
||||||
assert!((EPSILON..=NAN).is_empty());
|
assert!((f32::EPSILON..=f32::NAN).is_empty());
|
||||||
assert!((NAN..=EPSILON).is_empty());
|
assert!((f32::NAN..=f32::EPSILON).is_empty());
|
||||||
assert!((NAN..=NAN).is_empty());
|
assert!((f32::NAN..=f32::NAN).is_empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
@ -1108,14 +1108,14 @@ mod slice_index {
|
||||||
|
|
||||||
// note: using 0 specifically ensures that the result of overflowing is 0..0,
|
// note: using 0 specifically ensures that the result of overflowing is 0..0,
|
||||||
// so that `get` doesn't simply return None for the wrong reason.
|
// so that `get` doesn't simply return None for the wrong reason.
|
||||||
bad: data[0 ..= ::std::usize::MAX];
|
bad: data[0 ..= usize::MAX];
|
||||||
message: "maximum usize";
|
message: "maximum usize";
|
||||||
}
|
}
|
||||||
|
|
||||||
in mod rangetoinclusive_overflow {
|
in mod rangetoinclusive_overflow {
|
||||||
data: [0, 1];
|
data: [0, 1];
|
||||||
|
|
||||||
bad: data[..= ::std::usize::MAX];
|
bad: data[..= usize::MAX];
|
||||||
message: "maximum usize";
|
message: "maximum usize";
|
||||||
}
|
}
|
||||||
} // panic_cases!
|
} // panic_cases!
|
||||||
|
@ -1709,7 +1709,7 @@ fn test_is_sorted() {
|
||||||
assert!(![1, 3, 2].is_sorted());
|
assert!(![1, 3, 2].is_sorted());
|
||||||
assert!([0].is_sorted());
|
assert!([0].is_sorted());
|
||||||
assert!(empty.is_sorted());
|
assert!(empty.is_sorted());
|
||||||
assert!(![0.0, 1.0, std::f32::NAN].is_sorted());
|
assert!(![0.0, 1.0, f32::NAN].is_sorted());
|
||||||
assert!([-2, -1, 0, 3].is_sorted());
|
assert!([-2, -1, 0, 3].is_sorted());
|
||||||
assert!(![-2i32, -1, 0, 3].is_sorted_by_key(|n| n.abs()));
|
assert!(![-2i32, -1, 0, 3].is_sorted_by_key(|n| n.abs()));
|
||||||
assert!(!["c", "bb", "aaa"].is_sorted());
|
assert!(!["c", "bb", "aaa"].is_sorted());
|
||||||
|
|
|
@ -14,7 +14,7 @@ fn creation() {
|
||||||
#[test]
|
#[test]
|
||||||
#[should_panic]
|
#[should_panic]
|
||||||
fn new_overflow() {
|
fn new_overflow() {
|
||||||
let _ = Duration::new(::core::u64::MAX, 1_000_000_000);
|
let _ = Duration::new(u64::MAX, 1_000_000_000);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -86,7 +86,7 @@ fn checked_add() {
|
||||||
Duration::new(0, 500_000_000).checked_add(Duration::new(0, 500_000_001)),
|
Duration::new(0, 500_000_000).checked_add(Duration::new(0, 500_000_001)),
|
||||||
Some(Duration::new(1, 1))
|
Some(Duration::new(1, 1))
|
||||||
);
|
);
|
||||||
assert_eq!(Duration::new(1, 0).checked_add(Duration::new(::core::u64::MAX, 0)), None);
|
assert_eq!(Duration::new(1, 0).checked_add(Duration::new(u64::MAX, 0)), None);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -133,7 +133,7 @@ fn checked_mul() {
|
||||||
assert_eq!(Duration::new(1, 1).checked_mul(3), Some(Duration::new(3, 3)));
|
assert_eq!(Duration::new(1, 1).checked_mul(3), Some(Duration::new(3, 3)));
|
||||||
assert_eq!(Duration::new(0, 500_000_001).checked_mul(4), Some(Duration::new(2, 4)));
|
assert_eq!(Duration::new(0, 500_000_001).checked_mul(4), Some(Duration::new(2, 4)));
|
||||||
assert_eq!(Duration::new(0, 500_000_001).checked_mul(4000), Some(Duration::new(2000, 4000)));
|
assert_eq!(Duration::new(0, 500_000_001).checked_mul(4000), Some(Duration::new(2000, 4000)));
|
||||||
assert_eq!(Duration::new(::core::u64::MAX - 1, 0).checked_mul(2), None);
|
assert_eq!(Duration::new(u64::MAX - 1, 0).checked_mul(2), None);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
use std::cmp::Ordering::{Equal, Greater, Less};
|
use std::cmp::Ordering::{Equal, Greater, Less};
|
||||||
use std::f64::NAN;
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_clone() {
|
fn test_clone() {
|
||||||
|
@ -34,12 +33,12 @@ fn test_partial_ord() {
|
||||||
assert!(big >= small);
|
assert!(big >= small);
|
||||||
assert!(big >= big);
|
assert!(big >= big);
|
||||||
|
|
||||||
assert!(!((1.0f64, 2.0f64) < (NAN, 3.0)));
|
assert!(!((1.0f64, 2.0f64) < (f64::NAN, 3.0)));
|
||||||
assert!(!((1.0f64, 2.0f64) <= (NAN, 3.0)));
|
assert!(!((1.0f64, 2.0f64) <= (f64::NAN, 3.0)));
|
||||||
assert!(!((1.0f64, 2.0f64) > (NAN, 3.0)));
|
assert!(!((1.0f64, 2.0f64) > (f64::NAN, 3.0)));
|
||||||
assert!(!((1.0f64, 2.0f64) >= (NAN, 3.0)));
|
assert!(!((1.0f64, 2.0f64) >= (f64::NAN, 3.0)));
|
||||||
assert!(((1.0f64, 2.0f64) < (2.0, NAN)));
|
assert!(((1.0f64, 2.0f64) < (2.0, f64::NAN)));
|
||||||
assert!(!((2.0f64, 2.0f64) < (2.0, NAN)));
|
assert!(!((2.0f64, 2.0f64) < (2.0, f64::NAN)));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
@ -1528,7 +1528,7 @@ fn start_executing_work<B: ExtraBackendMethods>(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const CODEGEN_WORKER_ID: usize = ::std::usize::MAX;
|
pub const CODEGEN_WORKER_ID: usize = usize::MAX;
|
||||||
|
|
||||||
/// `FatalError` is explicitly not `Send`.
|
/// `FatalError` is explicitly not `Send`.
|
||||||
#[must_use]
|
#[must_use]
|
||||||
|
|
|
@ -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<B: ExtraBackendMethods>(
|
pub fn codegen_crate<B: ExtraBackendMethods>(
|
||||||
backend: B,
|
backend: B,
|
||||||
|
|
|
@ -1361,7 +1361,7 @@ impl EmitterWriter {
|
||||||
let mut multilines = FxHashMap::default();
|
let mut multilines = FxHashMap::default();
|
||||||
|
|
||||||
// Get the left-side margin to remove it
|
// 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() {
|
for line_idx in 0..annotated_file.lines.len() {
|
||||||
let file = annotated_file.file.clone();
|
let file = annotated_file.file.clone();
|
||||||
let line = &annotated_file.lines[line_idx];
|
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;
|
whitespace_margin = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Left-most column any visible span points at.
|
// 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 line in &annotated_file.lines {
|
||||||
for ann in &line.annotations {
|
for ann in &line.annotations {
|
||||||
span_left_margin = min(span_left_margin, ann.start_col);
|
span_left_margin = min(span_left_margin, ann.start_col);
|
||||||
span_left_margin = min(span_left_margin, ann.end_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;
|
span_left_margin = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1421,7 +1421,7 @@ impl EmitterWriter {
|
||||||
} else {
|
} else {
|
||||||
termize::dimensions()
|
termize::dimensions()
|
||||||
.map(|(w, _)| w.saturating_sub(code_offset))
|
.map(|(w, _)| w.saturating_sub(code_offset))
|
||||||
.unwrap_or(std::usize::MAX)
|
.unwrap_or(usize::MAX)
|
||||||
};
|
};
|
||||||
|
|
||||||
let margin = Margin::new(
|
let margin = Margin::new(
|
||||||
|
|
|
@ -307,7 +307,7 @@ impl<'a, T: Idx> BitIter<'a, T> {
|
||||||
// additional state about whether we have started.
|
// additional state about whether we have started.
|
||||||
BitIter {
|
BitIter {
|
||||||
word: 0,
|
word: 0,
|
||||||
offset: std::usize::MAX - (WORD_BITS - 1),
|
offset: usize::MAX - (WORD_BITS - 1),
|
||||||
iter: words.iter(),
|
iter: words.iter(),
|
||||||
marker: PhantomData,
|
marker: PhantomData,
|
||||||
}
|
}
|
||||||
|
|
|
@ -612,7 +612,7 @@ fn receiver_is_dispatchable<'tcx>(
|
||||||
// FIXME(mikeyhew) this is a total hack. Once object_safe_for_dispatch is stabilized, we can
|
// FIXME(mikeyhew) this is a total hack. Once object_safe_for_dispatch is stabilized, we can
|
||||||
// replace this with `dyn Trait`
|
// replace this with `dyn Trait`
|
||||||
let unsized_self_ty: Ty<'tcx> =
|
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]`
|
// `Receiver[Self => U]`
|
||||||
let unsized_receiver_ty =
|
let unsized_receiver_ty =
|
||||||
|
|
|
@ -3650,11 +3650,7 @@ struct ProvisionalEvaluation {
|
||||||
|
|
||||||
impl<'tcx> Default for ProvisionalEvaluationCache<'tcx> {
|
impl<'tcx> Default for ProvisionalEvaluationCache<'tcx> {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self {
|
Self { dfn: Cell::new(0), reached_depth: Cell::new(usize::MAX), map: Default::default() }
|
||||||
dfn: Cell::new(0),
|
|
||||||
reached_depth: Cell::new(std::usize::MAX),
|
|
||||||
map: Default::default(),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3753,7 +3749,7 @@ impl<'tcx> ProvisionalEvaluationCache<'tcx> {
|
||||||
op(fresh_trait_ref, eval.result);
|
op(fresh_trait_ref, eval.result);
|
||||||
}
|
}
|
||||||
|
|
||||||
self.reached_depth.set(std::usize::MAX);
|
self.reached_depth.set(usize::MAX);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2620,13 +2620,13 @@ fn check_link_ordinal(tcx: TyCtxt<'_>, attr: &ast::Attribute) -> Option<usize> {
|
||||||
_ => None,
|
_ => None,
|
||||||
};
|
};
|
||||||
if let Some(Lit { kind: LitKind::Int(ordinal, LitIntType::Unsuffixed), .. }) = sole_meta_list {
|
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)
|
Some(*ordinal as usize)
|
||||||
} else {
|
} else {
|
||||||
let msg = format!("ordinal value in `link_ordinal` is too large: `{}`", &ordinal);
|
let msg = format!("ordinal value in `link_ordinal` is too large: `{}`", &ordinal);
|
||||||
tcx.sess
|
tcx.sess
|
||||||
.struct_span_err(attr.span, &msg)
|
.struct_span_err(attr.span, &msg)
|
||||||
.note("the value may not exceed `std::usize::MAX`")
|
.note("the value may not exceed `usize::MAX`")
|
||||||
.emit();
|
.emit();
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
|
@ -198,7 +198,7 @@ use std::num::FpCategory as Fp;
|
||||||
use std::ops::Index;
|
use std::ops::Index;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
use std::string;
|
use std::string;
|
||||||
use std::{char, f64, fmt, str};
|
use std::{char, fmt, str};
|
||||||
|
|
||||||
use crate::Encodable;
|
use crate::Encodable;
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ fn test_unit() {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_u8() {
|
fn test_u8() {
|
||||||
let mut vec = vec![];
|
let mut vec = vec![];
|
||||||
for i in ::std::u8::MIN..::std::u8::MAX {
|
for i in u8::MIN..u8::MAX {
|
||||||
vec.push(i);
|
vec.push(i);
|
||||||
}
|
}
|
||||||
check_round_trip(vec);
|
check_round_trip(vec);
|
||||||
|
@ -61,30 +61,30 @@ fn test_u8() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_u16() {
|
fn test_u16() {
|
||||||
for i in ::std::u16::MIN..::std::u16::MAX {
|
for i in u16::MIN..u16::MAX {
|
||||||
check_round_trip(vec![1, 2, 3, i, i, i]);
|
check_round_trip(vec![1, 2, 3, i, i, i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_u32() {
|
fn test_u32() {
|
||||||
check_round_trip(vec![1, 2, 3, ::std::u32::MIN, 0, 1, ::std::u32::MAX, 2, 1]);
|
check_round_trip(vec![1, 2, 3, u32::MIN, 0, 1, u32::MAX, 2, 1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_u64() {
|
fn test_u64() {
|
||||||
check_round_trip(vec![1, 2, 3, ::std::u64::MIN, 0, 1, ::std::u64::MAX, 2, 1]);
|
check_round_trip(vec![1, 2, 3, u64::MIN, 0, 1, u64::MAX, 2, 1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_usize() {
|
fn test_usize() {
|
||||||
check_round_trip(vec![1, 2, 3, ::std::usize::MIN, 0, 1, ::std::usize::MAX, 2, 1]);
|
check_round_trip(vec![1, 2, 3, usize::MIN, 0, 1, usize::MAX, 2, 1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_i8() {
|
fn test_i8() {
|
||||||
let mut vec = vec![];
|
let mut vec = vec![];
|
||||||
for i in ::std::i8::MIN..::std::i8::MAX {
|
for i in i8::MIN..i8::MAX {
|
||||||
vec.push(i);
|
vec.push(i);
|
||||||
}
|
}
|
||||||
check_round_trip(vec);
|
check_round_trip(vec);
|
||||||
|
@ -92,24 +92,24 @@ fn test_i8() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_i16() {
|
fn test_i16() {
|
||||||
for i in ::std::i16::MIN..::std::i16::MAX {
|
for i in i16::MIN..i16::MAX {
|
||||||
check_round_trip(vec![-1, 2, -3, i, i, i, 2]);
|
check_round_trip(vec![-1, 2, -3, i, i, i, 2]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_i32() {
|
fn test_i32() {
|
||||||
check_round_trip(vec![-1, 2, -3, ::std::i32::MIN, 0, 1, ::std::i32::MAX, 2, 1]);
|
check_round_trip(vec![-1, 2, -3, i32::MIN, 0, 1, i32::MAX, 2, 1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_i64() {
|
fn test_i64() {
|
||||||
check_round_trip(vec![-1, 2, -3, ::std::i64::MIN, 0, 1, ::std::i64::MAX, 2, 1]);
|
check_round_trip(vec![-1, 2, -3, i64::MIN, 0, 1, i64::MAX, 2, 1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_isize() {
|
fn test_isize() {
|
||||||
check_round_trip(vec![-1, 2, -3, ::std::isize::MIN, 0, 1, ::std::isize::MAX, 2, 1]);
|
check_round_trip(vec![-1, 2, -3, isize::MIN, 0, 1, isize::MAX, 2, 1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
@ -2617,7 +2617,6 @@ mod test_map {
|
||||||
use crate::cell::RefCell;
|
use crate::cell::RefCell;
|
||||||
use rand::{thread_rng, Rng};
|
use rand::{thread_rng, Rng};
|
||||||
use realstd::collections::TryReserveError::*;
|
use realstd::collections::TryReserveError::*;
|
||||||
use realstd::usize;
|
|
||||||
|
|
||||||
// https://github.com/rust-lang/rust/issues/62301
|
// https://github.com/rust-lang/rust/issues/62301
|
||||||
fn _assert_hashmap_is_unwind_safe() {
|
fn _assert_hashmap_is_unwind_safe() {
|
||||||
|
|
|
@ -2,7 +2,6 @@ use super::*;
|
||||||
|
|
||||||
extern crate test;
|
extern crate test;
|
||||||
use self::test::test::Bencher;
|
use self::test::test::Bencher;
|
||||||
use std::f64;
|
|
||||||
use std::io;
|
use std::io;
|
||||||
use std::io::prelude::*;
|
use std::io::prelude::*;
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ error: ordinal value in `link_ordinal` is too large: `18446744073709551616`
|
||||||
LL | #[link_ordinal(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
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue