Skip to content

Fix gap in const stability checks around intrinsics - #162409

Open
RalfJung wants to merge 2 commits into
rust-lang:mainfrom
RalfJung:intrinsic-const-stab
Open

Fix gap in const stability checks around intrinsics#162409
RalfJung wants to merge 2 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.

@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
#[rustc_intrinsic_const_stable_indirect]
#[rustc_intrinsic]
#[miri::intrinsic_fallback_is_spec]
#[rustc_allow_const_fn_unstable(const_ops, const_trait_impl, core_intrinsics)] // FIXME these got accidentally exposed

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The interpreter has an implementation for this, right? So we can just use do_not_const_check.

@RalfJung
RalfJung force-pushed the intrinsic-const-stab branch from 4896f11 to 64752fb Compare September 7, 2026 10:28
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. 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.

5 participants