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

Update behavior-considered-undefined.md #1476

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

zylthinking
Copy link

No description provided.

@@ -119,7 +119,7 @@ omitted in surface Rust syntax due to automatic dereferencing; we are
considering the fully expanded place expression here.)

For instance, if `ptr` has type `*const S` where `S` has an alignment of 8, then
`ptr` must be 8-aligned or else `(*ptr).f` is "based on an misaligned pointer".
`*ptr` must be 8-aligned or else `(*ptr).f` is "based on an misaligned pointer".
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
`*ptr` must be 8-aligned or else `(*ptr).f` is "based on an misaligned pointer".
the address contained in `ptr` must be cleanly divisible by 8 or else `(*ptr).f` is "based on an misaligned pointer".

On the rustdocs call today we spent a lot of time trying to determine whether or not this was correct or an improvement. Maybe there's a better way to say this more explicitly that relies less on notation?

The ambiguity all comes from whether we're talking about where the pointer is stored or whether we're talking about the address contained in the pointer.

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.

None yet

2 participants