Skip to content

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

Closed
wants to merge 6 commits into from
Closed

Make extra_traits work with rustc-dep-of-std #2074

wants to merge 6 commits into from

Conversation

osa1
Copy link

@osa1 osa1 commented Feb 18, 2021

Fixes #2064


Files for other platforms also need to be updated.

@rust-highfive
Copy link

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.

@Amanieu
Copy link
Member

Amanieu commented Feb 18, 2021

r? @JohnTitor

@rust-highfive rust-highfive assigned JohnTitor and unassigned Amanieu Feb 18, 2021
@JohnTitor
Copy link
Member

@bors try

@bors
Copy link
Contributor

bors commented Feb 27, 2021

⌛ Trying commit 0bd9e2e with merge 98841cb...

bors added a commit that referenced this pull request Feb 27, 2021
Make extra_traits work with rustc-dep-of-std

Fixes #2064

---

Files for other platforms also need to be updated.
@bors
Copy link
Contributor

bors commented Feb 27, 2021

💔 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))]
Copy link
Member

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.

Copy link
Author

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.

Copy link
Author

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?

Copy link
Author

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.

Copy link
Member

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.

Copy link
Author

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?

Copy link
Member

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.

@JohnTitor
Copy link
Member

I'm going to close as inactive, feel free to re-open when you get some time!

@JohnTitor JohnTitor closed this Nov 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Features 'rustc-dep-of-std' and 'extra_traits' don't work together
5 participants