Remove section on stability levels from reference
Obsolete, no replacement. The mechanics here are mostly implementation details at this point.
This commit is contained in:
parent
47905f98ee
commit
761efa5e8c
@ -2493,77 +2493,6 @@ Supported traits for `derive` are:
|
||||
* `Show`, to format a value using the `{}` formatter.
|
||||
* `Zero`, to create a zero instance of a numeric data type.
|
||||
|
||||
### Stability
|
||||
|
||||
One can indicate the stability of an API using the following attributes:
|
||||
|
||||
* `deprecated`: This item should no longer be used, e.g. it has been
|
||||
replaced. No guarantee of backwards-compatibility.
|
||||
* `experimental`: This item was only recently introduced or is
|
||||
otherwise in a state of flux. It may change significantly, or even
|
||||
be removed. No guarantee of backwards-compatibility.
|
||||
* `unstable`: This item is still under development, but requires more
|
||||
testing to be considered stable. No guarantee of backwards-compatibility.
|
||||
* `stable`: This item is considered stable, and will not change
|
||||
significantly. Guarantee of backwards-compatibility.
|
||||
* `frozen`: This item is very stable, and is unlikely to
|
||||
change. Guarantee of backwards-compatibility.
|
||||
* `locked`: This item will never change unless a serious bug is
|
||||
found. Guarantee of backwards-compatibility.
|
||||
|
||||
These levels are directly inspired by
|
||||
[Node.js' "stability index"](http://nodejs.org/api/documentation.html).
|
||||
|
||||
Stability levels are inherited, so an item's stability attribute is the default
|
||||
stability for everything nested underneath it.
|
||||
|
||||
There are lints for disallowing items marked with certain levels: `deprecated`,
|
||||
`experimental` and `unstable`. For now, only `deprecated` warns by default, but
|
||||
this will change once the standard library has been stabilized. Stability
|
||||
levels are meant to be promises at the crate level, so these lints only apply
|
||||
when referencing items from an _external_ crate, not to items defined within
|
||||
the current crate. Items with no stability level are considered to be unstable
|
||||
for the purposes of the lint. One can give an optional string that will be
|
||||
displayed when the lint flags the use of an item.
|
||||
|
||||
For example, if we define one crate called `stability_levels`:
|
||||
|
||||
```{.ignore}
|
||||
#[deprecated="replaced by `best`"]
|
||||
pub fn bad() {
|
||||
// delete everything
|
||||
}
|
||||
|
||||
pub fn better() {
|
||||
// delete fewer things
|
||||
}
|
||||
|
||||
#[stable]
|
||||
pub fn best() {
|
||||
// delete nothing
|
||||
}
|
||||
```
|
||||
|
||||
then the lints will work as follows for a client crate:
|
||||
|
||||
```{.ignore}
|
||||
#![warn(unstable)]
|
||||
extern crate stability_levels;
|
||||
use stability_levels::{bad, better, best};
|
||||
|
||||
fn main() {
|
||||
bad(); // "warning: use of deprecated item: replaced by `best`"
|
||||
|
||||
better(); // "warning: use of unmarked item"
|
||||
|
||||
best(); // no warning
|
||||
}
|
||||
```
|
||||
|
||||
> **Note:** Currently these are only checked when applied to individual
|
||||
> functions, structs, methods and enum variants, *not* to entire modules,
|
||||
> traits, impls or enums themselves.
|
||||
|
||||
### Compiler Features
|
||||
|
||||
Certain aspects of Rust may be implemented in the compiler, but they're not
|
||||
|
Loading…
Reference in New Issue
Block a user