Skip to content

const validity checking: do not recurse to references inside MaybeDangling#154093

Merged
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
RalfJung:validity-maybedangling
Mar 24, 2026
Merged

const validity checking: do not recurse to references inside MaybeDangling#154093
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
RalfJung:validity-maybedangling

Conversation

@RalfJung
Copy link
Member

This arguably should be allowed, but we currently reject it:

#![feature(maybe_dangling)]
use std::mem::MaybeDangling;

const X: MaybeDangling<&bool> = unsafe { std::mem::transmute(&5u8) };

r? @WaffleLapkin

@rustbot
Copy link
Collaborator

rustbot commented Mar 19, 2026

Some changes occurred to the CTFE machinery

cc @oli-obk, @lcnr

Some changes occurred to the CTFE / Miri interpreter

cc @rust-lang/miri

@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 Mar 19, 2026
@rustbot
Copy link
Collaborator

rustbot commented Mar 19, 2026

WaffleLapkin is not on the review rotation at the moment.
They may take a while to respond.

@rust-log-analyzer

This comment was marked as resolved.

@WaffleLapkin
Copy link
Member

@bors r+

@rust-bors
Copy link
Contributor

rust-bors bot commented Mar 23, 2026

📌 Commit b3e4ebd has been approved by WaffleLapkin

It is now in the queue for this repository.

@rust-bors rust-bors bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 23, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Mar 23, 2026
…=WaffleLapkin

const validity checking: do not recurse to references inside MaybeDangling

This arguably should be allowed, but we currently reject it:
```rust
#![feature(maybe_dangling)]
use std::mem::MaybeDangling;

const X: MaybeDangling<&bool> = unsafe { std::mem::transmute(&5u8) };
```

r? @WaffleLapkin
rust-bors bot pushed a commit that referenced this pull request Mar 23, 2026
…uwer

Rollup of 8 pull requests

Successful merges:

 - #122668 (Add APIs for dealing with titlecase)
 - #153041 (Remove `ATTRIBUTE_ORDER`)
 - #153912 (Avoid prematurely choosing a glob import)
 - #154093 (const validity checking: do not recurse to references inside MaybeDangling)
 - #154257 (Revert eagerly normalize in generalize)
 - #154179 (tests/ui/async-await/gat-is-send-across-await.rs: New regression test)
 - #154224 (Remove more `BuiltinLintDiag` variants)
 - #154245 (Allow applying autodiff macros to trait functions.)
@rust-bors rust-bors bot merged commit 62a3eab into rust-lang:main Mar 24, 2026
17 of 22 checks passed
@rustbot rustbot added this to the 1.96.0 milestone Mar 24, 2026
@RalfJung RalfJung deleted the validity-maybedangling branch March 24, 2026 07:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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