Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update const stability docs #2111

Merged
merged 1 commit into from
Nov 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions src/stability.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,6 @@ ipsum")]` has the same interface as the `unstable` attribute. It is used to mark
(The compiler will tell you to add the attribute if you run into this.)
- If a `const fn` is `#[stable]` but not yet intended to be const-stable.

Furthermore, this attribute is needed to mark an intrinsic as an *unstable* `const fn`, because
there's no way to add `const` to functions in `extern` blocks for now.

Const-stability differs from regular stability in that it is *recursive*: a
`#[rustc_const_unstable(...)]` function cannot even be indirectly called from stable code. This is
to avoid accidentally leaking unstable compiler implementation artifacts to stable code or locking
Expand All @@ -82,6 +79,8 @@ compiler features); the only reason it is not const-stable yet are API concerns.
This should also be added to lang items for which const-calls are synthesized in the compiler, to
ensure those calls do not bypass recursive const stability rules.

## rustc_const_stable_intrinsic

On an intrinsic, this attribute marks the intrinsic as "ready to be used by public stable functions".
The `rustc_const_unstable` can be removed when this attribute is added.
**Adding this attribute to an intrinsic requires t-lang and wg-const-eval approval!**
Expand Down