]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_error_codes/src/error_codes/E0539.md
Merge commit 'f2cdd4a78d89c009342197cf5844a21f8aa813df' into sync_cg_clif-2022-04-22
[rust.git] / compiler / rustc_error_codes / src / error_codes / E0539.md
1 An invalid meta-item was used inside an attribute.
2
3 Erroneous code example:
4
5 ```compile_fail,E0539
6 #![feature(staged_api)]
7 #![stable(since = "1.0.0", feature = "test")]
8
9 #[rustc_deprecated(reason)] // error!
10 #[unstable(feature = "deprecated_fn", issue = "123")]
11 fn deprecated() {}
12
13 #[unstable(feature = "unstable_struct", issue)] // error!
14 struct Unstable;
15
16 #[rustc_const_unstable(feature)] // error!
17 const fn unstable_fn() {}
18
19 #[stable(feature = "stable_struct", since)] // error!
20 struct Stable;
21
22 #[rustc_const_stable(feature)] // error!
23 const fn stable_fn() {}
24 ```
25
26 Meta items are the key-value pairs inside of an attribute.
27 To fix these issues you need to give required key-value pairs.
28
29 ```
30 #![feature(staged_api)]
31 #![stable(since = "1.0.0", feature = "test")]
32
33 #[rustc_deprecated(since = "1.39.0", reason = "reason")] // ok!
34 #[unstable(feature = "deprecated_fn", issue = "123")]
35 fn deprecated() {}
36
37 #[unstable(feature = "unstable_struct", issue = "123")] // ok!
38 struct Unstable;
39
40 #[rustc_const_unstable(feature = "unstable_fn", issue = "124")] // ok!
41 const fn unstable_fn() {}
42
43 #[stable(feature = "stable_struct", since = "1.39.0")] // ok!
44 struct Stable;
45
46 #[rustc_const_stable(feature = "stable_fn", since = "1.39.0")] // ok!
47 const fn stable_fn() {}
48 ```