-
Notifications
You must be signed in to change notification settings - Fork 14
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
Where possible replace ::std with ::core in codegen #73
Conversation
We could add a I actually don't think we have any need for full |
How would you bring in the |
@dimpolo I think we might need to start wrapping the code we generate in a So given an input like: #[auto_impl(Arc)]
pub trait Trait {} with the pub trait Trait {}
const __AUTO_IMPL_TRAIT: () = {
extern crate core;
extern crate alloc;
impl<T> Trait for alloc::sync::Arc<T> where T: Trait {}
}; We can look at that independently though unless you're keen to give it a go 🙂 |
Very keen in fact 😁 |
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.
Sorry for taking so long to respond to this.
This seems like a useful change to me! Only thing I'm not yet sure about is whether we can release this as a minor version update. What if users have core
or alloc
somewhere in their root namespace (i.e. a module or a renamed crate?). Would that interfere?
I would also like to see some tests. Something that runs on CI which makes sure
- This crate works with a
no_std
environment: one withalloc
and one without. - That modules or crate renames don't interfere with our paths.
Could you still add those tests? That would be great! If you need any help or have questions about that, we can just discuss it here.
Oh and, I just fixed the UI tests in #74, so you can just rebase now.
Thanks for looking into this. I'm not 100% sure but it seems as though things "just work". I believe a minor version update would be ok. |
|
||
use auto_impl::auto_impl; | ||
|
||
mod core {} |
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.
Is the idea of including these at the root here just to make sure we don't accidentally use module instead of crate paths to the standard library crates?
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, that was the idea
310: Add blanket impls for references r=therealprof a=GrantM11235 I would prefer to use a proc-macro like [auto-impl](https://crates.io/crates/auto_impl), but that doesn't support no_std yet. (see auto-impl-rs/auto_impl#73) Co-authored-by: Grant Miller <GrantM11235@gmail.com>
It would be great if this can be merged, the change worked for my project. |
Sorry for the terribly slow response. This looks good to me! Only thing I noticed: |
Released as 0.5.0. |
Partly resolves #72.
::alloc
is more problematic since it requires aextern crate alloc;