diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2021-07-08 18:30:34 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-07-08 18:30:34 +0200 |
| commit | d85718ad01124abcb6a7cd2f958bae2285c933f1 (patch) | |
| tree | e99e6e50e92ffc5d54e2613037e2e5ada83a2c7b /compiler/rustc_error_codes/src | |
| parent | ff4bf73a4274623e302fcde1f7914d6cf8da40e7 (diff) | |
| parent | 07f903e0e0816821c41a19774f029086b557738b (diff) | |
| download | rust-d85718ad01124abcb6a7cd2f958bae2285c933f1.tar.gz rust-d85718ad01124abcb6a7cd2f958bae2285c933f1.zip | |
Rollup merge of #86838 - lambinoo:I-69630-rust_const_unstable_check_const, r=oli-obk
Checking that function is const if marked with rustc_const_unstable Fixes #69630 This one is still missing tests to check the behavior but I checked by hand and it seemed to work. I would not mind some direction for writing those unit tests!
Diffstat (limited to 'compiler/rustc_error_codes/src')
| -rw-r--r-- | compiler/rustc_error_codes/src/error_codes/E0542.md | 4 | ||||
| -rw-r--r-- | compiler/rustc_error_codes/src/error_codes/E0545.md | 4 | ||||
| -rw-r--r-- | compiler/rustc_error_codes/src/error_codes/E0547.md | 4 |
3 files changed, 6 insertions, 6 deletions
diff --git a/compiler/rustc_error_codes/src/error_codes/E0542.md b/compiler/rustc_error_codes/src/error_codes/E0542.md index 7cb58f9d0cb..7fecfeaa57c 100644 --- a/compiler/rustc_error_codes/src/error_codes/E0542.md +++ b/compiler/rustc_error_codes/src/error_codes/E0542.md @@ -10,7 +10,7 @@ Erroneous code example: fn _stable_fn() {} #[rustc_const_stable(feature = "_stable_const_fn")] // invalid -fn _stable_const_fn() {} +const fn _stable_const_fn() {} #[stable(feature = "_deprecated_fn", since = "0.1.0")] #[rustc_deprecated( @@ -29,7 +29,7 @@ To fix this issue, you need to provide the `since` field. Example: fn _stable_fn() {} #[rustc_const_stable(feature = "_stable_const_fn", since = "1.0.0")] // ok! -fn _stable_const_fn() {} +const fn _stable_const_fn() {} #[stable(feature = "_deprecated_fn", since = "0.1.0")] #[rustc_deprecated( diff --git a/compiler/rustc_error_codes/src/error_codes/E0545.md b/compiler/rustc_error_codes/src/error_codes/E0545.md index 9fb935a3ab1..7aba084f4d3 100644 --- a/compiler/rustc_error_codes/src/error_codes/E0545.md +++ b/compiler/rustc_error_codes/src/error_codes/E0545.md @@ -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 diff --git a/compiler/rustc_error_codes/src/error_codes/E0547.md b/compiler/rustc_error_codes/src/error_codes/E0547.md index 1aa4b354248..4950325df64 100644 --- a/compiler/rustc_error_codes/src/error_codes/E0547.md +++ b/compiler/rustc_error_codes/src/error_codes/E0547.md @@ -10,7 +10,7 @@ Erroneous code example: fn _unstable_fn() {} #[rustc_const_unstable(feature = "_unstable_const_fn")] // invalid -fn _unstable_const_fn() {} +const fn _unstable_const_fn() {} ``` To fix this issue, you need to provide the `issue` field. Example: @@ -26,7 +26,7 @@ fn _unstable_fn() {} feature = "_unstable_const_fn", issue = "none" )] // ok! -fn _unstable_const_fn() {} +const fn _unstable_const_fn() {} ``` See the [How Rust is Made and “Nightly Rust”][how-rust-made-nightly] appendix |
