Skip to content

Commit e140689

Browse files
committed
Document how to stabilize a library feature
1 parent b9b5d69 commit e140689

File tree

2 files changed

+22
-5
lines changed

2 files changed

+22
-5
lines changed

src/stability.md

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,8 @@ prevents breaking dependencies by leveraging Cargo's lint capping.
4444
[rustc bug]: https://github.com/rust-lang/rust/issues/15702
4545

4646
## stable
47-
4847
The `#[stable(feature = "foo", "since = "1.420.69")]` attribute explicitly
49-
marks an item as stabilized. To do this, follow the instructions in
50-
[Stabilizing Features](./stabilization_guide.md).
51-
52-
Note that stable functions may use unstable things in their body.
48+
marks an item as stabilized. Note that stable functions may use unstable things in their body.
5349

5450
## rustc_const_unstable
5551

@@ -72,6 +68,22 @@ even on an `unstable` function, if that function is called from another
7268
Furthermore this attribute is needed to mark an intrinsic as callable from
7369
`rustc_const_stable` functions.
7470

71+
## Stabilizing a library feature
72+
73+
To stabilize a feature, follow these steps:
74+
75+
1. Change `#[unstable]` to `#[stable(since = "version")]`.
76+
`version` should be the *currently nightly*, i.e. stable+2. You can see which version is
77+
currently nightly [on Forge](https://forge.rust-lang.org/#current-release-versions).
78+
2. Remove `#![feature]` from any test or doc-test for this API. If the feature is used in the
79+
compiler or tools, remove it from there as well.
80+
3. If applicable, change `#[rustc_const_unstable]` to `#[rustc_const_stable(since = "version")]`.
81+
4. Open a PR against `rust-lang/rust`
82+
- Add the appropriate labels: `@rustbot modify labels: +T-libs +needs-fcp`.
83+
- Include a description of the feature and why it should be stabilized.
84+
- Link to the tracking issue and say "Closes #XXXXX".
85+
86+
You can see an example of stabilizing a feature at [#75132](https://github.com/rust-lang/rust/pull/75132).
7587

7688
## allow_internal_unstable
7789

src/stabilization_guide.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Request for stabilization
22

3+
**NOTE**: this page is about stabilizing language features.
4+
For stabilizing library features, see [Stabilizing a library feature].
5+
6+
[Stabilizing a library feature]: ./stability.md#stabilizing-a-library-feature
7+
38
Once an unstable feature has been well-tested with no outstanding
49
concern, anyone may push for its stabilization. It involves the
510
following steps:

0 commit comments

Comments
 (0)