Allow building without std (#1069)

Closes https://github.com/CraneStation/cranelift/issues/1067
This commit is contained in:
Joshua Nelson
2019-09-26 12:00:03 -04:00
committed by Benjamin Bouvier
parent 40f6d3b753
commit a1f6457e8a
18 changed files with 43 additions and 31 deletions

View File

@@ -15,7 +15,7 @@ wasmparser = { version = "0.39.1", default-features = false }
cranelift-codegen = { path = "../cranelift-codegen", version = "0.44.0", default-features = false }
cranelift-entity = { path = "../cranelift-entity", version = "0.44.0", default-features = false }
cranelift-frontend = { path = "../cranelift-frontend", version = "0.44.0", default-features = false }
hashmap_core = { version = "0.1.9", optional = true }
hashbrown = { version = "0.6", optional = true }
failure = { version = "0.1.1", default-features = false, features = ["derive"] }
failure_derive = { version = "0.1.1", default-features = false }
log = { version = "0.4.6", default-features = false }
@@ -28,7 +28,7 @@ target-lexicon = "0.8.1"
[features]
default = ["std"]
std = ["cranelift-codegen/std", "cranelift-frontend/std", "wasmparser/std"]
core = ["hashmap_core", "cranelift-codegen/core", "cranelift-frontend/core", "wasmparser/core"]
core = ["hashbrown", "cranelift-codegen/core", "cranelift-frontend/core", "wasmparser/core"]
enable-serde = ["serde"]
# Temporary feature that enforces basic block semantics.

View File

@@ -37,9 +37,10 @@ extern crate alloc as std;
extern crate std;
#[cfg(not(feature = "std"))]
use hashmap_core::{
use hashbrown::{
hash_map,
hash_map::Entry::{Occupied, Vacant},
map as hash_map, HashMap,
HashMap,
};
#[cfg(feature = "std")]
use std::collections::{