no_std import cleanups

- Gate no_std on the "std" feature
- Import core when std is present
- Import collections when std is absent
- Add a placeholder gated "use" directive for Box in curve.rs
This commit is contained in:
Tony Arcieri 2017-03-08 00:19:08 -08:00
parent f69c73e83e
commit 384cf1df31
2 changed files with 11 additions and 5 deletions

View file

@ -91,6 +91,9 @@ use subtle::CTAssignable;
use subtle::CTEq;
use subtle::CTNegatable;
#[cfg(not(feature = "std"))]
use collections::boxed::Box;
// ------------------------------------------------------------------------
// Compressed points
// ------------------------------------------------------------------------

View file

@ -9,7 +9,8 @@
// - Isis Agora Lovecruft <isis@patternsinthevoid.net>
// - Henry de Valence <hdevalence@hdevalence.ca>
#![no_std]
#![cfg_attr(not(feature = "std"), no_std)]
#![cfg_attr(not(feature = "std"), feature(collections))]
#![allow(unused_features)]
#![feature(test)]
#![deny(missing_docs)] // refuse to compile if documentation is missing
@ -32,19 +33,21 @@
//! hatred of the Daleks. Rusty destroys the other Daleks and departs the
//! ship, determined to track down and bring an end to the Dalek race.
#[cfg(test)]
#[macro_use]
extern crate std;
#[cfg(test)]
extern crate test;
#[macro_use]
extern crate arrayref;
#[cfg(feature = "std")]
extern crate core;
#[cfg(feature = "std")]
extern crate rand;
#[cfg(not(feature = "std"))]
extern crate collections;
// Modules for low-level operations directly on field elements and curve points.
pub mod field;