Skip to content

Commit b1f4417

Browse files
committed
Document behavior of multiple stability attributes on items
1 parent 59816a0 commit b1f4417

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/stability.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ The `issue` field specifies the associated GitHub [issue number]. This field is
2121
required and all unstable features should have an associated tracking issue. In
2222
rare cases where there is no sensible value `issue = "none"` is used.
2323

24+
An item may be annotated with multiple `#[unstable]` attributes if its
25+
stabilization depends on multiple features being stabilized.
26+
In that case, it cannot be used without enabling each feature present in its
27+
`#[unstable]` attributes.
28+
2429
The `unstable` attribute infects all sub-items, where the attribute doesn't
2530
have to be reapplied. So if you apply this to a module, all items in the module
2631
will be unstable.
@@ -47,7 +52,12 @@ prevents breaking dependencies by leveraging Cargo's lint capping.
4752

4853
## stable
4954
The `#[stable(feature = "foo", since = "1.420.69")]` attribute explicitly
50-
marks an item as stabilized. Note that stable functions may use unstable things in their body.
55+
marks an item as stabilized. However, `#[unstable]` attributes take precedence:
56+
an item with both `#[stable]` and `#[unstable]` attributes is unstable.
57+
A stable item with multiple `#[stable]` attributes is treated as stabilized in
58+
the most recent version present in the attributes' `since` fields.
59+
60+
Note that stable functions may use unstable things in their body.
5161

5262
## rustc_const_unstable
5363

0 commit comments

Comments
 (0)