Skip to content

Commit a981cff

Browse files
authored
Rollup merge of #87497 - midgleyc:long-E0544, r=GuillaumeGomez
Add long explanation for E0544. Helps with #61137
2 parents 7282d71 + b21024f commit a981cff

File tree

3 files changed

+31
-2
lines changed

3 files changed

+31
-2
lines changed

compiler/rustc_error_codes/src/error_codes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,7 @@ E0539: include_str!("./error_codes/E0539.md"),
287287
E0541: include_str!("./error_codes/E0541.md"),
288288
E0542: include_str!("./error_codes/E0542.md"),
289289
E0543: include_str!("./error_codes/E0543.md"),
290+
E0544: include_str!("./error_codes/E0544.md"),
290291
E0545: include_str!("./error_codes/E0545.md"),
291292
E0546: include_str!("./error_codes/E0546.md"),
292293
E0547: include_str!("./error_codes/E0547.md"),
@@ -610,7 +611,6 @@ E0783: include_str!("./error_codes/E0783.md"),
610611
E0523,
611612
// E0526, // shuffle indices are not constant
612613
// E0540, // multiple rustc_deprecated attributes
613-
E0544, // multiple stability levels
614614
// E0548, // replaced with a generic attribute input check
615615
// E0553, // multiple rustc_const_unstable attributes
616616
// E0555, // replaced with a generic attribute input check
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
Multiple stability attributes were declared on the same item.
2+
3+
Erroneous code example:
4+
5+
```compile_fail,E0544
6+
#![feature(staged_api)]
7+
#![stable(since = "1.0.0", feature = "rust1")]
8+
9+
#[stable(feature = "rust1", since = "1.0.0")]
10+
#[stable(feature = "test", since = "2.0.0")] // invalid
11+
fn foo() {}
12+
```
13+
14+
To fix this issue, ensure that each item has at most one stability attribute.
15+
16+
```
17+
#![feature(staged_api)]
18+
#![stable(since = "1.0.0", feature = "rust1")]
19+
20+
#[stable(feature = "test", since = "2.0.0")] // ok!
21+
fn foo() {}
22+
```
23+
24+
See the [How Rust is Made and “Nightly Rust”][how-rust-made-nightly] appendix
25+
of the Book and the [Stability attributes][stability-attributes] section of the
26+
Rustc Dev Guide for more details.
27+
28+
[how-rust-made-nightly]: https://doc.rust-lang.org/book/appendix-07-nightly-rust.html
29+
[stability-attributes]: https://rustc-dev-guide.rust-lang.org/stability.html

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,5 +122,5 @@ LL | #[rustc_deprecated(since = "a", reason = "text")]
122122

123123
error: aborting due to 19 previous errors
124124

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

0 commit comments

Comments
 (0)