diff options
| author | Dylan DPC <dylan.dpc@gmail.com> | 2020-05-03 18:34:50 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-05-03 18:34:50 +0200 |
| commit | ce1dba99185a87eafcc99fc2738a1f8473f13b6e (patch) | |
| tree | 61894abbcaaaf485a676ff25e81596bb79463299 /src/librustc_error_codes/error_codes | |
| parent | 44e678bf9e4846bf9ac9c2f30fa9533ead51ad13 (diff) | |
| parent | ef813ca95a674a19f15ce53ce432d2fb185d7fe2 (diff) | |
| download | rust-ce1dba99185a87eafcc99fc2738a1f8473f13b6e.tar.gz rust-ce1dba99185a87eafcc99fc2738a1f8473f13b6e.zip | |
Rollup merge of #71808 - unexge:long-err-expl-for-e0539, r=GuillaumeGomez
Add long error explanation for E0539 since this error is similar to [E0551](https://github.com/rust-lang/rust/blob/master/src/librustc_error_codes/error_codes/E0551.md) most of the content was copied from it. part of #61137.
Diffstat (limited to 'src/librustc_error_codes/error_codes')
| -rw-r--r-- | src/librustc_error_codes/error_codes/E0539.md | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/src/librustc_error_codes/error_codes/E0539.md b/src/librustc_error_codes/error_codes/E0539.md new file mode 100644 index 00000000000..df2d7d910bb --- /dev/null +++ b/src/librustc_error_codes/error_codes/E0539.md @@ -0,0 +1,48 @@ +An invalid meta-item was used inside an attribute. + +Erroneous code example: + +```compile_fail,E0539 +#![feature(staged_api)] +#![stable(since = "1.0.0", feature = "test")] + +#[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. + +``` +#![feature(staged_api)] +#![stable(since = "1.0.0", feature = "test")] + +#[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() {} +``` |
