-
-
Notifications
You must be signed in to change notification settings - Fork 166
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add #![no_std] support #196
Comments
Just pitching in, I believe rust-lang/project-error-handling#3 is the Rust issue in question that adds the Error trait to core. |
I need no_std support pretty badly, so I had a look at it and encountered no issues using error_in_core: FlorianUekermann@369f452 There isn't much more to it than replacing
Of course this only works on nightly for now,. @dtolnay : Are you open to a PR? |
@FlorianUekermann if you have one, I would just send it. If @dtolnay is against the PR, I'd be happy to maintain a fork with no_std support. |
I published the changes in the PR as thiserror-core for now, because I needed something on crates.io asap. Maybe you'll find that useful until something similar is merged. |
Would it be possible to simply remove the As it stands, I've had to remove |
I am not interested in no-std support until after Error in core is stable. I'll go ahead and close this issue and would ask for a new issue to be opened then. |
That's fair, and thank you for the excellent library! I ended up using derive_more's From + Display impl and a manual impl Error behind an std feature flag, which worked for my use cases at least and saved most of the manual work :) |
You can use #![cfg_attr(not(feature = "std"), no_std)]
#[derive(Debug)]
#[cfg_attr(feature = "std", derive(thiserror::Error))]
#[cfg_attr(feature = "std", error("Hello, world!"))]
pub struct Error(); I have also published an alternative derive crate that works with |
For those that want to play with |
It might be the time to reopen this, rust-lang/rust#103765. |
I know of #64.
However, I saw an unstable feature in nightly,
error_in_core
, which addscore::error::Error
. Maybe this is an additional incentive, to think aboutno_std
support again.The text was updated successfully, but these errors were encountered: