lotsoftools

Understanding and Fixing Rust Error E0545

Rust Error E0545: Incorrect Issue Value in Stability Attribute

Rust Error E0545 occurs when the issue value provided in a stability attribute is incorrect. This issue is usually discovered in the #[unstable()], #[stable()] or #[rustc_const_unstable()] attributes.

The excerpt below demonstrates an erroneous code example:

#![allow(unused)]
#![feature(staged_api)]
#![stable(since = "1.0.0", feature = "test")]

fn main() {
#[unstable(feature = "_unstable_fn", issue = "0")] // invalid
fn _unstable_fn() {}

#[rustc_const_unstable(feature = "_unstable_const_fn", issue = "0")] // invalid
const fn _unstable_const_fn() {}
}

How to Fix Rust Error E0545

To resolve this error, you must provide a correct value in the issue field. Therefore, adjust the issue value as necessary and ensure it is valid according to Rust stability attributes.

Here is an example of corrected code:

#![allow(unused)]
#![feature(staged_api)]
#![stable(since = "1.0.0", feature = "test")]

fn main() {
#[unstable(feature = "_unstable_fn", issue = "none")] // ok!
fn _unstable_fn() {}

#[rustc_const_unstable(feature = "_unstable_const_fn", issue = "1")] // ok!
const fn _unstable_const_fn() {}
}

Additional Resources

For more information on Rust stability attributes and examples of correct usage, refer to the Rustc Dev Guide and the Appendix in The Rust Programming Language book, which explain Nightly Rust and How Rust is Made.