Skip to content

Commit c461c85

Browse files
oli-obkCentril
authored andcommitted
Introduce rustc_const_stable and explain rustc_const_unstable (#542)
1 parent 846743c commit c461c85

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/stability.md

+22
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,28 @@ marks an item as stabilized. To do this, follow the instructions in
4949

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

52+
## rustc_const_unstable
53+
54+
The `#[rustc_const_unstable(feature = "foo", issue = "1234", reason = "lorem ipsum")]`
55+
has the same interface as the `unstable` attribute. It is used to mark
56+
`const fn` as having their constness be unstable. This allows you to make a
57+
function stable without stabilizing its constness or even just marking an existing
58+
stable function as `const fn` without instantly stabilizing the `const fn`ness.
59+
60+
Furthermore this attribute is needed to mark an intrinsic as `const fn`, because
61+
there's no way to add `const` to functions in `extern` blocks for now.
62+
63+
## rustc_const_stable
64+
65+
The `#[stable(feature = "foo", "since = "1.420.69")]` attribute explicitly marks
66+
a `const fn` as having its constness be `stable`. This attribute can make sense
67+
even on an `unstable` function, if that function is called from another
68+
`rustc_const_stable` function.
69+
70+
Furthermore this attribute is needed to mark an intrinsic as callable from
71+
`rustc_const_stable` functions.
72+
73+
5274
## allow_internal_unstable
5375

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

0 commit comments

Comments
 (0)