Skip to content

libc: wrap padding fields with Padding newtype. #4609

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 1 commit into
base: main
Choose a base branch
from

Conversation

mbyx
Copy link
Contributor

@mbyx mbyx commented Aug 2, 2025

Description

Changes the types of fields with name __pad, _pad, __padding, _padding, __rsvd, __unused to use a new type wrapper around MaybeUninit as per #1453

Only modifies private fields so that the changes can be backported.

Sources

Checklist

  • Relevant tests in libc-test/semver have been updated
  • No placeholder or unstable values like *LAST or *MAX are
    included (see #3131)
  • Tested locally (cd libc-test && cargo test --target mytarget);
    especially relevant for platforms that may not be checked in CI

src/types.rs Outdated
@@ -0,0 +1,12 @@
use core::mem::MaybeUninit;

/// A transparent wrapper over `MaybeUninit<T>` to represent uninitialized padding.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// A transparent wrapper over `MaybeUninit<T>` to represent uninitialized padding.
/// A transparent wrapper over `MaybeUninit<T>` to represent uninitialized padding
/// while providing `Default`.

To clarify why we don't just use Default

@tgross35
Copy link
Contributor

tgross35 commented Aug 9, 2025

@rustbot blocked
on ctest2

@tgross35
Copy link
Contributor

@mbyx could you put up a separate PR that only adds the Padding type? I'd like to start directing new PRs to use this.

@mbyx mbyx force-pushed the libc-wrap-padding branch 2 times, most recently from e317b7a to 32c0811 Compare August 11, 2025 08:23
@mbyx mbyx force-pushed the libc-wrap-padding branch from 32c0811 to b1e6991 Compare August 11, 2025 08:24
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