Skip to content

Commit cdab137

Browse files
Rollup merge of #82161 - jesusprubio:add-long-explanation-e0545, r=GuillaumeGomez
Add long explanation for E0545 Helps with #61137
2 parents 73d6b60 + 8192793 commit cdab137

File tree

4 files changed

+38
-2
lines changed

4 files changed

+38
-2
lines changed

compiler/rustc_error_codes/src/error_codes.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,7 @@ E0538: include_str!("./error_codes/E0538.md"),
286286
E0539: include_str!("./error_codes/E0539.md"),
287287
E0541: include_str!("./error_codes/E0541.md"),
288288
E0542: include_str!("./error_codes/E0542.md"),
289+
E0545: include_str!("./error_codes/E0545.md"),
289290
E0546: include_str!("./error_codes/E0546.md"),
290291
E0547: include_str!("./error_codes/E0547.md"),
291292
E0550: include_str!("./error_codes/E0550.md"),
@@ -606,7 +607,6 @@ E0781: include_str!("./error_codes/E0781.md"),
606607
// E0540, // multiple rustc_deprecated attributes
607608
E0543, // missing 'reason'
608609
E0544, // multiple stability levels
609-
E0545, // incorrect 'issue'
610610
// E0548, // replaced with a generic attribute input check
611611
// rustc_deprecated attribute must be paired with either stable or unstable
612612
// attribute
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
The `issue` value is incorrect in a stability attribute.
2+
3+
Erroneous code example:
4+
5+
```compile_fail,E0545
6+
#![feature(staged_api)]
7+
#![stable(since = "1.0.0", feature = "test")]
8+
9+
#[unstable(feature = "_unstable_fn", issue = "0")] // invalid
10+
fn _unstable_fn() {}
11+
12+
#[rustc_const_unstable(feature = "_unstable_const_fn", issue = "0")] // invalid
13+
fn _unstable_const_fn() {}
14+
```
15+
16+
To fix this issue, you need to provide a correct value in the `issue` field.
17+
Example:
18+
19+
```
20+
#![feature(staged_api)]
21+
#![stable(since = "1.0.0", feature = "test")]
22+
23+
#[unstable(feature = "_unstable_fn", issue = "none")] // ok!
24+
fn _unstable_fn() {}
25+
26+
#[rustc_const_unstable(feature = "_unstable_const_fn", issue = "1")] // ok!
27+
fn _unstable_const_fn() {}
28+
```
29+
30+
See the [How Rust is Made and “Nightly Rust”][how-rust-made-nightly] appendix
31+
of the Book and the [Stability attributes][stability-attributes] section of the
32+
Rustc Dev Guide for more details.
33+
34+
[how-rust-made-nightly]: https://doc.rust-lang.org/book/appendix-07-nightly-rust.html
35+
[stability-attributes]: https://rustc-dev-guide.rust-lang.org/stability.html

src/test/ui/feature-gates/unstable-attribute-allow-issue-0.stderr

+1
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ LL | #[unstable(feature = "unstable_test_feature", issue = "something")]
1616

1717
error: aborting due to 2 previous errors
1818

19+
For more information about this error, try `rustc --explain E0545`.

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@ LL | #[unstable(feature = "a", issue = "no")]
2020

2121
error: aborting due to 3 previous errors
2222

23-
Some errors have detailed explanations: E0538, E0541.
23+
Some errors have detailed explanations: E0538, E0541, E0545.
2424
For more information about an error, try `rustc --explain E0538`.

0 commit comments

Comments
 (0)