Skip to content

Fix gap in const stability checks around intrinsics - #162409

Merged
rust-bors[bot] merged 3 commits into
rust-lang:mainfrom
RalfJung:intrinsic-const-stab
Sep 14, 2026
Merged

rust-bors[bot] merged 3 commits into
rust-lang:mainfrom
RalfJung:intrinsic-const-stab

Conversation

@RalfJung

@RalfJung RalfJung commented Sep 7, 2026 •

Copy link
Copy Markdown
Member

@N1ark managed to find a gap in our const stability checks around intrinsics. This PR fixes that gap.

Sadly the standard library already relies on the gap, so for now I added a rustc_allow_const_fn_unstable but that attribute usually needs some process to be approved.

Also fixes #150961 by properly supporting & testing rustc_do_not_const_check on intrinsics.

@rustbot

rustbot commented Sep 7, 2026

Copy link
Copy Markdown
Collaborator

⚠️ #[rustc_allow_const_fn_unstable] needs careful audit to avoid accidentally exposing unstable
implementation details on stable.

cc @rust-lang/wg-const-eval

Some changes occurred to constck

cc @fee1-dead

Some changes occurred to the CTFE machinery

cc @oli-obk, @lcnr

Some changes occurred to the intrinsics. Make sure the CTFE / Miri interpreter
gets adapted for the changes, if necessary.

cc @rust-lang/miri, @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. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Sep 7, 2026
@rustbot

rustbot commented Sep 7, 2026

Copy link
Copy Markdown
Collaborator

r? @mati865

rustbot has assigned @mati865.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 75 candidates
  • Random selection from 21 candidates

@N1ark

N1ark commented Sep 7, 2026

Copy link
Copy Markdown
Member

sorry about that 😓

Comment thread compiler/rustc_const_eval/src/check_consts/mod.rs Outdated
@RalfJung
RalfJung force-pushed the intrinsic-const-stab branch from 2d64547 to bc0851a Compare September 7, 2026 09:17
@RalfJung

RalfJung commented Sep 7, 2026

Copy link
Copy Markdown
Member Author

sorry about that 😓

It was me who introduced this bug, you just found it. ;)

@RalfJung
RalfJung force-pushed the intrinsic-const-stab branch from bc0851a to b3a8050 Compare September 7, 2026 09:22
@rust-log-analyzer

This comment has been minimized.

@RalfJung
RalfJung force-pushed the intrinsic-const-stab branch from b3a8050 to 9d60be8 Compare September 7, 2026 09:30
@rust-log-analyzer

This comment has been minimized.

@RalfJung
RalfJung force-pushed the intrinsic-const-stab branch from 9d60be8 to 022d14a Compare September 7, 2026 10:15
Comment thread library/core/src/intrinsics/mod.rs Outdated
@RalfJung
RalfJung force-pushed the intrinsic-const-stab branch 2 times, most recently from 4896f11 to 64752fb Compare September 7, 2026 10:28
@mati865

mati865 commented Sep 7, 2026

Copy link
Copy Markdown
Member

@rustbot reroll

@rustbot rustbot assigned fee1-dead and unassigned mati865 Sep 7, 2026
@RalfJung
RalfJung force-pushed the intrinsic-const-stab branch 3 times, most recently from a6cc2c2 to 3bbe9af Compare September 8, 2026 07:42
@RalfJung
RalfJung force-pushed the intrinsic-const-stab branch from 3bbe9af to fb46c1d Compare September 8, 2026 07:43
@RalfJung

Copy link
Copy Markdown
Member Author

r? @oli-obk

@rustbot rustbot assigned oli-obk and unassigned fee1-dead Sep 14, 2026

@oli-obk oli-obk 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.

@bors r+

oh fun... so much nuance. I hope we'll reach the point where const stability is not really a common thing anymore soon

View changes since this review

@rust-bors

rust-bors Bot commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

📌 Commit fb46c1d has been approved by oli-obk

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 Sep 14, 2026
@rust-bors

rust-bors Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

⌛ Testing commit fb46c1d with merge 903b7fc...

Workflow: https://github.com/rust-lang/rust/actions/runs/34868907183

rust-bors Bot pushed a commit that referenced this pull request Sep 14, 2026
Fix gap in const stability checks around intrinsics

@N1ark managed to find a gap in our const stability checks around intrinsics. This PR fixes that gap.

Sadly the standard library already relies on the gap, so for now I added a `rustc_allow_const_fn_unstable` but that attribute usually needs some process to be approved.

Also fixes #150961 by properly supporting & testing `rustc_do_not_const_check` on intrinsics.
@JonathanBrouwer

Copy link
Copy Markdown
Member

@bors yield
Yielding to enclosing rollup

@rust-bors

rust-bors Bot commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Auto build was cancelled. Cancelled workflows:

The next pull request likely to be tested is #162775.

rust-bors Bot pushed a commit that referenced this pull request Sep 14, 2026
…uwer

Rollup of 3 pull requests

Successful merges:

 - #162409 (Fix gap in const stability checks around intrinsics)
 - #162763 (Remove `Box::into_unique`)
 - #162766 (stop unleaking `&mut`s in std and the compiler)
@rust-bors
rust-bors Bot merged commit 727e080 into rust-lang:main Sep 14, 2026
13 of 14 checks passed
rust-bors Bot pushed a commit that referenced this pull request Sep 14, 2026
Rollup merge of #162409 - RalfJung:intrinsic-const-stab, r=oli-obk

Fix gap in const stability checks around intrinsics

@N1ark managed to find a gap in our const stability checks around intrinsics. This PR fixes that gap.

Sadly the standard library already relies on the gap, so for now I added a `rustc_allow_const_fn_unstable` but that attribute usually needs some process to be approved.

Also fixes #150961 by properly supporting & testing `rustc_do_not_const_check` on intrinsics.
@rustbot rustbot added this to the 1.100.0 milestone Sep 14, 2026
pull Bot pushed a commit to LeeeeeeM/miri that referenced this pull request Sep 15, 2026
…uwer

Rollup of 3 pull requests

Successful merges:

 - rust-lang/rust#162409 (Fix gap in const stability checks around intrinsics)
 - rust-lang/rust#162763 (Remove `Box::into_unique`)
 - rust-lang/rust#162766 (stop unleaking `&mut`s in std and the compiler)
@rust-timer

Copy link
Copy Markdown
Collaborator

Note

This PR was benchmarked as part of triage of its containing rollup: triage URL.

Finished benchmarking commit (537ff44): comparison URL.

Overall result: ❌ regressions - no action needed

@rustbot label: -perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
0.3% [0.3%, 0.3%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Max RSS (memory usage)

This perf run didn't have relevant results for this metric.

Cycles

This perf run didn't have relevant results for this metric.

Binary size

Results (secondary -0.1%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.1% [-0.1%, -0.1%] 3
All ❌✅ (primary) - - 0

Bootstrap: missing data
Artifact size: 406.86 MiB -> 408.85 MiB (0.49%)

@RalfJung
RalfJung deleted the intrinsic-const-stab branch September 16, 2026 06:03
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. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Intrinsics should allow a non-const fallback body if hooked for CTFE

9 participants