diff options
Diffstat (limited to 'src/liballoc')
| -rw-r--r-- | src/liballoc/lib.rs | 1 | ||||
| -rw-r--r-- | src/liballoc/raw_vec.rs | 10 |
2 files changed, 5 insertions, 6 deletions
diff --git a/src/liballoc/lib.rs b/src/liballoc/lib.rs index ca86850f5df..2db9cc7c4d8 100644 --- a/src/liballoc/lib.rs +++ b/src/liballoc/lib.rs @@ -83,6 +83,7 @@ #![feature(lang_items)] #![feature(no_std)] #![feature(nonzero)] +#![feature(num_bits_bytes)] #![feature(optin_builtin_traits)] #![feature(placement_in_syntax)] #![feature(placement_new_protocol)] diff --git a/src/liballoc/raw_vec.rs b/src/liballoc/raw_vec.rs index 9311f44d9df..97acd0db524 100644 --- a/src/liballoc/raw_vec.rs +++ b/src/liballoc/raw_vec.rs @@ -15,6 +15,7 @@ use heap; use super::oom; use super::boxed::Box; use core::ops::Drop; +use core; /// A low-level utility for more ergonomically allocating, reallocating, and deallocating a /// a buffer of memory on the heap without having to worry about all the corner cases @@ -443,11 +444,8 @@ impl<T> Drop for RawVec<T> { // user-space. e.g. PAE or x32 #[inline] -#[cfg(target_pointer_width = "64")] -fn alloc_guard(_alloc_size: usize) { } - -#[inline] -#[cfg(target_pointer_width = "32")] fn alloc_guard(alloc_size: usize) { - assert!(alloc_size <= ::core::isize::MAX as usize, "capacity overflow"); + if core::usize::BITS < 64 { + assert!(alloc_size <= ::core::isize::MAX as usize, "capacity overflow"); + } } |
