rust-lang / rust-lang/reference

Define the properties of Padding

Open
#882 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-type-layout New Content
Dominant language
Rust
Stars
1.6k
Forks
607
PR merge metrics
PR metrics pending

Description

We don't have a good explanation of the properties of padding. Currently we talk about it in two places:

  1. Type layout; It's pointed out that a type can have alignment padding that adds to the size.
  2. Added in #852, it's pointed out that it can be set as uninitialized.

I think padding should probably be described in the type layout chapter.

My question though, other than being an unnameable psuedo-field that can theoretically have any value, does it have any other properties? E.g., can they be repurposed by enums to do niche optimizations (making it unsafe to set the value)? Other restrictions?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the type layout chapter and the existing discussion of padding added in #852. Determine the agreed properties of padding, including whether enum niche optimizations or other restrictions affect it. Done means the behavior is settled and clearly documented in the appropriate part of the Reference.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
documentation
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.