]> git.lizzy.rs Git - rust.git/commitdiff
Add long error explanation for E0539
authorunexge <unexge@gmail.com>
Sat, 2 May 2020 18:14:08 +0000 (21:14 +0300)
committerunexge <unexge@gmail.com>
Sat, 2 May 2020 18:14:08 +0000 (21:14 +0300)
src/librustc_error_codes/error_codes.rs
src/librustc_error_codes/error_codes/E0539.md [new file with mode: 0644]
src/test/ui/stability-attribute/stability-attribute-sanity.stderr

index bf4a6c52ab858ff1bfd190bd9c602ca0438fbd14..e01412bc21cfd036dadcef85c3bab4599aa1d0a3 100644 (file)
 E0536: include_str!("./error_codes/E0536.md"),
 E0537: include_str!("./error_codes/E0537.md"),
 E0538: include_str!("./error_codes/E0538.md"),
+E0539: include_str!("./error_codes/E0539.md"),
 E0541: include_str!("./error_codes/E0541.md"),
 E0550: include_str!("./error_codes/E0550.md"),
 E0551: include_str!("./error_codes/E0551.md"),
     E0521, // borrowed data escapes outside of closure
     E0523,
 //  E0526, // shuffle indices are not constant
-    E0539, // incorrect meta item
     E0540, // multiple rustc_deprecated attributes
     E0542, // missing 'since'
     E0543, // missing 'reason'
diff --git a/src/librustc_error_codes/error_codes/E0539.md b/src/librustc_error_codes/error_codes/E0539.md
new file mode 100644 (file)
index 0000000..6955545
--- /dev/null
@@ -0,0 +1,42 @@
+An invalid meta-item was used inside an attribute.
+
+Erroneous code example:
+
+```compile_fail,E0539
+#[rustc_deprecated(reason)] // error!
+#[unstable(feature = "deprecated_fn", issue = "123")]
+fn deprecated() {}
+
+#[unstable(feature = "unstable_struct", issue)] // error!
+struct Unstable;
+
+#[rustc_const_unstable(feature)] // error!
+const fn unstable_fn() {}
+
+#[stable(feature = "stable_struct", since)] // error!
+struct Stable;
+
+#[rustc_const_stable(feature)] // error!
+const fn stable_fn() {}
+```
+
+Meta items are the key-value pairs inside of an attribute.
+To fix these issues you need to give required key-value pairs.
+
+```
+#[rustc_deprecated(since = "1.39.0", reason = "reason")] // ok!
+#[unstable(feature = "deprecated_fn", issue = "123")]
+fn deprecated() {}
+
+#[unstable(feature = "unstable_struct", issue = "123")] // ok!
+struct Unstable;
+
+#[rustc_const_unstable(feature = "unstable_fn", issue = "124")] // ok!
+const fn unstable_fn() {}
+
+#[stable(feature = "stable_struct", since = "1.39.0")] // ok!
+struct Stable;
+
+#[rustc_const_stable(feature = "stable_fn", since = "1.39.0")] // ok!
+const fn stable_fn() {}
+```
index d0ca1705037960bcd3ae03ac7d5cb9691211a706..3c5da3f14403503d00caf5533ede8b3624fd8f80 100644 (file)
@@ -108,4 +108,5 @@ LL | fn deprecated_without_unstable_or_stable() { }
 
 error: aborting due to 18 previous errors
 
-For more information about this error, try `rustc --explain E0541`.
+Some errors have detailed explanations: E0539, E0541.
+For more information about an error, try `rustc --explain E0539`.