diff options
| author | Oliver Scherer <github35764891676564198441@oli-obk.de> | 2019-12-24 01:16:23 +0100 |
|---|---|---|
| committer | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-12-24 01:16:23 +0100 |
| commit | 11cc47efec1808b2f52daa76bcc7b9ead78d881f (patch) | |
| tree | bff6bfab707e48f8d9abc340135682526cfba318 /src/doc/rustc-dev-guide | |
| parent | a57693df70e13e20b19b094d7b993f60ddf28536 (diff) | |
| download | rust-11cc47efec1808b2f52daa76bcc7b9ead78d881f.tar.gz rust-11cc47efec1808b2f52daa76bcc7b9ead78d881f.zip | |
Introduce `rustc_const_stable` and explain `rustc_const_unstable` (#542)
Diffstat (limited to 'src/doc/rustc-dev-guide')
| -rw-r--r-- | src/doc/rustc-dev-guide/src/stability.md | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/doc/rustc-dev-guide/src/stability.md b/src/doc/rustc-dev-guide/src/stability.md index 292d88813a1..f48c3d529dd 100644 --- a/src/doc/rustc-dev-guide/src/stability.md +++ b/src/doc/rustc-dev-guide/src/stability.md @@ -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 |
