From 7ebc5e5134b6a0094a197d27423f9a80dbb38598 Mon Sep 17 00:00:00 2001 From: Dylan McKay Date: Sat, 15 Aug 2015 17:17:17 +1200 Subject: Reduce libcore/liballoc's dependence on pointer sizes --- src/liballoc/lib.rs | 1 + src/liballoc/raw_vec.rs | 10 ++++------ 2 files changed, 5 insertions(+), 6 deletions(-) (limited to 'src/liballoc') 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 Drop for RawVec { // 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"); + } } -- cgit 1.4.1-3-g733a5