-
Notifications
You must be signed in to change notification settings - Fork 1.2k
libc: add padding struct #4632
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
libc: add padding struct #4632
Conversation
src/types.rs
Outdated
/// while providing `Default`. | ||
#[repr(transparent)] | ||
#[derive(Clone, Copy)] | ||
pub struct Padding<T: Copy>(MaybeUninit<T>); |
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 think we need to export this, pub(crate)
should be fine
Fyi you can delete the template in the PR body if it's not relevant |
8cdddd4
to
1daca12
Compare
src/lib.rs
Outdated
pub use new::*; | ||
|
||
mod types; | ||
pub use types::*; |
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.
There shouldn't be anything to export
LGTM with the last change, any reason this is marked as a draft? |
It seems like ctest still fails with just these changes. |
1daca12
to
f72c749
Compare
This bit? It just needs an |
f72c749
to
b20e865
Compare
For style check, this will need an update at libc/libc-test/test/check_style.rs Line 20 in c0071cc
|
8dd85bd
to
fa9d83e
Compare
src/types.rs
Outdated
use core::clone::Clone; | ||
use core::default::Default; | ||
use core::marker::Copy; | ||
use core::mem::MaybeUninit; | ||
use core::prelude::rust_2024::derive; |
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.
If you need to import all of these, just add Default
to the prelude macro and add use crate::prelude::*
here.
This adds a bit of trickiness: there is no crate::prelude
in some cases
Lines 143 to 145 in c0071cc
} else { | |
// non-supported targets: empty... | |
} |
mod types
into the prelude as well.
6d3757e
to
14167c4
Compare
src/types.rs
Outdated
//! Platform-agnostic support types. | ||
use core::mem::MaybeUninit; | ||
use core::prelude::rust_2024::derive; |
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.
Sigh I was thinking this was already in the prelude, sorry I keep steering you wrong here.
Add this to prelude!
instead, that's consistent. Also it will need to be ::core::prelude::v1::derive
like https://github.com/rust-lang/libc/blob/c0071cc9f9385da6352e40824cfd77334e85f72d/src/macros.rs#L117C15-L117C43, the 2024 prelude isn't available until way after our MSRV.
14167c4
to
546a941
Compare
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.
Thanks for all the cycles, looks great :)
(backport <rust-lang#4632>) (cherry picked from commit bbafd45)
Description
Adds a struct for padding types.
Sources
Checklist
libc-test/semver
have been updated*LAST
or*MAX
areincluded (see #3131)
cd libc-test && cargo test --target mytarget
);especially relevant for platforms that may not be checked in CI