Skip to content

Commit 09b5c85

Browse files
Remove unnecessary const_fn feature gates
This flag opts out of the min-const-fn checks entirely, which is usually not what we want. The few cases where the flag is still necessary have been annotated.
1 parent 8f1df30 commit 09b5c85

File tree

16 files changed

+29
-40
lines changed

16 files changed

+29
-40
lines changed

src/libcore/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@
7070
#![feature(bound_cloned)]
7171
#![feature(cfg_target_has_atomic)]
7272
#![feature(concat_idents)]
73-
#![feature(const_fn)]
7473
#![feature(const_if_match)]
7574
#![feature(const_panic)]
7675
#![feature(const_fn_union)]

src/libcore/tests/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
#![feature(slice_internals)]
3232
#![feature(slice_partition_dedup)]
3333
#![feature(int_error_matching)]
34-
#![feature(const_fn)]
3534
#![feature(array_value_iter)]
3635
#![feature(iter_partition_in_place)]
3736
#![feature(iter_is_partitioned)]

src/libproc_macro/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
#![feature(nll)]
2222
#![feature(staged_api)]
2323
#![feature(allow_internal_unstable)]
24-
#![feature(const_fn)]
2524
#![feature(decl_macro)]
2625
#![feature(extern_types)]
2726
#![feature(in_band_lifetimes)]

src/librustc/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
#![feature(bool_to_option)]
3232
#![feature(box_patterns)]
3333
#![feature(box_syntax)]
34-
#![feature(const_fn)]
3534
#![feature(const_transmute)]
3635
#![feature(core_intrinsics)]
3736
#![feature(drain_filter)]

src/librustc_hir/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
//! [rustc guide]: https://rust-lang.github.io/rustc-guide/hir.html
44
55
#![feature(crate_visibility_modifier)]
6-
#![feature(const_fn)]
6+
#![feature(const_fn)] // For the unsizing cast on `&[]`
77
#![feature(in_band_lifetimes)]
88
#![feature(specialization)]
99
#![recursion_limit = "256"]

src/librustc_mir/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ Rust MIR: a lowered representation of Rust. Also: an experiment!
1313
#![feature(box_syntax)]
1414
#![feature(crate_visibility_modifier)]
1515
#![feature(core_intrinsics)]
16-
#![feature(const_fn)]
1716
#![feature(decl_macro)]
1817
#![feature(drain_filter)]
1918
#![feature(exhaustive_patterns)]

src/librustc_span/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
//! This API is completely unstable and subject to change.
66
77
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/")]
8-
#![feature(const_fn)]
98
#![feature(crate_visibility_modifier)]
109
#![feature(nll)]
1110
#![feature(optin_builtin_traits)]

src/librustdoc/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
#![feature(test)]
1313
#![feature(ptr_offset_from)]
1414
#![feature(crate_visibility_modifier)]
15-
#![feature(const_fn)]
1615
#![feature(drain_filter)]
1716
#![feature(never_type)]
1817
#![feature(unicode_internals)]

src/libsyntax/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/", test(attr(deny(warnings))))]
88
#![feature(bool_to_option)]
99
#![feature(box_syntax)]
10-
#![feature(const_fn)]
10+
#![feature(const_fn)] // For the `transmute` in `P::new`
1111
#![feature(const_transmute)]
1212
#![feature(crate_visibility_modifier)]
1313
#![feature(label_break_value)]

src/test/ui/consts/const-mut-refs/const_mut_refs.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// run-pass
22

33
#![feature(const_mut_refs)]
4-
#![feature(const_fn)]
54

65
struct Foo {
76
x: usize

src/test/ui/consts/control-flow/exhaustive-c-like-enum-match.rs

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
// check-pass
44

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

87
enum E {
98
A,

src/test/ui/consts/control-flow/feature-gate-const-if-match.if_match.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: fatal error triggered by #[rustc_error]
2-
--> $DIR/feature-gate-const-if-match.rs:109:1
2+
--> $DIR/feature-gate-const-if-match.rs:108:1
33
|
44
LL | / fn main() {
55
LL | | let _ = [0; {

src/test/ui/consts/control-flow/feature-gate-const-if-match.rs

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
#![feature(rustc_attrs)]
88
#![cfg_attr(if_match, feature(const_if_match))]
9-
#![feature(const_fn)]
109

1110
const _: i32 = if true { //[stock]~ ERROR `if` is not allowed in a `const`
1211
5

src/test/ui/consts/control-flow/feature-gate-const-if-match.stock.stderr

+25-25
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0658]: `if` is not allowed in a `const`
2-
--> $DIR/feature-gate-const-if-match.rs:11:16
2+
--> $DIR/feature-gate-const-if-match.rs:10:16
33
|
44
LL | const _: i32 = if true {
55
| ________________^
@@ -13,7 +13,7 @@ LL | | };
1313
= help: add `#![feature(const_if_match)]` to the crate attributes to enable
1414

1515
error[E0658]: `if` is not allowed in a `const`
16-
--> $DIR/feature-gate-const-if-match.rs:17:16
16+
--> $DIR/feature-gate-const-if-match.rs:16:16
1717
|
1818
LL | const _: i32 = if let Some(true) = Some(false) {
1919
| ________________^
@@ -27,7 +27,7 @@ LL | | };
2727
= help: add `#![feature(const_if_match)]` to the crate attributes to enable
2828

2929
error[E0658]: `match` is not allowed in a `const`
30-
--> $DIR/feature-gate-const-if-match.rs:23:16
30+
--> $DIR/feature-gate-const-if-match.rs:22:16
3131
|
3232
LL | const _: i32 = match 1 {
3333
| ________________^
@@ -41,7 +41,7 @@ LL | | };
4141
= help: add `#![feature(const_if_match)]` to the crate attributes to enable
4242

4343
error[E0658]: `if` is not allowed in a `static`
44-
--> $DIR/feature-gate-const-if-match.rs:30:13
44+
--> $DIR/feature-gate-const-if-match.rs:29:13
4545
|
4646
LL | let x = if true { 0 } else { 1 };
4747
| ^^^^^^^^^^^^^^^^^^^^^^^^
@@ -50,7 +50,7 @@ LL | let x = if true { 0 } else { 1 };
5050
= help: add `#![feature(const_if_match)]` to the crate attributes to enable
5151

5252
error[E0658]: `match` is not allowed in a `static`
53-
--> $DIR/feature-gate-const-if-match.rs:32:13
53+
--> $DIR/feature-gate-const-if-match.rs:31:13
5454
|
5555
LL | let x = match x { 0 => 1, _ => 0 };
5656
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -59,7 +59,7 @@ LL | let x = match x { 0 => 1, _ => 0 };
5959
= help: add `#![feature(const_if_match)]` to the crate attributes to enable
6060

6161
error[E0658]: `if` is not allowed in a `static`
62-
--> $DIR/feature-gate-const-if-match.rs:34:5
62+
--> $DIR/feature-gate-const-if-match.rs:33:5
6363
|
6464
LL | if let Some(x) = Some(x) { x } else { 1 }
6565
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -68,7 +68,7 @@ LL | if let Some(x) = Some(x) { x } else { 1 }
6868
= help: add `#![feature(const_if_match)]` to the crate attributes to enable
6969

7070
error[E0658]: `if` is not allowed in a `static mut`
71-
--> $DIR/feature-gate-const-if-match.rs:39:13
71+
--> $DIR/feature-gate-const-if-match.rs:38:13
7272
|
7373
LL | let x = if true { 0 } else { 1 };
7474
| ^^^^^^^^^^^^^^^^^^^^^^^^
@@ -77,7 +77,7 @@ LL | let x = if true { 0 } else { 1 };
7777
= help: add `#![feature(const_if_match)]` to the crate attributes to enable
7878

7979
error[E0658]: `match` is not allowed in a `static mut`
80-
--> $DIR/feature-gate-const-if-match.rs:41:13
80+
--> $DIR/feature-gate-const-if-match.rs:40:13
8181
|
8282
LL | let x = match x { 0 => 1, _ => 0 };
8383
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -86,7 +86,7 @@ LL | let x = match x { 0 => 1, _ => 0 };
8686
= help: add `#![feature(const_if_match)]` to the crate attributes to enable
8787

8888
error[E0658]: `if` is not allowed in a `static mut`
89-
--> $DIR/feature-gate-const-if-match.rs:43:5
89+
--> $DIR/feature-gate-const-if-match.rs:42:5
9090
|
9191
LL | if let Some(x) = Some(x) { x } else { 1 }
9292
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -95,7 +95,7 @@ LL | if let Some(x) = Some(x) { x } else { 1 }
9595
= help: add `#![feature(const_if_match)]` to the crate attributes to enable
9696

9797
error[E0658]: `if` is not allowed in a `const fn`
98-
--> $DIR/feature-gate-const-if-match.rs:48:5
98+
--> $DIR/feature-gate-const-if-match.rs:47:5
9999
|
100100
LL | if true { 5 } else { 6 }
101101
| ^^^^^^^^^^^^^^^^^^^^^^^^
@@ -104,7 +104,7 @@ LL | if true { 5 } else { 6 }
104104
= help: add `#![feature(const_if_match)]` to the crate attributes to enable
105105

106106
error[E0658]: `if` is not allowed in a `const fn`
107-
--> $DIR/feature-gate-const-if-match.rs:52:5
107+
--> $DIR/feature-gate-const-if-match.rs:51:5
108108
|
109109
LL | / if let Some(true) = a {
110110
LL | | 0
@@ -117,7 +117,7 @@ LL | | }
117117
= help: add `#![feature(const_if_match)]` to the crate attributes to enable
118118

119119
error[E0658]: `match` is not allowed in a `const fn`
120-
--> $DIR/feature-gate-const-if-match.rs:60:5
120+
--> $DIR/feature-gate-const-if-match.rs:59:5
121121
|
122122
LL | / match i {
123123
LL | | i if i > 10 => i,
@@ -130,7 +130,7 @@ LL | | }
130130
= help: add `#![feature(const_if_match)]` to the crate attributes to enable
131131

132132
error[E0658]: `if` is not allowed in a `const fn`
133-
--> $DIR/feature-gate-const-if-match.rs:91:17
133+
--> $DIR/feature-gate-const-if-match.rs:90:17
134134
|
135135
LL | let x = if y { 0 } else { 1 };
136136
| ^^^^^^^^^^^^^^^^^^^^^
@@ -139,7 +139,7 @@ LL | let x = if y { 0 } else { 1 };
139139
= help: add `#![feature(const_if_match)]` to the crate attributes to enable
140140

141141
error[E0658]: `match` is not allowed in a `const fn`
142-
--> $DIR/feature-gate-const-if-match.rs:93:17
142+
--> $DIR/feature-gate-const-if-match.rs:92:17
143143
|
144144
LL | let x = match x { 0 => 1, _ => 0 };
145145
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -148,7 +148,7 @@ LL | let x = match x { 0 => 1, _ => 0 };
148148
= help: add `#![feature(const_if_match)]` to the crate attributes to enable
149149

150150
error[E0658]: `if` is not allowed in a `const fn`
151-
--> $DIR/feature-gate-const-if-match.rs:95:9
151+
--> $DIR/feature-gate-const-if-match.rs:94:9
152152
|
153153
LL | if let Some(x) = Some(x) { x } else { 1 }
154154
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -157,7 +157,7 @@ LL | if let Some(x) = Some(x) { x } else { 1 }
157157
= help: add `#![feature(const_if_match)]` to the crate attributes to enable
158158

159159
error[E0658]: `if` is not allowed in a `const`
160-
--> $DIR/feature-gate-const-if-match.rs:111:17
160+
--> $DIR/feature-gate-const-if-match.rs:110:17
161161
|
162162
LL | let x = if false { 0 } else { 1 };
163163
| ^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -166,7 +166,7 @@ LL | let x = if false { 0 } else { 1 };
166166
= help: add `#![feature(const_if_match)]` to the crate attributes to enable
167167

168168
error[E0658]: `match` is not allowed in a `const`
169-
--> $DIR/feature-gate-const-if-match.rs:113:17
169+
--> $DIR/feature-gate-const-if-match.rs:112:17
170170
|
171171
LL | let x = match x { 0 => 1, _ => 0 };
172172
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -175,7 +175,7 @@ LL | let x = match x { 0 => 1, _ => 0 };
175175
= help: add `#![feature(const_if_match)]` to the crate attributes to enable
176176

177177
error[E0658]: `if` is not allowed in a `const`
178-
--> $DIR/feature-gate-const-if-match.rs:115:9
178+
--> $DIR/feature-gate-const-if-match.rs:114:9
179179
|
180180
LL | if let Some(x) = Some(x) { x } else { 1 }
181181
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -184,7 +184,7 @@ LL | if let Some(x) = Some(x) { x } else { 1 }
184184
= help: add `#![feature(const_if_match)]` to the crate attributes to enable
185185

186186
error[E0658]: `if` is not allowed in a `const`
187-
--> $DIR/feature-gate-const-if-match.rs:68:21
187+
--> $DIR/feature-gate-const-if-match.rs:67:21
188188
|
189189
LL | const IF: i32 = if true { 5 } else { 6 };
190190
| ^^^^^^^^^^^^^^^^^^^^^^^^
@@ -193,7 +193,7 @@ LL | const IF: i32 = if true { 5 } else { 6 };
193193
= help: add `#![feature(const_if_match)]` to the crate attributes to enable
194194

195195
error[E0658]: `if` is not allowed in a `const`
196-
--> $DIR/feature-gate-const-if-match.rs:71:25
196+
--> $DIR/feature-gate-const-if-match.rs:70:25
197197
|
198198
LL | const IF_LET: i32 = if let Some(true) = None { 5 } else { 6 };
199199
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -202,7 +202,7 @@ LL | const IF_LET: i32 = if let Some(true) = None { 5 } else { 6 };
202202
= help: add `#![feature(const_if_match)]` to the crate attributes to enable
203203

204204
error[E0658]: `match` is not allowed in a `const`
205-
--> $DIR/feature-gate-const-if-match.rs:74:24
205+
--> $DIR/feature-gate-const-if-match.rs:73:24
206206
|
207207
LL | const MATCH: i32 = match 0 { 1 => 2, _ => 0 };
208208
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -211,7 +211,7 @@ LL | const MATCH: i32 = match 0 { 1 => 2, _ => 0 };
211211
= help: add `#![feature(const_if_match)]` to the crate attributes to enable
212212

213213
error[E0658]: `if` is not allowed in a `const`
214-
--> $DIR/feature-gate-const-if-match.rs:79:21
214+
--> $DIR/feature-gate-const-if-match.rs:78:21
215215
|
216216
LL | const IF: i32 = if true { 5 } else { 6 };
217217
| ^^^^^^^^^^^^^^^^^^^^^^^^
@@ -220,7 +220,7 @@ LL | const IF: i32 = if true { 5 } else { 6 };
220220
= help: add `#![feature(const_if_match)]` to the crate attributes to enable
221221

222222
error[E0658]: `if` is not allowed in a `const`
223-
--> $DIR/feature-gate-const-if-match.rs:82:25
223+
--> $DIR/feature-gate-const-if-match.rs:81:25
224224
|
225225
LL | const IF_LET: i32 = if let Some(true) = None { 5 } else { 6 };
226226
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -229,7 +229,7 @@ LL | const IF_LET: i32 = if let Some(true) = None { 5 } else { 6 };
229229
= help: add `#![feature(const_if_match)]` to the crate attributes to enable
230230

231231
error[E0658]: `match` is not allowed in a `const`
232-
--> $DIR/feature-gate-const-if-match.rs:85:24
232+
--> $DIR/feature-gate-const-if-match.rs:84:24
233233
|
234234
LL | const MATCH: i32 = match 0 { 1 => 2, _ => 0 };
235235
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -238,7 +238,7 @@ LL | const MATCH: i32 = match 0 { 1 => 2, _ => 0 };
238238
= help: add `#![feature(const_if_match)]` to the crate attributes to enable
239239

240240
error[E0019]: constant contains unimplemented expression type
241-
--> $DIR/feature-gate-const-if-match.rs:115:21
241+
--> $DIR/feature-gate-const-if-match.rs:114:21
242242
|
243243
LL | if let Some(x) = Some(x) { x } else { 1 }
244244
| ^

src/test/ui/consts/control-flow/short-circuit-let.rs

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
#![feature(const_if_match)]
66
#![feature(const_panic)]
7-
#![feature(const_fn)]
87

98
const X: i32 = {
109
let mut x = 0;

src/test/ui/consts/control-flow/single_variant_match_ice.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// check-pass
22

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

55
enum Foo {
66
Prob,

0 commit comments

Comments
 (0)