Skip to content

Commit ec74d35

Browse files
committed
Stabilize min_const_fn
1 parent b8bea5a commit ec74d35

File tree

68 files changed

+143
-223
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+143
-223
lines changed

src/liballoc/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
#![feature(box_syntax)]
8787
#![feature(cfg_target_has_atomic)]
8888
#![feature(coerce_unsized)]
89-
#![feature(min_const_fn)]
89+
#![cfg_attr(stage0, feature(min_const_fn))]
9090
#![feature(core_intrinsics)]
9191
#![feature(custom_attribute)]
9292
#![feature(dropck_eyepatch)]

src/liballoc/tests/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#![feature(allocator_api)]
1212
#![feature(alloc_system)]
1313
#![feature(box_syntax)]
14-
#![feature(min_const_fn)]
14+
#![cfg_attr(stage0, feature(min_const_fn))]
1515
#![feature(drain_filter)]
1616
#![feature(exact_size_is_empty)]
1717
#![feature(pattern)]

src/librustc/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242

4343
#![feature(box_patterns)]
4444
#![feature(box_syntax)]
45-
#![feature(min_const_fn)]
45+
#![cfg_attr(stage0, feature(min_const_fn))]
4646
#![feature(core_intrinsics)]
4747
#![feature(drain_filter)]
4848
#![cfg_attr(windows, feature(libc))]

src/librustc/ty/constness.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> {
6565
_ => true,
6666
}
6767
} else {
68-
// users enabling the `const_fn` can do what they want
68+
// users enabling the `const_fn` feature gate can do what they want
6969
!self.sess.features_untracked().const_fn
7070
}
7171
}

src/librustc_target/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
html_root_url = "https://doc.rust-lang.org/nightly/")]
2323

2424
#![feature(box_syntax)]
25-
#![feature(min_const_fn)]
25+
#![cfg_attr(stage0, feature(min_const_fn))]
2626
#![feature(nll)]
2727
#![feature(slice_patterns)]
2828

src/libstd/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@
250250
#![feature(cfg_target_vendor)]
251251
#![feature(char_error_internals)]
252252
#![feature(compiler_builtins_lib)]
253-
#![feature(min_const_fn)]
253+
#![cfg_attr(stage0, feature(min_const_fn))]
254254
#![feature(const_int_ops)]
255255
#![feature(const_ip)]
256256
#![feature(const_raw_ptr_deref)]

src/libsyntax/attr/builtin.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,7 @@ pub struct Stability {
107107
pub level: StabilityLevel,
108108
pub feature: Symbol,
109109
pub rustc_depr: Option<RustcDeprecation>,
110-
/// `None` means the function is stable but needs to be allowed by the
111-
/// `min_const_fn` feature
110+
/// `None` means the function is stable but needs to be a stable const fn, too
112111
/// `Some` contains the feature gate required to be able to use the function
113112
/// as const fn
114113
pub const_stability: Option<Symbol>,

src/libsyntax/feature_gate.rs

+1-8
Original file line numberDiff line numberDiff line change
@@ -1806,9 +1806,6 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
18061806
if header.asyncness.is_async() {
18071807
gate_feature_post!(&self, async_await, span, "async fn is unstable");
18081808
}
1809-
if header.constness.node == ast::Constness::Const {
1810-
gate_feature_post!(&self, min_const_fn, span, "const fn is unstable");
1811-
}
18121809
// stability of const fn methods are covered in
18131810
// visit_trait_item and visit_impl_item below; this is
18141811
// because default methods don't pass through this
@@ -1863,11 +1860,7 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
18631860
}
18641861

18651862
match ii.node {
1866-
ast::ImplItemKind::Method(ref sig, _) => {
1867-
if sig.header.constness.node == ast::Constness::Const {
1868-
gate_feature_post!(&self, min_const_fn, ii.span, "const fn is unstable");
1869-
}
1870-
}
1863+
ast::ImplItemKind::Method(..) => {}
18711864
ast::ImplItemKind::Existential(..) => {
18721865
gate_feature_post!(
18731866
&self,

src/test/codegen-units/item-collection/unreferenced-const-fn.rs

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

1414
// NB: We do not expect *any* monomorphization to be generated here.
1515

16-
#![feature(min_const_fn)]
1716
#![deny(dead_code)]
1817
#![crate_type = "rlib"]
1918

src/test/codegen/link-dead-code.rs

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

1111
// compile-flags:-Clink-dead-code
1212

13-
#![feature(min_const_fn)]
1413
#![crate_type = "rlib"]
1514

1615
// This test makes sure that, when -Clink-dead-code is specified, we generate

src/test/compile-fail/issue-43733-2.rs

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![feature(min_const_fn)]
1211
#![feature(cfg_target_thread_local, thread_local_internals)]
1312

1413
// On platforms *without* `#[thread_local]`, use

src/test/mir-opt/lower_128bit_debug_test.rs

-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515

1616
// compile-flags: -Z lower_128bit_ops=yes -C debug_assertions=yes
1717

18-
#![feature(min_const_fn)]
19-
2018
static TEST_SIGNED: i128 = const_signed(-222);
2119
static TEST_UNSIGNED: u128 = const_unsigned(200);
2220

src/test/mir-opt/lower_128bit_test.rs

-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212

1313
// compile-flags: -Z lower_128bit_ops=yes -C debug_assertions=no -O
1414

15-
#![feature(min_const_fn)]
16-
1715
static TEST_SIGNED: i128 = const_signed(-222);
1816
static TEST_UNSIGNED: u128 = const_unsigned(200);
1917

src/test/run-fail/issue-29798.rs

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

1111
// error-pattern:index out of bounds: the len is 5 but the index is 5
1212

13-
#![feature(min_const_fn)]
1413
const fn test(x: usize) -> i32 {
1514
[42;5][x]
1615
}

src/test/run-pass-fulldeps/newtype_index.rs

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

33
#[macro_use] extern crate rustc_data_structures;
44
extern crate rustc_serialize;

src/test/run-pass/consts/auxiliary/const_fn_lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,5 @@
1111
// Crate that exports a const fn. Used for testing cross-crate.
1212

1313
#![crate_type="rlib"]
14-
#![feature(min_const_fn)]
1514

1615
pub const fn foo() -> usize { 22 }

src/test/run-pass/consts/const-fn-const-eval.rs

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

1111
// run-pass
1212
#![allow(dead_code)]
13-
#![feature(min_const_fn)]
1413

1514
const fn add(x: usize, y: usize) -> usize {
1615
x + y

src/test/run-pass/consts/const-fn-method.rs

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
// except according to those terms.
1010

1111
// run-pass
12-
#![feature(min_const_fn)]
1312

1413
struct Foo { value: u32 }
1514

src/test/run-pass/consts/const-fn-nested.rs

-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
// run-pass
1212
// Test a call whose argument is the result of another call.
1313

14-
#![feature(min_const_fn)]
15-
1614
const fn sub(x: u32, y: u32) -> u32 {
1715
x - y
1816
}

src/test/run-pass/consts/const-meth-pattern.rs

-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010

1111
// run-pass
1212

13-
#![feature(min_const_fn)]
14-
1513
struct A;
1614

1715
impl A {

src/test/run-pass/consts/const-pattern-variant.rs

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

1111
// run-pass
1212
#![allow(unreachable_patterns)]
13-
#![feature(min_const_fn)]
1413

1514
#[derive(PartialEq, Eq)]
1615
enum Cake {

src/test/run-pass/consts/const-size_of-align_of.rs

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

1111
// run-pass
1212
#![allow(dead_code)]
13-
#![feature(min_const_fn)]
1413

1514
use std::mem;
1615

src/test/run-pass/consts/const-unsafe-fn.rs

-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
#![allow(dead_code)]
1313
// A quick test of 'unsafe const fn' functionality
1414

15-
#![feature(min_const_fn)]
16-
1715
const unsafe fn dummy(v: u32) -> u32 {
1816
!v
1917
}

src/test/run-pass/consts/consts-in-patterns.rs

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
// except according to those terms.
1010

1111
// run-pass
12-
#![feature(min_const_fn)]
1312

1413
const FOO: isize = 10;
1514
const BAR: isize = 3;

src/test/run-pass/ctfe/ice-48279.rs

-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414

1515
// https://github.com/rust-lang/rust/issues/48279
1616

17-
#![feature(min_const_fn)]
18-
1917
#[derive(PartialEq, Eq)]
2018
pub struct NonZeroU32 {
2119
value: u32

src/test/run-pass/ctfe/match-const-fn-structs.rs

-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313

1414
// https://github.com/rust-lang/rust/issues/46114
1515

16-
#![feature(min_const_fn)]
17-
1816
#[derive(Eq, PartialEq)]
1917
struct A { value: u32 }
2018

src/test/run-pass/ctfe/return-in-const-fn.rs

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

1313
// https://github.com/rust-lang/rust/issues/43754
1414

15-
#![feature(min_const_fn)]
1615
const fn foo(x: usize) -> usize {
1716
return x;
1817
}

src/test/run-pass/issues/auxiliary/issue-36954.rs

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![feature(min_const_fn)]
1211
#![crate_type = "lib"]
1312

1413
const fn foo(i: i32) -> i32 {

src/test/run-pass/issues/issue-29927.rs

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

1111
// run-pass
1212
#![allow(dead_code)]
13-
#![feature(min_const_fn)]
1413
struct A {
1514
field: usize,
1615
}

src/test/run-pass/issues/issue-33537.rs

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
// except according to those terms.
1010

1111
// run-pass
12-
#![feature(min_const_fn)]
1312

1413
const fn foo() -> *const i8 {
1514
b"foo" as *const _ as *const i8

src/test/run-pass/issues/issue-37991.rs

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
// except according to those terms.
1010

1111
// run-pass
12-
#![feature(min_const_fn)]
1312

1413
const fn foo() -> i64 {
1514
3

src/test/run-pass/issues/issue29927-1.rs

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

1111
// run-pass
1212
#![allow(dead_code)]
13-
#![feature(min_const_fn)]
1413
const fn f() -> usize {
1514
5
1615
}

src/test/rustdoc/auxiliary/issue-27362.rs

-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010

1111
// compile-flags: -Cmetadata=aux
1212

13-
#![feature(min_const_fn)]
14-
1513
pub const fn foo() {}
1614
pub const unsafe fn bar() {}
1715

src/test/rustdoc/const-fn.rs

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![feature(min_const_fn)]
1211
#![crate_name = "foo"]
1312

1413
// @has foo/fn.bar.html

src/test/rustdoc/const.rs

-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010

1111
#![crate_type="lib"]
1212

13-
#![feature(min_const_fn)]
14-
1513
pub struct Foo;
1614

1715
impl Foo {

src/test/ui/borrowck/move-in-static-initializer-issue-38520.ast.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
error[E0507]: cannot move out of borrowed content
2-
--> $DIR/move-in-static-initializer-issue-38520.rs:27:23
2+
--> $DIR/move-in-static-initializer-issue-38520.rs:25:23
33
|
44
LL | static Y: usize = get(*&X); //[ast]~ ERROR E0507
55
| ^^^ cannot move out of borrowed content
66

77
error[E0507]: cannot move out of borrowed content
8-
--> $DIR/move-in-static-initializer-issue-38520.rs:29:22
8+
--> $DIR/move-in-static-initializer-issue-38520.rs:27:22
99
|
1010
LL | const Z: usize = get(*&X); //[ast]~ ERROR E0507
1111
| ^^^ cannot move out of borrowed content

src/test/ui/borrowck/move-in-static-initializer-issue-38520.mir.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
error[E0507]: cannot move out of borrowed content
2-
--> $DIR/move-in-static-initializer-issue-38520.rs:27:23
2+
--> $DIR/move-in-static-initializer-issue-38520.rs:25:23
33
|
44
LL | static Y: usize = get(*&X); //[ast]~ ERROR E0507
55
| ^^^ cannot move out of borrowed content
66

77
error[E0507]: cannot move out of borrowed content
8-
--> $DIR/move-in-static-initializer-issue-38520.rs:29:22
8+
--> $DIR/move-in-static-initializer-issue-38520.rs:27:22
99
|
1010
LL | const Z: usize = get(*&X); //[ast]~ ERROR E0507
1111
| ^^^ cannot move out of borrowed content

src/test/ui/borrowck/move-in-static-initializer-issue-38520.rs

-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
// permitted as `Foo` is not copy (even in a static/const
1616
// initializer).
1717

18-
#![feature(min_const_fn)]
19-
2018
struct Foo(usize);
2119

2220
const fn get(x: Foo) -> usize {

src/test/ui/consts/auxiliary/const_fn_lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,5 @@
1111
// Crate that exports a const fn. Used for testing cross-crate.
1212

1313
#![crate_type="rlib"]
14-
#![feature(min_const_fn)]
1514

1615
pub const fn foo() -> usize { 22 } //~ ERROR const fn is unstable

src/test/ui/consts/const-eval/issue-43197.rs

-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010

1111
#![warn(const_err)]
1212

13-
#![feature(min_const_fn)]
14-
1513
const fn foo(x: u32) -> u32 {
1614
x
1715
}

0 commit comments

Comments
 (0)