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

autoimpl trait re-implementation should copy cfg attrs #29

Closed
dhardy opened this issue Dec 15, 2022 · 2 comments
Closed

autoimpl trait re-implementation should copy cfg attrs #29

dhardy opened this issue Dec 15, 2022 · 2 comments

Comments

@dhardy
Copy link
Contributor

dhardy commented Dec 15, 2022

Summary
The #[cfg(..)] attr is used to conditionally compile something. If a trait item is conditional, then its re-implementation should be too.

Are there any other attrs which should be forwarded?

To Reproduce

#[impl_tools::autoimpl(for<T: trait> &T)]
trait MyTrait {
    #[cfg(feature = "foo")]
    fn do_foo(&self);
}
@dhardy
Copy link
Contributor Author

dhardy commented Dec 16, 2022

It seems that no other built-in attributes should be propegated to method implementations. (There is some ambiguity for allow, warn, deny, forbid since something like #[allow(non_snake_case)] can appear on both trait item declarations and implementations, but testing shows that this is unnecessary.)

@dhardy
Copy link
Contributor Author

dhardy commented Dec 16, 2022

Fixed by #30

@dhardy dhardy closed this as completed Dec 16, 2022
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

No branches or pull requests

1 participant