Update no_std support in cranelift-frontend.

This commit is contained in:
Dan Gohman
2018-09-28 14:46:26 -07:00
parent 75e4ff62a0
commit 52aa1d292a
4 changed files with 17 additions and 5 deletions

View File

@@ -176,6 +176,9 @@
#![cfg_attr(not(feature = "std"), no_std)]
#![cfg_attr(not(feature = "std"), feature(alloc))]
#[cfg(not(feature = "std"))]
#[macro_use]
extern crate alloc;
extern crate cranelift_codegen;
#[cfg(test)]
extern crate target_lexicon;
@@ -191,10 +194,16 @@ mod ssa;
mod switch;
mod variable;
/// This replaces `std` in builds with `core`.
#[cfg(not(feature = "std"))]
mod std {
extern crate alloc;
pub use self::alloc::vec;
pub use alloc::{string, vec};
pub use core::*;
pub mod collections {
#[allow(unused_extern_crates)]
extern crate hashmap_core;
pub use self::hashmap_core::map as hash_map;
pub use self::hashmap_core::{HashMap, HashSet};
}
}