I'm having trouble compiling a no_std crate that depends on the Failure crate. Running cargo build spits out the following error:
error[E0433]: failed to resolve. Maybe a missing `extern crate std;`?
--> src\lib.rs:6:17
|
6 | #[derive(Debug, failure::Fail)]
| ^^^^^^^^^^^^^ Maybe a missing `extern crate std;`?
In my Cargo.toml I've disabled failure's "std" feature and it is still looking for std. Also I don't understand why it is looking for Fail in std when its use is fully qualified with the failure crate name.
The contents of my lib.rs are as below:
#![no_std]
#![feature(use_extern_macros)]
extern crate failure;
#[derive(Debug, failure::Fail)]
struct M {
d: i32
}
impl core::fmt::Display for M {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
write!(f, "Dummy string - will do for now")
}
}
and my Cargo.toml is:
[package]
name = "test_no_std"
version = "0.1.0"
[dependencies.failure]
version = "0.1.1"
default-features = false
features = ["derive"]
I've got a new version that's fixed the derive to support no_std, but its not on crates.io yet, sorry. failure itself is no_std already if you don't use the derive.