rust-lang / rust-lang/reference

"The size and alignment [of pointers to unsized types] is guaranteed to be at least equal to the size and alignment of a pointer."

Open
#1,510 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
1.6k
Forks
607
PR merge metrics
PR metrics pending

Description

The Type Layout reference page (https://doc.rust-lang.org/reference/type-layout.html) contains the following sentences.

Pointers to sized types have the same size and alignment as usize.
Pointers to unsized types are sized. The size and alignment is guaranteed to be at least equal to the size and alignment of a pointer.
Note: Though you should not rely on this, all pointers to DSTs are currently twice the size of the size of usize and have the same alignment.

Re: this sentence in particular

The size and alignment is guaranteed to be at least equal to the size and alignment of a pointer.

could it be that there are some missing words at the end of the sentence? For example:

The size and alignment is guaranteed to be at least equal to the size and alignment of a pointer to a sized type.

After all, the very point of these passages seems to be that there's no such thing as 'the size and alignment of a pointer' as it is ambiguous and can refer to either a pointer to a sized type or a pointer to an unsized type.

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 with the Type Layout reference page at doc.rust-lang.org/reference/type-layout.html and review the quoted pointer-layout sentences together. Determine whether the sentence about unsized-type pointers needs clarification, then update the wording so the distinction is unambiguous and verify the rendered documentation.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
documentation
Issue type
Documentation
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.