Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document behavior of multiple stability attributes on items #2128

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/stability.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ The `issue` field specifies the associated GitHub [issue number]. This field is
required and all unstable features should have an associated tracking issue. In
rare cases where there is no sensible value `issue = "none"` is used.

An item may be annotated with multiple `#[unstable]` attributes if its
stabilization depends on multiple features being stabilized.
In that case, it cannot be used without enabling each feature present in its
`#[unstable]` attributes.

The `unstable` attribute infects all sub-items, where the attribute doesn't
have to be reapplied. So if you apply this to a module, all items in the module
will be unstable.
Expand All @@ -47,7 +52,12 @@ prevents breaking dependencies by leveraging Cargo's lint capping.

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

Note that stable functions may use unstable things in their body.

## rustc_const_unstable

Expand Down