Fix build with use_alloc+use_std.

This commit is contained in:
whitequark 2017-01-07 18:40:15 +00:00
parent b1e24a9826
commit f32ddb6286
4 changed files with 9 additions and 7 deletions

View File

@ -13,6 +13,8 @@ matrix:
env: FEATURES='use_collections'
- rust: nightly
env: FEATURES='use_alloc use_collections'
- rust: nightly
env: FEATURES='use_std use_alloc use_collections'
script:
- cargo build --features "$FEATURES"
notifications:

View File

@ -1,12 +1,12 @@
#![no_std]
#![cfg_attr(feature = "use_alloc", feature(alloc))]
#![cfg_attr(feature = "use_collections", feature(collections))]
#![cfg_attr(all(feature = "use_alloc", not(feature = "use_std")), feature(alloc))]
#![cfg_attr(all(feature = "use_collections", not(feature = "use_std")), feature(collections))]
#[cfg(feature = "use_std")]
extern crate std;
#[cfg(feature = "use_alloc")]
#[cfg(all(feature = "use_alloc", not(feature = "use_std")))]
extern crate alloc;
#[cfg(feature = "use_collections")]
#[cfg(all(feature = "use_collections", not(feature = "use_std")))]
extern crate collections;
mod object;

View File

@ -3,11 +3,11 @@ use core::fmt;
#[cfg(feature = "use_std")]
use std::boxed::Box;
#[cfg(feature = "use_alloc")]
#[cfg(all(feature = "use_alloc", not(feature = "use_std")))]
use alloc::boxed::Box;
#[cfg(feature = "use_std")]
use std::vec::Vec;
#[cfg(all(feature = "use_alloc", feature = "use_collections"))]
#[cfg(all(feature = "use_alloc", feature = "use_collections", not(feature = "use_std")))]
use collections::vec::Vec;
/// A managed object.

View File

@ -3,7 +3,7 @@ use core::fmt;
#[cfg(feature = "use_std")]
use std::vec::Vec;
#[cfg(feature = "use_collections")]
#[cfg(all(feature = "use_collections", not(feature = "use_std")))]
use collections::vec::Vec;
/// A managed slice.