Add an explicit std feature so that features are purely additive.

This commit is contained in:
Dan Gohman
2018-02-13 17:48:04 -08:00
parent 61db54c447
commit e37f45667f
10 changed files with 41 additions and 27 deletions

View File

@@ -12,12 +12,13 @@ name = "cton_wasm"
[dependencies]
wasmparser = "0.14.1"
cretonne = { path = "../cretonne", version = "0.1.0" }
cretonne-frontend = { path = "../frontend", version = "0.1.0" }
cretonne = { path = "../cretonne", version = "0.1.0", default_features = false }
cretonne-frontend = { path = "../frontend", version = "0.1.0", default_features = false }
[dependencies.hashmap_core]
version = "0.1.1"
optional = true
[dependencies.error_core]
version = "0.1.0"
optional = true
@@ -26,6 +27,6 @@ optional = true
tempdir = "0.3.5"
[features]
# Currently, the only feature is the `no_std` feature.
# Enabling this disables use of `stdlib`.
no_std = ["hashmap_core", "error_core", "cretonne/no_std", "cretonne-frontend/no_std"]
default = ["std"]
std = ["cretonne/std", "cretonne-frontend/std"]
no_std = ["hashmap_core", "error_core", "cretonne/no_std", "cretonne-frontend/no_std"]

View File

@@ -9,12 +9,12 @@
//!
//! The main function of this module is [`translate_module`](fn.translate_module.html).
#![cfg_attr(feature = "no_std", no_std)]
#![deny(missing_docs)]
#![cfg_attr(feature = "no_std", feature(alloc))]
#![cfg_attr(not(feature = "std"), no_std)]
#![cfg_attr(not(feature = "std"), feature(alloc))]
#[cfg(feature = "no_std")]
#[cfg(not(feature = "std"))]
#[macro_use]
extern crate alloc;
@@ -42,7 +42,7 @@ pub use environ::{FuncEnvironment, ModuleEnvironment, DummyEnvironment, GlobalVa
pub use translation_utils::{FunctionIndex, GlobalIndex, TableIndex, MemoryIndex, SignatureIndex,
Global, GlobalInit, Table, Memory};
#[cfg(feature = "no_std")]
#[cfg(not(feature = "std"))]
mod std {
pub use alloc::vec;
pub use alloc::string;