Error code E0539
An invalid meta-item was used inside an attribute.
Erroneous code example:
#![allow(unused)] #![feature(staged_api)] #![allow(internal_features)] #![stable(since = "1.0.0", feature = "test")] fn main() { #[deprecated(note)] // 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.
#![allow(unused)] #![feature(staged_api)] #![allow(internal_features)] #![stable(since = "1.0.0", feature = "test")] fn main() { #[deprecated(since = "1.39.0", note = "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; #[stable(feature = "stable_fn", since = "1.39.0")] #[rustc_const_stable(feature = "stable_fn", since = "1.39.0")] // ok! const fn stable_fn() {} }