Skip to content

Commit

Permalink
Restrict most uses of const_fn to min_const_fn
Browse files Browse the repository at this point in the history
  • Loading branch information
oli-obk committed Aug 31, 2018
1 parent 7b3d930 commit d125e90
Show file tree
Hide file tree
Showing 41 changed files with 43 additions and 42 deletions.
3 changes: 2 additions & 1 deletion src/liballoc/lib.rs
Expand Up @@ -88,7 +88,8 @@
#![feature(box_syntax)]
#![feature(cfg_target_has_atomic)]
#![feature(coerce_unsized)]
#![feature(const_fn)]
#![cfg_attr(stage0, feature(const_fn))]
#![cfg_attr(not(stage0), feature(min_const_fn))]
#![feature(core_intrinsics)]
#![feature(custom_attribute)]
#![feature(dropck_eyepatch)]
Expand Down
3 changes: 2 additions & 1 deletion src/liballoc/tests/lib.rs
Expand Up @@ -11,7 +11,8 @@
#![feature(allocator_api)]
#![feature(alloc_system)]
#![feature(box_syntax)]
#![feature(const_fn)]
#![cfg_attr(stage0, feature(const_fn))]
#![cfg_attr(not(stage0), feature(min_const_fn))]
#![feature(drain_filter)]
#![feature(exact_size_is_empty)]
#![feature(pattern)]
Expand Down
3 changes: 2 additions & 1 deletion src/librustc/lib.rs
Expand Up @@ -42,7 +42,8 @@

#![feature(box_patterns)]
#![feature(box_syntax)]
#![feature(const_fn)]
#![cfg_attr(stage0, feature(const_fn))]
#![cfg_attr(not(stage0), feature(min_const_fn))]
#![feature(core_intrinsics)]
#![feature(drain_filter)]
#![cfg_attr(windows, feature(libc))]
Expand Down
1 change: 0 additions & 1 deletion src/librustc_mir/lib.rs
Expand Up @@ -23,7 +23,6 @@ Rust MIR: a lowered representation of Rust. Also: an experiment!
#![feature(box_patterns)]
#![feature(box_syntax)]
#![feature(crate_visibility_modifier)]
#![feature(const_fn)]
#![feature(core_intrinsics)]
#![feature(decl_macro)]
#![cfg_attr(stage0, feature(macro_vis_matcher))]
Expand Down
3 changes: 2 additions & 1 deletion src/librustc_target/lib.rs
Expand Up @@ -22,7 +22,8 @@
html_root_url = "https://doc.rust-lang.org/nightly/")]

#![feature(box_syntax)]
#![feature(const_fn)]
#![cfg_attr(stage0, feature(const_fn))]
#![cfg_attr(not(stage0), feature(min_const_fn))]
#![cfg_attr(not(stage0), feature(nll))]
#![cfg_attr(not(stage0), feature(infer_outlives_requirements))]
#![feature(slice_patterns)]
Expand Down
Expand Up @@ -13,7 +13,7 @@

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

#![feature(const_fn)]
#![feature(min_const_fn)]
#![deny(dead_code)]
#![crate_type = "rlib"]

Expand Down
2 changes: 1 addition & 1 deletion src/test/codegen/link-dead-code.rs
Expand Up @@ -10,7 +10,7 @@

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

#![feature(const_fn)]
#![feature(min_const_fn)]
#![crate_type = "rlib"]

// This test makes sure that, when -Clink-dead-code is specified, we generate
Expand Down
2 changes: 1 addition & 1 deletion src/test/compile-fail/issue-43733-2.rs
Expand Up @@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![feature(const_fn)]
#![feature(min_const_fn)]
#![feature(cfg_target_thread_local, thread_local_internals)]

// On platforms *without* `#[thread_local]`, use
Expand Down
2 changes: 1 addition & 1 deletion src/test/mir-opt/lower_128bit_debug_test.rs
Expand Up @@ -15,7 +15,7 @@

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

#![feature(const_fn)]
#![feature(min_const_fn)]

static TEST_SIGNED: i128 = const_signed(-222);
static TEST_UNSIGNED: u128 = const_unsigned(200);
Expand Down
2 changes: 1 addition & 1 deletion src/test/mir-opt/lower_128bit_test.rs
Expand Up @@ -12,7 +12,7 @@

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

#![feature(const_fn)]
#![feature(min_const_fn)]

static TEST_SIGNED: i128 = const_signed(-222);
static TEST_UNSIGNED: u128 = const_unsigned(200);
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-fail/issue-29798.rs
Expand Up @@ -10,7 +10,7 @@

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

#![feature(const_fn)]
#![feature(min_const_fn)]
const fn test(x: usize) -> i32 {
[42;5][x]
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/auxiliary/const_fn_lib.rs
Expand Up @@ -11,6 +11,6 @@
// Crate that exports a const fn. Used for testing cross-crate.

#![crate_type="rlib"]
#![feature(const_fn)]
#![feature(min_const_fn)]

pub const fn foo() -> usize { 22 }
2 changes: 1 addition & 1 deletion src/test/run-pass/auxiliary/issue-36954.rs
Expand Up @@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![feature(const_fn)]
#![feature(min_const_fn)]
#![crate_type = "lib"]

const fn foo(i: i32) -> i32 {
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/const-fn-const-eval.rs
Expand Up @@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![feature(const_fn)]
#![feature(min_const_fn)]

const fn add(x: usize, y: usize) -> usize {
x + y
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/const-fn-method.rs
Expand Up @@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![feature(const_fn)]
#![feature(min_const_fn)]

struct Foo { value: u32 }

Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/const-fn-nested.rs
Expand Up @@ -10,7 +10,7 @@

// Test a call whose argument is the result of another call.

#![feature(const_fn)]
#![feature(min_const_fn)]

const fn sub(x: u32, y: u32) -> u32 {
x - y
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/const-meth-pattern.rs
Expand Up @@ -7,7 +7,7 @@
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(const_fn)]
#![feature(min_const_fn)]

struct A;

Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/const-pattern-variant.rs
Expand Up @@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![feature(const_fn)]
#![feature(min_const_fn)]

#[derive(PartialEq, Eq)]
enum Cake {
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/const-size_of-align_of.rs
Expand Up @@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![feature(const_fn)]
#![feature(min_const_fn)]

use std::mem;

Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/const-unsafe-fn.rs
Expand Up @@ -10,7 +10,7 @@

// A quick test of 'unsafe const fn' functionality

#![feature(const_fn)]
#![feature(min_const_fn)]

const unsafe fn dummy(v: u32) -> u32 {
!v
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/consts-in-patterns.rs
Expand Up @@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![feature(const_fn)]
#![feature(min_const_fn)]

const FOO: isize = 10;
const BAR: isize = 3;
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/ctfe/ice-48279.rs
Expand Up @@ -10,7 +10,7 @@

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

#![feature(const_fn)]
#![feature(min_const_fn)]

#[derive(PartialEq, Eq)]
pub struct NonZeroU32 {
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/ctfe/match-const-fn-structs.rs
Expand Up @@ -10,7 +10,7 @@

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

#![feature(const_fn)]
#![feature(min_const_fn)]

#[derive(Eq, PartialEq)]
struct A { value: u32 }
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/ctfe/return-in-const-fn.rs
Expand Up @@ -10,7 +10,7 @@

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

#![feature(const_fn)]
#![feature(min_const_fn)]
const fn foo(x: usize) -> usize {
return x;
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/issue-28822.rs
Expand Up @@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![feature(const_fn)]
#![feature(min_const_fn)]

fn main() {}

Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/issue-29927.rs
Expand Up @@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![feature(const_fn)]
#![feature(min_const_fn)]
struct A {
field: usize,
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/issue-33537.rs
Expand Up @@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![feature(const_fn)]
#![feature(min_const_fn)]

const fn foo() -> *const i8 {
b"foo" as *const _ as *const i8
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/issue-37991.rs
Expand Up @@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![feature(const_fn)]
#![feature(min_const_fn)]

const fn foo() -> i64 {
3
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/issue29927-1.rs
Expand Up @@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![feature(const_fn)]
#![feature(min_const_fn)]
const fn f() -> usize {
5
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/rustdoc/auxiliary/issue-27362.rs
Expand Up @@ -10,7 +10,7 @@

// compile-flags: -Cmetadata=aux

#![feature(const_fn)]
#![feature(min_const_fn)]

pub const fn foo() {}
pub const unsafe fn bar() {}
Expand Down
2 changes: 1 addition & 1 deletion src/test/rustdoc/const-fn.rs
Expand Up @@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![feature(const_fn)]
#![feature(min_const_fn)]
#![crate_name = "foo"]

// @has foo/fn.bar.html
Expand Down
2 changes: 1 addition & 1 deletion src/test/rustdoc/const.rs
Expand Up @@ -10,7 +10,7 @@

#![crate_type="lib"]

#![feature(const_fn)]
#![feature(min_const_fn)]

pub struct Foo;

Expand Down
Expand Up @@ -15,7 +15,7 @@
// permitted as `Foo` is not copy (even in a static/const
// initializer).

#![feature(const_fn)]
#![feature(min_const_fn)]

struct Foo(usize);

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/consts/auxiliary/const_fn_lib.rs
Expand Up @@ -11,6 +11,6 @@
// Crate that exports a const fn. Used for testing cross-crate.

#![crate_type="rlib"]
#![feature(const_fn)]
#![feature(min_const_fn)]

pub const fn foo() -> usize { 22 } //~ ERROR const fn is unstable
2 changes: 1 addition & 1 deletion src/test/ui/consts/const-eval/issue-43197.rs
Expand Up @@ -10,7 +10,7 @@

#![warn(const_err)]

#![feature(const_fn)]
#![feature(min_const_fn)]

const fn foo(x: u32) -> u32 {
x
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/consts/const-eval/issue-47971.rs
Expand Up @@ -10,7 +10,7 @@

// compile-pass

#![feature(const_fn)]
#![feature(min_const_fn)]

struct S(pub &'static u32, pub u32);

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/consts/const-pattern-not-const-evaluable.rs
Expand Up @@ -10,7 +10,7 @@

// compile-pass

#![feature(const_fn)]
#![feature(min_const_fn)]

#[derive(PartialEq, Eq)]
enum Cake {
Expand Down
2 changes: 0 additions & 2 deletions src/test/ui/consts/const-size_of-cycle.rs
Expand Up @@ -10,8 +10,6 @@

// error-pattern: cycle detected

#![feature(const_fn)]

struct Foo {
bytes: [u8; std::mem::size_of::<Foo>()]
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/infinite/infinite-recursion-const-fn.rs
Expand Up @@ -10,7 +10,7 @@

//https://github.com/rust-lang/rust/issues/31364

#![feature(const_fn)]
#![feature(min_const_fn)]
const fn a() -> usize { b() }
const fn b() -> usize { a() }
const ARR: [i32; a()] = [5; 6]; //~ ERROR could not evaluate constant expression
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/issues/issue-44415.rs
Expand Up @@ -10,7 +10,7 @@

//~^^^^^^^^^^ ERROR cycle detected when computing layout of

#![feature(const_fn)]

#![feature(core_intrinsics)]

use std::intrinsics;
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/unsafe/unsafe-const-fn.rs
Expand Up @@ -10,7 +10,7 @@

// A quick test of 'unsafe const fn' functionality

#![feature(const_fn)]
#![feature(min_const_fn)]

const unsafe fn dummy(v: u32) -> u32 {
!v
Expand Down

0 comments on commit d125e90

Please sign in to comment.