Skip to content

place "place projection" definition in glossary - #2231

Closed
tshepang wants to merge 2 commits into
rust-lang:masterfrom
tshepang:place-definition-in-glossary
Closed

place "place projection" definition in glossary#2231
tshepang wants to merge 2 commits into
rust-lang:masterfrom
tshepang:place-definition-in-glossary

Conversation

@tshepang

Copy link
Copy Markdown
Member

The term is defined in 2 separate places, and the definitions do not match.

@rustbotrustbot added the S-waiting-on-review Status: The marked PR is awaiting review from a maintainer label Apr 18, 2026
The term is defined in 2 separate places, and the definitions do not match.
@tshepang
tshepangforce-pushed the place-definition-in-glossary branch from ee20d57 to aecd061CompareApril 18, 2026 21:04
@ehuss

Copy link
Copy Markdown
Contributor

I'm not sure these are intended to be the same.

@RalfJung Is the definition of place projection intended to be the same for these two scenarios (closure capture and UB pointer arithmetic)?

@RalfJung

Copy link
Copy Markdown
Member

Yeah this changes the opsem page to suddenly include pointer deref's and that doesn't make sense in that context (since it is talking about pointer arithmetic, and a deref isn't pointer arithmetic).

@tshepang

Copy link
Copy Markdown
MemberAuthor

since this is about pointer arithmetic, should field expression be removed from the more narrow definiton of place expression

@RalfJung

Copy link
Copy Markdown
Member

We should probably reword the UB page to use a different term, since it only refers to a few specific place projections.

@tshepang

tshepang commented May 2, 2026

Copy link
Copy Markdown
MemberAuthor

would this work

A tuple index expression or an array/slice index expression that violates the (safety) requirements of in-bounds pointer arithmetic.

@RalfJung

Copy link
Copy Markdown
Member

You forgot "field expression".

I would suggest something like #2253.

@rustbot

Copy link
Copy Markdown
Collaborator

☔ The latest upstream changes (possibly #2203) made this pull request unmergeable. Please resolve the merge conflicts.

@tshepang

tshepang commented May 7, 2026

Copy link
Copy Markdown
MemberAuthor

You forgot "field expression".

I actually thought it was accidental, since I assumed that, given offset works only with integers, then only APIs taking integers were connected to this rule.

@RalfJung

RalfJung commented May 7, 2026

Copy link
Copy Markdown
Member

Please don't make silent assumptions. Instead, ask for clarification. :)

It was very much deliberate. (*ptr).field is UB if field has offset N and that offset goes beyond the bounds of the allocation ptr is derived from.

@tshepangtshepang closed this May 7, 2026
@rustbotrustbot removed the S-waiting-on-review Status: The marked PR is awaiting review from a maintainer label May 7, 2026
@tshepang
tshepang deleted the place-definition-in-glossary branch May 7, 2026 12:26
Sign up for freeto 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.

4 participants

@tshepang@ehuss@RalfJung@rustbot