Skip to content

Commit f2f3a8e

Browse files
committed
Add long explanation of E0546
1 parent f8e5209 commit f2f3a8e

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

compiler/rustc_error_codes/src/error_codes.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,7 @@ E0537: include_str!("./error_codes/E0537.md"),
283283
E0538: include_str!("./error_codes/E0538.md"),
284284
E0539: include_str!("./error_codes/E0539.md"),
285285
E0541: include_str!("./error_codes/E0541.md"),
286+
E0546: include_str!("./error_codes/E0546.md"),
286287
E0550: include_str!("./error_codes/E0550.md"),
287288
E0551: include_str!("./error_codes/E0551.md"),
288289
E0552: include_str!("./error_codes/E0552.md"),
@@ -603,7 +604,6 @@ E0779: include_str!("./error_codes/E0779.md"),
603604
E0543, // missing 'reason'
604605
E0544, // multiple stability levels
605606
E0545, // incorrect 'issue'
606-
E0546, // missing 'feature'
607607
E0547, // missing 'issue'
608608
// E0548, // replaced with a generic attribute input check
609609
// rustc_deprecated attribute must be paired with either stable or unstable
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
A feature name is missing.
2+
3+
Erroneous code example:
4+
5+
```compile_fail,E0546
6+
#![feature(staged_api)]
7+
#![stable(since = "1.0.0", feature = "test")]
8+
9+
#[unstable(issue = "none")] // invalid
10+
fn unstable_fn() {}
11+
12+
#[stable(since = "1.0.0")] // invalid
13+
fn stable_fn() {}
14+
```
15+
16+
To fix the issue you need to provide a feature name.
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+
#[stable(feature = "stable_fn", since = "1.0.0")] // ok!
26+
fn stable_fn() {}
27+
```

0 commit comments

Comments
 (0)