]> git.lizzy.rs Git - rust.git/blobdiff - compiler/rustc_error_codes/src/error_codes/E0545.md
fn must be const if marked with stability attribut
[rust.git] / compiler / rustc_error_codes / src / error_codes / E0545.md
index 9fb935a3ab1abbb254c7b05631ec7c75cec17a52..7aba084f4d3aa82b50e8c3958ec891c5b7d4ef84 100644 (file)
@@ -10,7 +10,7 @@ Erroneous code example:
 fn _unstable_fn() {}
 
 #[rustc_const_unstable(feature = "_unstable_const_fn", issue = "0")] // invalid
-fn _unstable_const_fn() {}
+const fn _unstable_const_fn() {}
 ```
 
 To fix this issue, you need to provide a correct value in the `issue` field.
@@ -24,7 +24,7 @@ Example:
 fn _unstable_fn() {}
 
 #[rustc_const_unstable(feature = "_unstable_const_fn", issue = "1")] // ok!
-fn _unstable_const_fn() {}
+const fn _unstable_const_fn() {}
 ```
 
 See the [How Rust is Made and “Nightly Rust”][how-rust-made-nightly] appendix