Skip to content

Commit

Permalink
update const stability docs (#2111)
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung authored Nov 5, 2024
1 parent 36f61df commit 59816a0
Showing 1 changed file with 2 additions and 3 deletions.
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

0 comments on commit 59816a0

Please sign in to comment.