Skip to content

Commit bafc51e

Browse files
committed
remove const_fn feature gate
1 parent 881c1ac commit bafc51e

28 files changed

+48
-128
lines changed

compiler/rustc_feature/src/active.rs

-3
Original file line numberDiff line numberDiff line change
@@ -274,9 +274,6 @@ declare_features! (
274274
/// Allows using non lexical lifetimes (RFC 2094).
275275
(active, nll, "1.0.0", Some(43234), None),
276276

277-
/// Allows the definition of `const` functions with some advanced features.
278-
(active, const_fn, "1.2.0", Some(57563), None),
279-
280277
/// Allows associated type defaults.
281278
(active, associated_type_defaults, "1.2.0", Some(29661), None),
282279

compiler/rustc_feature/src/removed.rs

+3
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,9 @@ declare_features! (
136136
(removed, main, "1.53.0", Some(29634), None, None),
137137
(removed, pub_macro_rules, "1.53.0", Some(78855), None,
138138
Some("removed due to being incomplete, in particular it does not work across crates")),
139+
/// Allows the definition of `const` functions with some advanced features.
140+
(removed, const_fn, "1.54.0", Some(57563), None,
141+
Some("split into finer-grained feature gates")),
139142

140143
// -------------------------------------------------------------------------
141144
// feature-group-end: removed features

library/std/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,6 @@
246246
#![feature(const_cstr_unchecked)]
247247
#![feature(const_fn_floating_point_arithmetic)]
248248
#![feature(const_fn_transmute)]
249-
#![feature(const_fn)]
250249
#![feature(const_fn_fn_ptr_basics)]
251250
#![feature(const_io_structs)]
252251
#![feature(const_ip)]

src/doc/unstable-book/src/language-features/const-fn.md

-10
This file was deleted.

src/test/ui/feature-gates/feature-gate-const_fn.rs

-35
This file was deleted.

src/test/ui/feature-gates/feature-gate-const_fn.stderr

-21
This file was deleted.

src/test/ui/feature-gates/feature-gate-rustc_const_unstable.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
// Test internal const fn feature gate.
22

3-
#![feature(const_fn)]
4-
53
#[rustc_const_unstable(feature="fzzzzzt")] //~ stability attributes may not be used outside
64
pub const fn bazinga() {}
75

src/test/ui/feature-gates/feature-gate-rustc_const_unstable.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0734]: stability attributes may not be used outside of the standard library
2-
--> $DIR/feature-gate-rustc_const_unstable.rs:5:1
2+
--> $DIR/feature-gate-rustc_const_unstable.rs:3:1
33
|
44
LL | #[rustc_const_unstable(feature="fzzzzzt")]
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

src/test/ui/internal/internal-unstable-const.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#![stable(feature = "rust1", since = "1.0.0")]
44

55
#![feature(staged_api)]
6-
#![feature(const_transmute, const_fn)]
6+
#![feature(const_transmute)]
77

88
#[stable(feature = "rust1", since = "1.0.0")]
99
#[rustc_const_stable(feature = "rust1", since = "1.0.0")]

src/test/ui/issues/issue-54954.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![feature(const_fn)]
2-
31
const ARR_LEN: usize = Tt::const_val::<[i8; 123]>();
42
//~^ ERROR type annotations needed
53

src/test/ui/issues/issue-54954.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
error[E0379]: functions in traits cannot be declared const
2-
--> $DIR/issue-54954.rs:7:5
2+
--> $DIR/issue-54954.rs:5:5
33
|
44
LL | const fn const_val<T: Sized>() -> usize {
55
| ^^^^^ functions in traits cannot be const
66

77
error[E0283]: type annotations needed
8-
--> $DIR/issue-54954.rs:3:24
8+
--> $DIR/issue-54954.rs:1:24
99
|
1010
LL | const ARR_LEN: usize = Tt::const_val::<[i8; 123]>();
1111
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type

src/test/ui/mismatched_types/const-fn-in-trait.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![feature(const_fn)]
2-
31
trait Foo {
42
fn f() -> u32;
53
const fn g(); //~ ERROR cannot be declared const

src/test/ui/mismatched_types/const-fn-in-trait.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
error[E0379]: functions in traits cannot be declared const
2-
--> $DIR/const-fn-in-trait.rs:5:5
2+
--> $DIR/const-fn-in-trait.rs:3:5
33
|
44
LL | const fn g();
55
| ^^^^^ functions in traits cannot be const
66

77
error[E0379]: functions in traits cannot be declared const
8-
--> $DIR/const-fn-in-trait.rs:9:5
8+
--> $DIR/const-fn-in-trait.rs:7:5
99
|
1010
LL | const fn f() -> u32 { 22 }
1111
| ^^^^^ functions in traits cannot be const

src/test/ui/parser/fn-header-semantic-fail.rs

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
// edition:2018
44

55
#![feature(const_extern_fn)]
6-
#![feature(const_fn)]
76

87
fn main() {
98
async fn ff1() {} // OK.

src/test/ui/parser/fn-header-semantic-fail.stderr

+20-20
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: functions cannot be both `const` and `async`
2-
--> $DIR/fn-header-semantic-fail.rs:13:5
2+
--> $DIR/fn-header-semantic-fail.rs:12:5
33
|
44
LL | const async unsafe extern "C" fn ff5() {} // OK.
55
| ^^^^^-^^^^^------------------------------
@@ -8,7 +8,7 @@ LL | const async unsafe extern "C" fn ff5() {} // OK.
88
| `const` because of this
99

1010
error[E0706]: functions in traits cannot be declared `async`
11-
--> $DIR/fn-header-semantic-fail.rs:17:9
11+
--> $DIR/fn-header-semantic-fail.rs:16:9
1212
|
1313
LL | async fn ft1();
1414
| -----^^^^^^^^^^
@@ -19,19 +19,19 @@ LL | async fn ft1();
1919
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
2020

2121
error[E0379]: functions in traits cannot be declared const
22-
--> $DIR/fn-header-semantic-fail.rs:19:9
22+
--> $DIR/fn-header-semantic-fail.rs:18:9
2323
|
2424
LL | const fn ft3();
2525
| ^^^^^ functions in traits cannot be const
2626

2727
error[E0379]: functions in traits cannot be declared const
28-
--> $DIR/fn-header-semantic-fail.rs:21:9
28+
--> $DIR/fn-header-semantic-fail.rs:20:9
2929
|
3030
LL | const async unsafe extern "C" fn ft5();
3131
| ^^^^^ functions in traits cannot be const
3232

3333
error[E0706]: functions in traits cannot be declared `async`
34-
--> $DIR/fn-header-semantic-fail.rs:21:9
34+
--> $DIR/fn-header-semantic-fail.rs:20:9
3535
|
3636
LL | const async unsafe extern "C" fn ft5();
3737
| ^^^^^^-----^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -42,7 +42,7 @@ LL | const async unsafe extern "C" fn ft5();
4242
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
4343

4444
error: functions cannot be both `const` and `async`
45-
--> $DIR/fn-header-semantic-fail.rs:21:9
45+
--> $DIR/fn-header-semantic-fail.rs:20:9
4646
|
4747
LL | const async unsafe extern "C" fn ft5();
4848
| ^^^^^-^^^^^----------------------------
@@ -51,7 +51,7 @@ LL | const async unsafe extern "C" fn ft5();
5151
| `const` because of this
5252

5353
error[E0706]: functions in traits cannot be declared `async`
54-
--> $DIR/fn-header-semantic-fail.rs:29:9
54+
--> $DIR/fn-header-semantic-fail.rs:28:9
5555
|
5656
LL | async fn ft1() {}
5757
| -----^^^^^^^^^^^^
@@ -62,19 +62,19 @@ LL | async fn ft1() {}
6262
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
6363

6464
error[E0379]: functions in traits cannot be declared const
65-
--> $DIR/fn-header-semantic-fail.rs:32:9
65+
--> $DIR/fn-header-semantic-fail.rs:31:9
6666
|
6767
LL | const fn ft3() {}
6868
| ^^^^^ functions in traits cannot be const
6969

7070
error[E0379]: functions in traits cannot be declared const
71-
--> $DIR/fn-header-semantic-fail.rs:34:9
71+
--> $DIR/fn-header-semantic-fail.rs:33:9
7272
|
7373
LL | const async unsafe extern "C" fn ft5() {}
7474
| ^^^^^ functions in traits cannot be const
7575

7676
error[E0706]: functions in traits cannot be declared `async`
77-
--> $DIR/fn-header-semantic-fail.rs:34:9
77+
--> $DIR/fn-header-semantic-fail.rs:33:9
7878
|
7979
LL | const async unsafe extern "C" fn ft5() {}
8080
| ^^^^^^-----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -85,7 +85,7 @@ LL | const async unsafe extern "C" fn ft5() {}
8585
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
8686

8787
error: functions cannot be both `const` and `async`
88-
--> $DIR/fn-header-semantic-fail.rs:34:9
88+
--> $DIR/fn-header-semantic-fail.rs:33:9
8989
|
9090
LL | const async unsafe extern "C" fn ft5() {}
9191
| ^^^^^-^^^^^------------------------------
@@ -94,7 +94,7 @@ LL | const async unsafe extern "C" fn ft5() {}
9494
| `const` because of this
9595

9696
error: functions cannot be both `const` and `async`
97-
--> $DIR/fn-header-semantic-fail.rs:46:9
97+
--> $DIR/fn-header-semantic-fail.rs:45:9
9898
|
9999
LL | const async unsafe extern "C" fn fi5() {}
100100
| ^^^^^-^^^^^------------------------------
@@ -103,7 +103,7 @@ LL | const async unsafe extern "C" fn fi5() {}
103103
| `const` because of this
104104

105105
error: functions in `extern` blocks cannot have qualifiers
106-
--> $DIR/fn-header-semantic-fail.rs:51:18
106+
--> $DIR/fn-header-semantic-fail.rs:50:18
107107
|
108108
LL | extern "C" {
109109
| ---------- in this `extern` block
@@ -116,7 +116,7 @@ LL | fn fe1();
116116
| ^^
117117

118118
error: functions in `extern` blocks cannot have qualifiers
119-
--> $DIR/fn-header-semantic-fail.rs:52:19
119+
--> $DIR/fn-header-semantic-fail.rs:51:19
120120
|
121121
LL | extern "C" {
122122
| ---------- in this `extern` block
@@ -130,7 +130,7 @@ LL | fn fe2();
130130
| ^^
131131

132132
error: functions in `extern` blocks cannot have qualifiers
133-
--> $DIR/fn-header-semantic-fail.rs:53:18
133+
--> $DIR/fn-header-semantic-fail.rs:52:18
134134
|
135135
LL | extern "C" {
136136
| ---------- in this `extern` block
@@ -144,7 +144,7 @@ LL | fn fe3();
144144
| ^^
145145

146146
error: functions in `extern` blocks cannot have qualifiers
147-
--> $DIR/fn-header-semantic-fail.rs:54:23
147+
--> $DIR/fn-header-semantic-fail.rs:53:23
148148
|
149149
LL | extern "C" {
150150
| ---------- in this `extern` block
@@ -158,7 +158,7 @@ LL | fn fe4();
158158
| ^^
159159

160160
error: functions in `extern` blocks cannot have qualifiers
161-
--> $DIR/fn-header-semantic-fail.rs:55:42
161+
--> $DIR/fn-header-semantic-fail.rs:54:42
162162
|
163163
LL | extern "C" {
164164
| ---------- in this `extern` block
@@ -172,7 +172,7 @@ LL | fn fe5();
172172
| ^^
173173

174174
error: functions cannot be both `const` and `async`
175-
--> $DIR/fn-header-semantic-fail.rs:55:9
175+
--> $DIR/fn-header-semantic-fail.rs:54:9
176176
|
177177
LL | const async unsafe extern "C" fn fe5();
178178
| ^^^^^-^^^^^----------------------------
@@ -181,7 +181,7 @@ LL | const async unsafe extern "C" fn fe5();
181181
| `const` because of this
182182

183183
error[E0053]: method `ft1` has an incompatible type for trait
184-
--> $DIR/fn-header-semantic-fail.rs:29:24
184+
--> $DIR/fn-header-semantic-fail.rs:28:24
185185
|
186186
LL | async fn ft1();
187187
| - type in trait
@@ -197,7 +197,7 @@ LL | async fn ft1() {}
197197
found fn pointer `fn() -> impl Future`
198198

199199
error[E0053]: method `ft5` has an incompatible type for trait
200-
--> $DIR/fn-header-semantic-fail.rs:34:48
200+
--> $DIR/fn-header-semantic-fail.rs:33:48
201201
|
202202
LL | const async unsafe extern "C" fn ft5();
203203
| - type in trait

src/test/ui/rfc-2091-track-caller/caller-location-fnptr-rt-ctfe-equiv.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
// run-pass
77
// compile-flags: -Z unleash-the-miri-inside-of-you
88

9-
#![feature(core_intrinsics, const_caller_location, const_fn)]
9+
#![feature(core_intrinsics, const_caller_location)]
1010

1111
type L = &'static std::panic::Location<'static>;
1212

src/test/ui/rfc-2091-track-caller/const-caller-location.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// revisions: default mir-opt
33
//[mir-opt] compile-flags: -Zmir-opt-level=4
44

5-
#![feature(const_caller_location, const_fn)]
5+
#![feature(const_caller_location)]
66

77
use std::panic::Location;
88

src/test/ui/rustc-args-required-const2.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![feature(rustc_attrs, const_fn)]
1+
#![feature(rustc_attrs)]
22

33
#[rustc_args_required_const(0)]
44
fn foo(_a: i32) {

src/test/ui/stability-attribute/stability-attribute-sanity.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Various checks that stability attributes are used correctly, per RFC 507
22

3-
#![feature(const_fn, staged_api)]
3+
#![feature(staged_api)]
44

55
#![stable(feature = "rust1", since = "1.0.0")]
66

src/test/ui/static/static-drop-scope.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![feature(const_fn)]
2-
31
struct WithDtor;
42

53
impl Drop for WithDtor {

0 commit comments

Comments
 (0)