Auto merge of #95960 - jhpratt:remove-rustc_deprecated, r=compiler-errors

Remove `#[rustc_deprecated]`

This removes `#[rustc_deprecated]` and introduces diagnostics to help users to the right direction (that being `#[deprecated]`). All uses of `#[rustc_deprecated]` have been converted. CI is expected to fail initially; this requires #95958, which includes converting `stdarch`.

I plan on following up in a short while (maybe a bootstrap cycle?) removing the diagnostics, as they're only intended to be short-term.
This commit is contained in:
bors 2022-05-09 04:47:30 +00:00
commit 8a2fe75d0e
98 changed files with 406 additions and 437 deletions

View file

@ -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() {}

View file

@ -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() {}
```

View file

@ -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() {}
```

View file

@ -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() {}
```

View file

@ -1,8 +1,10 @@
#### Note: this error code is no longer emitted by the compiler
More than one `deprecated` attribute has been put on an item.
Erroneous code example:
```compile_fail,E0550
```compile_fail
#[deprecated(note = "because why not?")]
#[deprecated(note = "right?")] // error!
fn the_banished() {}

View file

@ -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(){}