Skip to content

Commit 3266eb2

Browse files
authored
Rollup merge of rust-lang#82246 - jesusprubio:add-long-explanation-e0549, r=GuillaumeGomez
Add long explanation for E0549 Helps with rust-lang#61137
2 parents 7d75a22 + 3c4fe1e commit 3266eb2

File tree

3 files changed

+39
-4
lines changed

3 files changed

+39
-4
lines changed

compiler/rustc_error_codes/src/error_codes.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,7 @@ E0543: include_str!("./error_codes/E0543.md"),
290290
E0545: include_str!("./error_codes/E0545.md"),
291291
E0546: include_str!("./error_codes/E0546.md"),
292292
E0547: include_str!("./error_codes/E0547.md"),
293+
E0549: include_str!("./error_codes/E0549.md"),
293294
E0550: include_str!("./error_codes/E0550.md"),
294295
E0551: include_str!("./error_codes/E0551.md"),
295296
E0552: include_str!("./error_codes/E0552.md"),
@@ -608,9 +609,6 @@ E0781: include_str!("./error_codes/E0781.md"),
608609
// E0540, // multiple rustc_deprecated attributes
609610
E0544, // multiple stability levels
610611
// E0548, // replaced with a generic attribute input check
611-
// rustc_deprecated attribute must be paired with either stable or unstable
612-
// attribute
613-
E0549,
614612
E0553, // multiple rustc_const_unstable attributes
615613
// E0555, // replaced with a generic attribute input check
616614
// E0558, // replaced with a generic attribute input check
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
A `rustc_deprecated` attribute wasn't paired with a `stable`/`unstable`
2+
attribute.
3+
4+
Erroneous code example:
5+
6+
```compile_fail,E0549
7+
#![feature(staged_api)]
8+
#![stable(since = "1.0.0", feature = "test")]
9+
10+
#[rustc_deprecated(
11+
since = "1.0.1",
12+
reason = "explanation for deprecation"
13+
)] // invalid
14+
fn _deprecated_fn() {}
15+
```
16+
17+
To fix this issue, you need to add also an attribute `stable` or `unstable`.
18+
Example:
19+
20+
```
21+
#![feature(staged_api)]
22+
#![stable(since = "1.0.0", feature = "test")]
23+
24+
#[stable(since = "1.0.0", feature = "test")]
25+
#[rustc_deprecated(
26+
since = "1.0.1",
27+
reason = "explanation for deprecation"
28+
)] // ok!
29+
fn _deprecated_fn() {}
30+
```
31+
32+
See the [How Rust is Made and “Nightly Rust”][how-rust-made-nightly] appendix
33+
of the Book and the [Stability attributes][stability-attributes] section of the
34+
Rustc Dev Guide for more details.
35+
36+
[how-rust-made-nightly]: https://doc.rust-lang.org/book/appendix-07-nightly-rust.html
37+
[stability-attributes]: https://rustc-dev-guide.rust-lang.org/stability.html

src/test/ui/stability-attribute/stability-attribute-sanity.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,5 +116,5 @@ LL | #[rustc_deprecated(since = "a", reason = "text")]
116116

117117
error: aborting due to 19 previous errors
118118

119-
Some errors have detailed explanations: E0539, E0541, E0542, E0543, E0546, E0547, E0550.
119+
Some errors have detailed explanations: E0539, E0541, E0542, E0543, E0546, E0547, E0549, E0550.
120120
For more information about an error, try `rustc --explain E0539`.

0 commit comments

Comments
 (0)