Skip to content

chore: use auto-derived copy/clone impls #4417

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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

Conversation

nyurik
Copy link
Contributor

@nyurik nyurik commented Apr 15, 2025

Unless there is something really magical, it doesn't seem to make sense to have manual impl for the most commonly used traits

@rustbot label +stable-nominated

Unless there is something really magical, it doesn't seem to make sense to have manual impl for the most commonly used traits
@rustbot
Copy link
Collaborator

rustbot commented Apr 15, 2025

r? @tgross35

rustbot has assigned @tgross35.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot
Copy link
Collaborator

rustbot commented Apr 15, 2025

Some changes occurred in the Android module

cc @maurer

Some changes occurred in solarish module

cc @jclulow, @pfmooney

Some changes occurred in OpenBSD module

cc @semarie

@rustbot rustbot added the stable-nominated This PR should be considered for cherry-pick to libc's stable release branch label Apr 15, 2025
@nyurik nyurik marked this pull request as draft April 15, 2025 16:52
@tgross35
Copy link
Contributor

I'm not sure if it would work but you can try adding ::core::prelude::v1::derive to the prelude at

macro_rules! prelude {
, since that isn't in scope by default when building as part of std.

@nyurik
Copy link
Contributor Author

nyurik commented Apr 15, 2025

@tgross35 thx, but I am still getting a really strange warning in the style check -- what is an s! macro, and why rust/clippy suggests it?

error: impl Copy and Clone manually
  --> /home/runner/work/libc/libc/libc-test/../src/fuchsia/mod.rs:84:3
   |
84 | #[derive(Clone, Copy)]
   |   ^^^^^^^^^^^^^^^^^^^ found manual implementation of Copy and/or Clone
   |
   = help: use one of the s! macros instead

@tgross35
Copy link
Contributor

Most of the binding structs are wrapped in s! which adds the trait implementations. For enums, e! should do the same.

@rustbot author

@rustbot
Copy link
Collaborator

rustbot commented Apr 18, 2025

Reminder, once the PR becomes ready for a review, use @rustbot ready.

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.

3 participants