-
Notifications
You must be signed in to change notification settings - Fork 90
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
officially support #![no_std]
#41
#45
Conversation
A workaround would be having an explicit Suggestions are welcome - I am kind of stuck right now. :-) This is what I mean: Where this is the original: tests/no_std.rs And this is the code that should be emitted: src/lib.rs PS: It's no different if I move the test to the examples folder. |
0fc036d
to
b65cd24
Compare
The test requires nightly. Since it is a compiletest, this requirement is met.
Ok, I have now worked around the strange issues with emitting cc @killercup in case you want to give feedback. :-) |
Oh, interesting - compiletest seems to not support |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems good, I have left one inline comment about String though.
if self.enabled { | ||
trace!("Deriving build method `{}`.", self.ident.as_ref()); | ||
tokens.append(quote!( | ||
#doc_comment | ||
#vis fn #ident(#self_param) | ||
-> ::std::result::Result<#target_ty #target_ty_generics, ::std::string::String> | ||
-> #result<#target_ty #target_ty_generics, #string> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the reason extern crate collections
is required, right? Can we work around that? E.g., not give string error messages when using no_std
but more simple ones?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, I was thinking about that too.
I would say, that we could implement that as a separate feature. In fact this could just mean to provide more structured errors. I just opened issue #60 for that. How does that sound? :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
#![no_std]
#41 -- WIP#![no_std]
#41
cc @cramertj
This is work in progress and does not work yet.
open questions
The expanded code only contains the first part
It's like the cfg-attributes always evaluate to
#[cfg(not(no_std))]==true
and#[cfg(no_std)]==false
-- independently of the testcase. I would not be surprised if this was a rust or cargo bug evaluating the cfg-attribute in the wrong context - otherwise I don't understand it.