This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +51
-2
lines changed
test/ui/stability-attribute Expand file tree Collapse file tree 3 files changed +51
-2
lines changed Original file line number Diff line number Diff line change @@ -281,6 +281,7 @@ E0535: include_str!("./error_codes/E0535.md"),
281281E0536 : include_str!( "./error_codes/E0536.md" ) ,
282282E0537 : include_str!( "./error_codes/E0537.md" ) ,
283283E0538 : include_str!( "./error_codes/E0538.md" ) ,
284+ E0539 : include_str!( "./error_codes/E0539.md" ) ,
284285E0541 : include_str!( "./error_codes/E0541.md" ) ,
285286E0550 : include_str!( "./error_codes/E0550.md" ) ,
286287E0551 : 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 number Diff line number Diff line change 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+ ```
Original file line number Diff line number Diff line change @@ -108,4 +108,5 @@ LL | fn deprecated_without_unstable_or_stable() { }
108108
109109error: 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`.
You can’t perform that action at this time.
0 commit comments