Make the alloc feature actually work.

This commit is contained in:
sebcrozet 2018-05-24 17:17:34 +02:00 committed by Sébastien Crozet
parent 05e053a310
commit d759db682c
5 changed files with 14 additions and 0 deletions

View File

@ -22,6 +22,7 @@ arbitrary = [ "quickcheck" ]
serde-serialize = [ "serde", "serde_derive", "num-complex/serde" ] serde-serialize = [ "serde", "serde_derive", "num-complex/serde" ]
abomonation-serialize = [ "abomonation" ] abomonation-serialize = [ "abomonation" ]
debug = [ ] debug = [ ]
alloc = [ ]
[dependencies] [dependencies]
typenum = "1.10" typenum = "1.10"

View File

@ -8,6 +8,9 @@ use std::mem;
use std::ops::Mul; use std::ops::Mul;
use std::ptr; use std::ptr;
#[cfg(all(feature = "alloc", not(feature = "std")))]
use alloc::Vec;
use generic_array::ArrayLength; use generic_array::ArrayLength;
use typenum::Prod; use typenum::Prod;

View File

@ -1,3 +1,6 @@
#[cfg(all(feature = "alloc", not(feature = "std")))]
use alloc::Vec;
use num::{One, Zero}; use num::{One, Zero};
use alga::general::{ use alga::general::{

View File

@ -1,5 +1,8 @@
use std::ops::Deref; use std::ops::Deref;
#[cfg(all(feature = "alloc", not(feature = "std")))]
use alloc::Vec;
use base::allocator::Allocator; use base::allocator::Allocator;
use base::default_allocator::DefaultAllocator; use base::default_allocator::DefaultAllocator;
use base::dimension::{Dim, DimName, Dynamic, U1}; use base::dimension::{Dim, DimName, Dynamic, U1};

View File

@ -85,6 +85,7 @@ an optimized set of tools for computer graphics and physics. Those features incl
#![warn(incoherent_fundamental_impls)] #![warn(incoherent_fundamental_impls)]
#![doc(html_root_url = "http://nalgebra.org/rustdoc")] #![doc(html_root_url = "http://nalgebra.org/rustdoc")]
#![cfg_attr(not(feature = "std"), no_std)] #![cfg_attr(not(feature = "std"), no_std)]
#![cfg_attr(all(feature = "alloc", not(feature = "std")), feature(alloc))]
#[cfg(feature = "arbitrary")] #[cfg(feature = "arbitrary")]
extern crate quickcheck; extern crate quickcheck;
@ -113,6 +114,9 @@ extern crate typenum;
extern crate alga; extern crate alga;
#[cfg(all(feature = "alloc", not(feature = "std")))]
extern crate alloc;
#[cfg(not(feature = "std"))] #[cfg(not(feature = "std"))]
extern crate core as std; extern crate core as std;