Skip to content
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

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

Open
yg-i opened this issue Jun 15, 2024 · 0 comments

Comments

@yg-i
Copy link

yg-i commented Jun 15, 2024

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.

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

No branches or pull requests

1 participant