diff options
| author | Dylan McKay <dylanmckay34@gmail.com> | 2015-08-15 17:17:17 +1200 |
|---|---|---|
| committer | Dylan McKay <dylanmckay34@gmail.com> | 2015-08-15 19:19:13 +1200 |
| commit | 7ebc5e5134b6a0094a197d27423f9a80dbb38598 (patch) | |
| tree | 4d2cbf88d2c6b419d6d29c51612408ca98fa4252 /src/liballoc | |
| parent | 1e1b7f30228782ebf6168a5e20e63cdd7b9763ff (diff) | |
| download | rust-7ebc5e5134b6a0094a197d27423f9a80dbb38598.tar.gz rust-7ebc5e5134b6a0094a197d27423f9a80dbb38598.zip | |
Reduce libcore/liballoc's dependence on pointer sizes
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"); + } } |
