Skip to content

Commit b2fa25c

Browse files
Explain constification process
1 parent cbbfaa6 commit b2fa25c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

posts/inside-rust/2019-11-23-const-if-match.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,12 @@ be [feature-gated separately][52000], and the `?` operator, which calls
7878
This change will allow a great number of standard library functions to be made
7979
`const`. You can help with this process! To get started, here's a [list of
8080
numeric functions][const-int] that can be constified with little effort.
81+
Conversion to a `const fn` requires two steps. First, `const` is added to a
82+
function definition along with a `#[rustc_const_unstable]` attribute. This
83+
allows nightly users to call it in a const context. Then, after a period of
84+
experimentation, the attribute is removed and the constness of that function is
85+
stabilized. See [#61635] for an example of the first step and [#64028] for an
86+
example of the second.
8187

8288
Personally, I've looked forward to this feature for a long time, and I can't
8389
wait to start playing with it. If you feel the same, I would greatly
@@ -87,6 +93,8 @@ stack with poorly implemented recursive functions (see `gcd` above), and let
8793
us know if something goes horribly wrong.
8894

8995
[const-int]: https://github.com/rust-lang/rust/issues/53718
96+
[#61635]: https://github.com/rust-lang/rust/issues/61635
97+
[#64028]: https://github.com/rust-lang/rust/pull/64028
9098

9199
## What took you so long?
92100

0 commit comments

Comments
 (0)