Skip to content

MaybeDangling: ensure references fit inside the address space - #160749

Open
RalfJung wants to merge 1 commit into
rust-lang:mainfrom
RalfJung:maybe-dangling-address-space
Open

MaybeDangling: ensure references fit inside the address space#160749
RalfJung wants to merge 1 commit into
rust-lang:mainfrom
RalfJung:maybe-dangling-address-space

Conversation

@RalfJung

@RalfJung RalfJung commented Aug 8, 2026

Copy link
Copy Markdown
Member

In the RFC we left open the question of the exact validity invariant for references inside MaybeDangling. This PR implements the strictest invariant I can think of: we already require references to be aligned, now we also require "addr + size" to be computable without overflow. This ensures that whatever niches we add to references in the future, MaybeDangling preserves those niches.

Cc @rust-lang/opsem @WaffleLapkin

Tracking issue: #118166
r? @oli-obk

  • I did not use an LLM to create a change in this PR.
  • I used an LLM to create a change in this PR, and I have explained below how it was used.

@rustbot

rustbot commented Aug 8, 2026

Copy link
Copy Markdown
Collaborator

Some changes occurred to the CTFE / Miri interpreter

cc @rust-lang/miri

miri is developed in its own repository. If the Miri part of this change can be broken out, consider making this change to rust-lang/miri instead. However, if Miri needs adjusting for rustc changes, just ignore this message.

cc @rust-lang/miri

Some changes occurred to the CTFE machinery

cc @oli-obk, @lcnr

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Aug 8, 2026

@CAD97 CAD97 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is the obvious validity requirement, making the relaxation for MaybeDangling simply what's required for the nominal effect. LGTM

r+ (but I don't have r+ perms)

View changes since this review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants