diff options
| author | Mara Bos <m-ou.se@m-ou.se> | 2020-09-08 21:39:13 +0200 |
|---|---|---|
| committer | Mara Bos <m-ou.se@m-ou.se> | 2020-09-19 06:54:42 +0200 |
| commit | 1e2dba1e7cf15442257f2cd3ddfe5d0462ee9102 (patch) | |
| tree | 402ea425d8883c2c501f563220fddf001d0f91c2 /library/alloc/tests | |
| parent | 5c30a16fa03efaf87241b363f4323743746c12b0 (diff) | |
| download | rust-1e2dba1e7cf15442257f2cd3ddfe5d0462ee9102.tar.gz rust-1e2dba1e7cf15442257f2cd3ddfe5d0462ee9102.zip | |
Use `T::BITS` instead of `size_of::<T> * 8`.
Diffstat (limited to 'library/alloc/tests')
| -rw-r--r-- | library/alloc/tests/lib.rs | 1 | ||||
| -rw-r--r-- | library/alloc/tests/string.rs | 5 | ||||
| -rw-r--r-- | library/alloc/tests/vec.rs | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/library/alloc/tests/lib.rs b/library/alloc/tests/lib.rs index 03737e1ef1f..3ee0cfbe747 100644 --- a/library/alloc/tests/lib.rs +++ b/library/alloc/tests/lib.rs @@ -18,6 +18,7 @@ #![feature(deque_range)] #![feature(inplace_iteration)] #![feature(iter_map_while)] +#![feature(int_bits_const)] use std::collections::hash_map::DefaultHasher; use std::hash::{Hash, Hasher}; diff --git a/library/alloc/tests/string.rs b/library/alloc/tests/string.rs index 4e604354122..a6e41b21b61 100644 --- a/library/alloc/tests/string.rs +++ b/library/alloc/tests/string.rs @@ -1,6 +1,5 @@ use std::borrow::Cow; use std::collections::TryReserveError::*; -use std::mem::size_of; use std::ops::Bound::*; pub trait IntoCow<'a, B: ?Sized> @@ -605,7 +604,7 @@ fn test_try_reserve() { // on 64-bit, we assume the OS will give an OOM for such a ridiculous size. // Any platform that succeeds for these requests is technically broken with // ptr::offset because LLVM is the worst. - let guards_against_isize = size_of::<usize>() < 8; + let guards_against_isize = usize::BITS < 64; { // Note: basic stuff is checked by test_reserve @@ -686,7 +685,7 @@ fn test_try_reserve_exact() { const MAX_CAP: usize = isize::MAX as usize; const MAX_USIZE: usize = usize::MAX; - let guards_against_isize = size_of::<usize>() < 8; + let guards_against_isize = usize::BITS < 64; { let mut empty_string: String = String::new(); diff --git a/library/alloc/tests/vec.rs b/library/alloc/tests/vec.rs index 368ca4c5432..a49ca7c256a 100644 --- a/library/alloc/tests/vec.rs +++ b/library/alloc/tests/vec.rs @@ -1341,7 +1341,7 @@ fn test_try_reserve() { // on 64-bit, we assume the OS will give an OOM for such a ridiculous size. // Any platform that succeeds for these requests is technically broken with // ptr::offset because LLVM is the worst. - let guards_against_isize = size_of::<usize>() < 8; + let guards_against_isize = usize::BITS < 64; { // Note: basic stuff is checked by test_reserve |
