Skip to content

Commit bbbf666

Browse files
authored
Merge pull request #311 from rust-lang/KodrAus/std-docs-updates
Stabilizing const functions
2 parents 60d9e5f + 43210f5 commit bbbf666

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/libs/maintaining-std.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -197,10 +197,6 @@ Changes to hot code might impact performance in consumers, for better or for wor
197197

198198
PRs shouldn’t have merge commits in them. If they become out of date with `master` then they need to be rebased.
199199

200-
### Are functions const-stabilized or constified?
201-
202-
Please CC `@rust-lang/wg-const-eval`.
203-
204200
## Merging PRs
205201

206202
PRs to [`rust-lang/rust`] aren’t merged manually using GitHub’s UI or by pushing remote branches. Everything goes through [`bors`].
@@ -227,8 +223,17 @@ Features can be stabilized in a PR that replaces `#[unstable]` attributes with `
227223

228224
You can find the right version to use in the `#[stable]` attribute by checking the [Forge].
229225

226+
### When a `const` function is being stabilized
227+
228+
Const functions can be stabilized in a PR that replaces `#[rustc_const_unstable]` attributes with `#[rustc_const_stable]` ones. The [Constant Evaluation WG] should be pinged for input on whether or not the `const`-ness is something we want to commit to. If it is an intrinsic being exposed that is const-stabilized then `@rust-lang/lang` should also be included in the FCP.
229+
230+
Check whether the function internally depends on other unstable `const` functions through `#[allow_internal_unstable]` attributes and consider how the function could be implemented if its internally unstable calls were removed. See the _Stability attributes_ page for more details on `#[allow_internal_unstable]`.
231+
232+
Where `unsafe` and `const` is involved, e.g., for operations which are "unconst", that the const safety argument for the usage also be documented. That is, a `const fn` has additional determinism (e.g. run-time/compile-time results must correspond and the function's output only depends on its inputs...) restrictions that must be preserved, and those should be argued when `unsafe` is used.
233+
230234
[API Guidelines]: https://rust-lang.github.io/api-guidelines
231235
[Unsafe Code Guidelines WG]: https://github.com/rust-lang/unsafe-code-guidelines
236+
[Constant Evaluation WG]: https://github.com/rust-lang/const-eval
232237
[`rust-lang/rust`]: https://github.com/rust-lang/rust
233238
[`rust-lang/rfcs`]: https://github.com/rust-lang/rfcs
234239
[`rust-lang/rust-forge`]: https://github.com/rust-lang/rust-forge

0 commit comments

Comments
 (0)