Skip to content

Rework #[recursively_pinned] to prevent unwanted direct initialization#892

Open
copybara-service[bot] wants to merge 1 commit intomainfrom
test_905032075
Open

Rework #[recursively_pinned] to prevent unwanted direct initialization#892
copybara-service[bot] wants to merge 1 commit intomainfrom
test_905032075

Conversation

@copybara-service
Copy link
Copy Markdown

Rework #[recursively_pinned] to prevent unwanted direct initialization

  • Replaced the #[non_exhaustive] attribute with a private field of type ctor::macro_internal::MustUseCtorToInitialize.
  • Appended the hidden field at the back for unnamed fields (tuple structs/variants) to preserve field index alignment.
  • Note: This means that DST tuple structs/variants are not supported due to the requirement that the unsized field must be the last field, which conflicts with the hidden field insertion.

@google-cla
Copy link
Copy Markdown

google-cla Bot commented Apr 24, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

- Replaced the `#[non_exhaustive]` attribute with a private field of type `ctor::macro_internal::MustUseCtorToInitialize`.
- Appended the hidden field at the back for unnamed fields (tuple structs/variants) to preserve field index alignment.
- Note: This means that DST tuple structs/variants are not supported due to the requirement that the unsized field must be the last field, which conflicts with the hidden field insertion.

PiperOrigin-RevId: 905032075
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants