Skip to content
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

no_std support on nightly #211

Closed
wants to merge 1 commit into from

Conversation

FlorianUekermann
Copy link

@FlorianUekermann FlorianUekermann commented Dec 5, 2022

As mentioned by #196, nightly now has the error_in_core feature. This make no_std support pretty straightforward (just replace std with core in a few places).

Some tests don't work on on no_std to keep the commit small for now. Maybe this is fine until error_in_core is merged, because there are only 5 lines in #[cfg(not(feature = "std"))] guards, so running the tests with std disabled hardly increases coverage anyway

Once error_in_core is in stable, even this little trick:

#[doc(hidden)]
pub mod __private {
    #[cfg(not(feature = "std"))]
    pub use core::error;
    #[cfg(feature = "std")]
    pub use std::error;

can be removed, or not, depending on how important the MSRV guarantees are.

Thoughts?

@FlorianUekermann FlorianUekermann force-pushed the master branch 4 times, most recently from a11c8cb to 4c01863 Compare December 6, 2022 18:26
@FlorianUekermann
Copy link
Author

I just rebased. @dtolnay do you have any comments on this?

@OverOrion
Copy link

This PR has been open for quite a while, are you going to review it @dtolnay anytime soon?

@dzmitry-lahoda
Copy link

@dtolnay what would be prerequisute for merge please ? thank you a lot

Copy link
Owner

@dtolnay dtolnay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer to consider this only after it works on stable rustc.

Thanks anyway for the PR!

@dtolnay dtolnay closed this Jul 14, 2023
@dzmitry-lahoda
Copy link

okey, will continue use fork. btw this pr does not required nightly on std? so other users intact, only who want no std will be nightly?

@jordens
Copy link
Contributor

jordens commented May 16, 2024

I found this after going down the same road.

Here's a version that has all tests passing on both std and no_std, (compiletests can also be made to run on no_std but require a verbose splattering of cfg(error_in_core) plus overwrite of the output):

master...quartiq:thiserror:no-std

@jordens jordens mentioned this pull request May 16, 2024
@jordens jordens mentioned this pull request Jun 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants