Skip to content

Commit 40fa6fc

Browse files
authored
Rollup merge of #81925 - jesusprubio:add-long-explanation-e0547, r=GuillaumeGomez
Add long explanation for E0547 Helps with #61137
2 parents a58feb9 + 8fbdd2d commit 40fa6fc

File tree

3 files changed

+39
-2
lines changed

3 files changed

+39
-2
lines changed

compiler/rustc_error_codes/src/error_codes.rs

+1-1
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
E0546: include_str!("./error_codes/E0546.md"),
290+
E0547: include_str!("./error_codes/E0547.md"),
290291
E0550: include_str!("./error_codes/E0550.md"),
291292
E0551: include_str!("./error_codes/E0551.md"),
292293
E0552: include_str!("./error_codes/E0552.md"),
@@ -606,7 +607,6 @@ E0781: include_str!("./error_codes/E0781.md"),
606607
E0543, // missing 'reason'
607608
E0544, // multiple stability levels
608609
E0545, // incorrect 'issue'
609-
E0547, // missing '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,37 @@
1+
The `issue` value is missing in a stability attribute.
2+
3+
Erroneous code example:
4+
5+
```compile_fail,E0547
6+
#![feature(staged_api)]
7+
#![stable(since = "1.0.0", feature = "test")]
8+
9+
#[unstable(feature = "_unstable_fn")] // invalid
10+
fn _unstable_fn() {}
11+
12+
#[rustc_const_unstable(feature = "_unstable_const_fn")] // invalid
13+
fn _unstable_const_fn() {}
14+
```
15+
16+
To fix this issue, you need to provide the `issue` field. Example:
17+
18+
```
19+
#![feature(staged_api)]
20+
#![stable(since = "1.0.0", feature = "test")]
21+
22+
#[unstable(feature = "_unstable_fn", issue = "none")] // ok!
23+
fn _unstable_fn() {}
24+
25+
#[rustc_const_unstable(
26+
feature = "_unstable_const_fn",
27+
issue = "none"
28+
)] // ok!
29+
fn _unstable_const_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, E0546, E0550.
119+
Some errors have detailed explanations: E0539, E0541, E0542, E0546, E0547, E0550.
120120
For more information about an error, try `rustc --explain E0539`.

0 commit comments

Comments
 (0)