Skip to content

Commit

Permalink
Introduce rustc_const_stable and explain rustc_const_unstable (#542)
Browse files Browse the repository at this point in the history
  • Loading branch information
oli-obk authored and Centril committed Dec 24, 2019
1 parent 846743c commit c461c85
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/stability.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,28 @@ marks an item as stabilized. To do this, follow the instructions in

Note that stable functions may use unstable things in their body.

## rustc_const_unstable

The `#[rustc_const_unstable(feature = "foo", issue = "1234", reason = "lorem ipsum")]`
has the same interface as the `unstable` attribute. It is used to mark
`const fn` as having their constness be unstable. This allows you to make a
function stable without stabilizing its constness or even just marking an existing
stable function as `const fn` without instantly stabilizing the `const fn`ness.

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

## rustc_const_stable

The `#[stable(feature = "foo", "since = "1.420.69")]` attribute explicitly marks
a `const fn` as having its constness be `stable`. This attribute can make sense
even on an `unstable` function, if that function is called from another
`rustc_const_stable` function.

Furthermore this attribute is needed to mark an intrinsic as callable from
`rustc_const_stable` functions.


## allow_internal_unstable

Macros, compiler desugarings and `const fn`s expose their bodies to the call
Expand Down

0 comments on commit c461c85

Please sign in to comment.