Skip to content

Lower field projections through temporary pointers - #1627

Merged
sbillig merged 1 commit into
masterfrom
fix/temporary-pointer-field-projection
Sep 30, 2026
Merged

sbillig merged 1 commit into
masterfrom
fix/temporary-pointer-field-projection

Conversation

@cburgdorf

Copy link
Copy Markdown
Collaborator

A field of a pointer-valued temporary, such as orders.ptr_at(0).n, has no binding-based Place. Semantic lowering fell back to a value projection of the pointer itself, which normalization rejected as an invalid projection (internal borrow checking error 16-0004), and type checking rejected assignments to it as not assignable.

  • try_lower_place resolves the field like Place::from_expr_in_body does and dereferences the pointer temporary (or a pointer field of a temporary-rooted place) before selecting the field.
  • Assignment checking and SMIR lowering readiness accept such pointer projections, like explicit *ptr targets.
  • A mutably borrowed receiver, as used by compound assignment, borrows the projected pointee instead of a copied temporary.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-29T22:11:52.156668Z 43873b5 New commits
🔒 Security Review ✅ Completed 2026-09-29T22:12:14.177160Z 43873b5 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1188871b44

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@cburgdorf
cburgdorf force-pushed the fix/temporary-pointer-field-projection branch from 1188871 to 7b64045 Compare September 29, 2026 15:09

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7b64045df0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

The lowering and type checking for places reached through a temporary
pointer landed on master (#1633, #1634). Keep this branch's extra
coverage on top of it:

- `temporary_pointer_field.fe` exercises reads, writes, compound
  assignment and explicit `mut`/`ref` borrows of fields reached through
  pointer-returning calls such as `orders.ptr_at(0).n`, including
  chained `ptr_at` calls and pointer fields of temporaries.
- `borrow_custom_index_through_pointer.fe` pins that a built-in array
  element below a temporary pointer is borrowable, while a custom
  `Index` call below one is still rejected as a non-place.
@cburgdorf
cburgdorf force-pushed the fix/temporary-pointer-field-projection branch from 7b64045 to 43873b5 Compare September 29, 2026 22:09
@cburgdorf
cburgdorf requested a review from sbillig September 30, 2026 06:16
@sbillig
sbillig merged commit 932e970 into master Sep 30, 2026
9 checks passed
@sbillig
sbillig deleted the fix/temporary-pointer-field-projection branch September 30, 2026 22:38
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.

2 participants