Skip to content

Commit e4ee172

Browse files
committed
Add long error explanation for E0539
1 parent 7184d13 commit e4ee172

File tree

3 files changed

+45
-2
lines changed

3 files changed

+45
-2
lines changed

src/librustc_error_codes/error_codes.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,7 @@ E0535: include_str!("./error_codes/E0535.md"),
281281
E0536: include_str!("./error_codes/E0536.md"),
282282
E0537: include_str!("./error_codes/E0537.md"),
283283
E0538: include_str!("./error_codes/E0538.md"),
284+
E0539: include_str!("./error_codes/E0539.md"),
284285
E0541: include_str!("./error_codes/E0541.md"),
285286
E0550: include_str!("./error_codes/E0550.md"),
286287
E0551: include_str!("./error_codes/E0551.md"),
@@ -570,7 +571,6 @@ E0753: include_str!("./error_codes/E0753.md"),
570571
E0521, // borrowed data escapes outside of closure
571572
E0523,
572573
// E0526, // shuffle indices are not constant
573-
E0539, // incorrect meta item
574574
E0540, // multiple rustc_deprecated attributes
575575
E0542, // missing 'since'
576576
E0543, // missing 'reason'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
An invalid meta-item was used inside an attribute.
2+
3+
Erroneous code example:
4+
5+
```compile_fail,E0539
6+
#[rustc_deprecated(reason)] // error!
7+
#[unstable(feature = "deprecated_fn", issue = "123")]
8+
fn deprecated() {}
9+
10+
#[unstable(feature = "unstable_struct", issue)] // error!
11+
struct Unstable;
12+
13+
#[rustc_const_unstable(feature)] // error!
14+
const fn unstable_fn() {}
15+
16+
#[stable(feature = "stable_struct", since)] // error!
17+
struct Stable;
18+
19+
#[rustc_const_stable(feature)] // error!
20+
const fn stable_fn() {}
21+
```
22+
23+
Meta items are the key-value pairs inside of an attribute.
24+
To fix these issues you need to give required key-value pairs.
25+
26+
```
27+
#[rustc_deprecated(since = "1.39.0", reason = "reason")] // ok!
28+
#[unstable(feature = "deprecated_fn", issue = "123")]
29+
fn deprecated() {}
30+
31+
#[unstable(feature = "unstable_struct", issue = "123")] // ok!
32+
struct Unstable;
33+
34+
#[rustc_const_unstable(feature = "unstable_fn", issue = "124")] // ok!
35+
const fn unstable_fn() {}
36+
37+
#[stable(feature = "stable_struct", since = "1.39.0")] // ok!
38+
struct Stable;
39+
40+
#[rustc_const_stable(feature = "stable_fn", since = "1.39.0")] // ok!
41+
const fn stable_fn() {}
42+
```

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -108,4 +108,5 @@ LL | fn deprecated_without_unstable_or_stable() { }
108108

109109
error: aborting due to 18 previous errors
110110

111-
For more information about this error, try `rustc --explain E0541`.
111+
Some errors have detailed explanations: E0539, E0541.
112+
For more information about an error, try `rustc --explain E0539`.

0 commit comments

Comments
 (0)