lib/cretonne works with no_std
This commit is contained in:
committed by
Dan Gohman
parent
7375088c3e
commit
299e8a9737
@@ -20,8 +20,11 @@ name = "cretonne"
|
|||||||
[dependencies.hashmap_core]
|
[dependencies.hashmap_core]
|
||||||
version = "0.1.1"
|
version = "0.1.1"
|
||||||
optional = true
|
optional = true
|
||||||
|
[dependencies.error_core]
|
||||||
|
version = "0.1.0"
|
||||||
|
optional = true
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
# Currently, the only feature is the `no_std` feature.
|
# Currently, the only feature is the `no_std` feature.
|
||||||
# Enabling this disables use of `stdlib`.
|
# Enabling this disables use of `stdlib`.
|
||||||
no_std = ["hashmap_core"]
|
no_std = ["hashmap_core", "error_core"]
|
||||||
@@ -9,6 +9,7 @@
|
|||||||
/// The output will appear in files named `cretonne.dbg.*`, where the suffix is named after the
|
/// The output will appear in files named `cretonne.dbg.*`, where the suffix is named after the
|
||||||
/// thread doing the logging.
|
/// thread doing the logging.
|
||||||
|
|
||||||
|
#[cfg(not(feature = "no_std"))]
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
#[cfg(not(feature = "no_std"))]
|
#[cfg(not(feature = "no_std"))]
|
||||||
use std::env;
|
use std::env;
|
||||||
|
|||||||
@@ -9,6 +9,8 @@
|
|||||||
#[cfg(feature = "no_std")]
|
#[cfg(feature = "no_std")]
|
||||||
extern crate hashmap_core;
|
extern crate hashmap_core;
|
||||||
#[cfg(feature = "no_std")]
|
#[cfg(feature = "no_std")]
|
||||||
|
extern crate error_core;
|
||||||
|
#[cfg(feature = "no_std")]
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate alloc;
|
extern crate alloc;
|
||||||
|
|
||||||
@@ -72,9 +74,6 @@ mod std {
|
|||||||
pub use alloc::BTreeSet;
|
pub use alloc::BTreeSet;
|
||||||
}
|
}
|
||||||
pub mod error {
|
pub mod error {
|
||||||
pub trait Error {
|
pub use error_core::Error;
|
||||||
fn description(&self) -> &str;
|
|
||||||
fn cause(&self) -> Option<&Error> { None }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user