Update error code docs
This commit is contained in:
@@ -6,7 +6,7 @@ Erroneous code example:
|
||||
#![feature(staged_api)]
|
||||
#![stable(since = "1.0.0", feature = "test")]
|
||||
|
||||
#[rustc_deprecated(reason)] // error!
|
||||
#[deprecated(note)] // error!
|
||||
#[unstable(feature = "deprecated_fn", issue = "123")]
|
||||
fn deprecated() {}
|
||||
|
||||
@@ -30,7 +30,7 @@ To fix these issues you need to give required key-value pairs.
|
||||
#![feature(staged_api)]
|
||||
#![stable(since = "1.0.0", feature = "test")]
|
||||
|
||||
#[rustc_deprecated(since = "1.39.0", reason = "reason")] // ok!
|
||||
#[deprecated(since = "1.39.0", note = "reason")] // ok!
|
||||
#[unstable(feature = "deprecated_fn", issue = "123")]
|
||||
fn deprecated() {}
|
||||
|
||||
|
||||
@@ -13,8 +13,8 @@ fn _stable_fn() {}
|
||||
const fn _stable_const_fn() {}
|
||||
|
||||
#[stable(feature = "_deprecated_fn", since = "0.1.0")]
|
||||
#[rustc_deprecated(
|
||||
reason = "explanation for deprecation"
|
||||
#[deprecated(
|
||||
note = "explanation for deprecation"
|
||||
)] // invalid
|
||||
fn _deprecated_fn() {}
|
||||
```
|
||||
@@ -32,9 +32,9 @@ fn _stable_fn() {}
|
||||
const fn _stable_const_fn() {}
|
||||
|
||||
#[stable(feature = "_deprecated_fn", since = "0.1.0")]
|
||||
#[rustc_deprecated(
|
||||
#[deprecated(
|
||||
since = "1.0.0",
|
||||
reason = "explanation for deprecation"
|
||||
note = "explanation for deprecation"
|
||||
)] // ok!
|
||||
fn _deprecated_fn() {}
|
||||
```
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
The `reason` value is missing in a stability attribute.
|
||||
The `note` value is missing in a stability attribute.
|
||||
|
||||
Erroneous code example:
|
||||
|
||||
@@ -7,22 +7,22 @@ Erroneous code example:
|
||||
#![stable(since = "1.0.0", feature = "test")]
|
||||
|
||||
#[stable(since = "0.1.0", feature = "_deprecated_fn")]
|
||||
#[rustc_deprecated(
|
||||
#[deprecated(
|
||||
since = "1.0.0"
|
||||
)] // invalid
|
||||
fn _deprecated_fn() {}
|
||||
```
|
||||
|
||||
To fix this issue, you need to provide the `reason` field. Example:
|
||||
To fix this issue, you need to provide the `note` field. Example:
|
||||
|
||||
```
|
||||
#![feature(staged_api)]
|
||||
#![stable(since = "1.0.0", feature = "test")]
|
||||
|
||||
#[stable(since = "0.1.0", feature = "_deprecated_fn")]
|
||||
#[rustc_deprecated(
|
||||
#[deprecated(
|
||||
since = "1.0.0",
|
||||
reason = "explanation for deprecation"
|
||||
note = "explanation for deprecation"
|
||||
)] // ok!
|
||||
fn _deprecated_fn() {}
|
||||
```
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
A `rustc_deprecated` attribute wasn't paired with a `stable`/`unstable`
|
||||
attribute.
|
||||
A `deprecated` attribute wasn't paired with a `stable`/`unstable` attribute with
|
||||
`#![feature(staged_api)]` enabled.
|
||||
|
||||
Erroneous code example:
|
||||
|
||||
@@ -7,9 +7,9 @@ Erroneous code example:
|
||||
#![feature(staged_api)]
|
||||
#![stable(since = "1.0.0", feature = "test")]
|
||||
|
||||
#[rustc_deprecated(
|
||||
#[deprecated(
|
||||
since = "1.0.1",
|
||||
reason = "explanation for deprecation"
|
||||
note = "explanation for deprecation"
|
||||
)] // invalid
|
||||
fn _deprecated_fn() {}
|
||||
```
|
||||
@@ -22,9 +22,9 @@ Example:
|
||||
#![stable(since = "1.0.0", feature = "test")]
|
||||
|
||||
#[stable(since = "1.0.0", feature = "test")]
|
||||
#[rustc_deprecated(
|
||||
#[deprecated(
|
||||
since = "1.0.1",
|
||||
reason = "explanation for deprecation"
|
||||
note = "explanation for deprecation"
|
||||
)] // ok!
|
||||
fn _deprecated_fn() {}
|
||||
```
|
||||
|
||||
@@ -3,7 +3,6 @@ A stability attribute has been used outside of the standard library.
|
||||
Erroneous code example:
|
||||
|
||||
```compile_fail,E0734
|
||||
#[rustc_deprecated(since = "b", reason = "text")] // invalid
|
||||
#[stable(feature = "a", since = "b")] // invalid
|
||||
#[unstable(feature = "b", issue = "none")] // invalid
|
||||
fn foo(){}
|
||||
|
||||
Reference in New Issue
Block a user