-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Make extra_traits work with rustc-dep-of-std #2074
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
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @Amanieu (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
r? @JohnTitor |
@bors try |
Make extra_traits work with rustc-dep-of-std Fixes #2064 --- Files for other platforms also need to be updated.
💔 Test failed - checks-actions |
@@ -73,7 +73,7 @@ macro_rules! s { | |||
(it: $(#[$attr:meta])* pub struct $i:ident { $($field:tt)* }) => ( | |||
__item! { | |||
#[repr(C)] | |||
#[cfg_attr(feature = "extra_traits", derive(Debug, Eq, Hash, PartialEq))] | |||
#[cfg_attr(feature = "extra_traits", derive(core::fmt::Debug, core::cmp::Eq, core::hash::Hash, core::cmp::PartialEq))] |
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.
According to CI this doesn't work on Rust 1.13.
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.
Hm, that's weird. I don't know what the problem is with this syntax. I guess I'll have to install rustc 1.13 and experiment with it.
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.
These are the errors:
error: expected `,`, found `::`
--> src/macros.rs:76:61
|
76 | #[cfg_attr(feature = "extra_traits", derive(core::fmt::Debug, core::cmp::Eq, core::hash::Hash, core::cmp::PartialEq))]
| ^^
error: expected `,`, found `::`
--> src/macros.rs:76:61
|
76 | #[cfg_attr(feature = "extra_traits", derive(core::fmt::Debug, core::cmp::Eq, core::hash::Hash, core::cmp::PartialEq))]
| ^^
error: expected `]`, found `::`
--> src/macros.rs:76:61
|
76 | #[cfg_attr(feature = "extra_traits", derive(core::fmt::Debug, core::cmp::Eq, core::hash::Hash, core::cmp::PartialEq))]
| ^^
error: Could not compile `libc`.
I have no idea what the problem is and how to work around this. Anyone have any ideas?
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.
I guess qualified paths were not allowed in derive
arguments in 1.13.
When building libc for rustc we know we're using a more recent version, so ideally I wouldn't have to deal with this.
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.
We can use cfg(feature = "rustc-dep-of-std")
for it.
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.
I don't understand how that would work. The core::fmt::...
syntax will still be there and rustc 1.13 will try to parse it, no?
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.
That syntax won't work on 1.13: https://rust.godbolt.org/z/f9nf9rTTG
So, we want to make it work under rustc-dep-of-std
, right? Then we can hide them behind rustc-dep-of-std
, it's fine because we suppose it's used on rust-lang/rust.
I'm going to close as inactive, feel free to re-open when you get some time! |
Fixes #2064
Files for other platforms also need to be updated.