about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2017-09-16 17:02:17 +0000
committerbors <bors@rust-lang.org>2017-09-16 17:02:17 +0000
commitae8efdc87d5f4e22e05e1b60a72272cee87fa74c (patch)
treefc7932f915f347bd68db4143b2e097e620faa538 /src/test
parentb965d55a3214b78ec9ffdd3017cb6aaa62c28059 (diff)
parent332c38cd70e372f56356e02b18b88919fcb58a66 (diff)
downloadrust-ae8efdc87d5f4e22e05e1b60a72272cee87fa74c.tar.gz
rust-ae8efdc87d5f4e22e05e1b60a72272cee87fa74c.zip
Auto merge of #43017 - durka:stabilize-const-invocation, r=eddyb
Individualize feature gates for const fn invocation

This PR changes the meaning of `#![feature(const_fn)]` so it is only required to declare a const fn but not to call one. Based on discussion at #24111. I was hoping we could have an FCP here in order to move that conversation forward.

This sets the stage for future stabilization of the constness of several functions in the standard library (listed below), so could someone please tag the lang team for review.

- `std::cell`
    - `Cell::new`
    - `RefCell::new`
    - `UnsafeCell::new`
- `std::mem`
    - `size_of`
    - `align_of`
- `std::ptr`
    - `null`
    - `null_mut`
- `std::sync`
    - `atomic`
        - `Atomic{Bool,Ptr,Isize,Usize}::new`
    - `once`
        - `Once::new`
- primitives
    - `{integer}::min_value`
    - `{integer}::max_value`

Some other functions are const but they are also unstable or hidden, e.g. `Unique::new` so they don't have to be considered at this time.

After this stabilization, the following `*_INIT` constants in the standard library can be deprecated. I wasn't sure whether to include those deprecations in the current PR.

- `std::sync`
    - `atomic`
        - `ATOMIC_{BOOL,ISIZE,USIZE}_INIT`
    - `once`
        - `ONCE_INIT`
Diffstat (limited to 'src/test')
-rw-r--r--src/test/compile-fail-fulldeps/dropck_tarena_cycle_checked.rs3
-rw-r--r--src/test/compile-fail/const-call.rs2
-rw-r--r--src/test/compile-fail/const-fn-feature-flags.rs24
-rw-r--r--src/test/compile-fail/dropck_trait_cycle_checked.rs2
-rw-r--r--src/test/compile-fail/feature-gate-rustc_const_unstable.rs (renamed from src/test/run-pass/const-fn-cross-crate.rs)17
-rw-r--r--src/test/compile-fail/functional-struct-update-respects-privacy.rs2
-rw-r--r--src/test/compile-fail/issue-17718-const-borrow.rs2
-rw-r--r--src/test/compile-fail/issue-43733-2.rs2
-rw-r--r--src/test/compile-fail/issue-7364.rs5
-rw-r--r--src/test/compile-fail/stability-attribute-sanity.rs7
-rw-r--r--src/test/debuginfo/constant-debug-locs.rs2
-rw-r--r--src/test/run-pass-valgrind/cast-enum-with-dtor.rs2
-rw-r--r--src/test/run-pass/associated-types-project-from-type-param-via-bound-in-where-clause.rs2
-rw-r--r--src/test/run-pass/auxiliary/const_fn_lib.rs2
-rw-r--r--src/test/run-pass/auxiliary/issue-17718-aux.rs2
-rw-r--r--src/test/run-pass/auxiliary/thread-local-extern-static.rs1
-rw-r--r--src/test/run-pass/box-of-array-of-drop-1.rs2
-rw-r--r--src/test/run-pass/box-of-array-of-drop-2.rs2
-rw-r--r--src/test/run-pass/const-fn-feature-flags.rs25
-rw-r--r--src/test/run-pass/const-fn-stability-calls.rs (renamed from src/test/compile-fail/const-fn-stability-calls.rs)8
-rw-r--r--src/test/run-pass/const-size_of-align_of.rs2
-rw-r--r--src/test/run-pass/issue-17718-static-unsafe-interior.rs3
-rw-r--r--src/test/run-pass/issue-17718.rs2
-rw-r--r--src/test/run-pass/issue-21486.rs2
-rw-r--r--src/test/run-pass/issue-26655.rs4
-rw-r--r--src/test/run-pass/issue-27997.rs2
-rw-r--r--src/test/run-pass/nested-vec-3.rs2
-rw-r--r--src/test/run-pass/panic-handler-chain.rs3
-rw-r--r--src/test/run-pass/panic-handler-set-twice.rs3
-rw-r--r--src/test/run-pass/struct-order-of-eval-3.rs2
-rw-r--r--src/test/run-pass/struct-order-of-eval-4.rs2
-rw-r--r--src/test/run-pass/vector-sort-panic-safe.rs2
-rw-r--r--src/test/ui/span/dropck_arr_cycle_checked.rs2
-rw-r--r--src/test/ui/span/dropck_vec_cycle_checked.rs2
-rw-r--r--src/test/ui/span/vec-must-not-hide-type-from-dropck.rs2
35 files changed, 98 insertions, 51 deletions
diff --git a/src/test/compile-fail-fulldeps/dropck_tarena_cycle_checked.rs b/src/test/compile-fail-fulldeps/dropck_tarena_cycle_checked.rs
index 7de6e58c784..fa85432fb8e 100644
--- a/src/test/compile-fail-fulldeps/dropck_tarena_cycle_checked.rs
+++ b/src/test/compile-fail-fulldeps/dropck_tarena_cycle_checked.rs
@@ -16,7 +16,8 @@
 //  which is a reduction of this code to more directly show the reason
 //  for the error message we see here.)
 
-#![feature(const_fn, rustc_private)]
+#![feature(rustc_private)]
+#![feature(const_atomic_usize_new)]
 
 extern crate arena;
 
diff --git a/src/test/compile-fail/const-call.rs b/src/test/compile-fail/const-call.rs
index 0745ac02d07..18476494300 100644
--- a/src/test/compile-fail/const-call.rs
+++ b/src/test/compile-fail/const-call.rs
@@ -8,8 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(const_fn)]
-
 fn f(x: usize) -> usize {
     x
 }
diff --git a/src/test/compile-fail/const-fn-feature-flags.rs b/src/test/compile-fail/const-fn-feature-flags.rs
new file mode 100644
index 00000000000..823cb89b365
--- /dev/null
+++ b/src/test/compile-fail/const-fn-feature-flags.rs
@@ -0,0 +1,24 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <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.
+
+// Test use of const fns in std using individual feature gates.
+
+use std::cell::Cell;
+
+const CELL: Cell<i32> = Cell::new(42); //~ERROR not yet stable as a const fn
+    //~^HELP #![feature(const_cell_new)]
+
+fn main() {
+    let v = CELL.get();
+    CELL.set(v+1);
+
+    assert_eq!(CELL.get(), v);
+}
+
diff --git a/src/test/compile-fail/dropck_trait_cycle_checked.rs b/src/test/compile-fail/dropck_trait_cycle_checked.rs
index e701718028a..c0f0e3650d9 100644
--- a/src/test/compile-fail/dropck_trait_cycle_checked.rs
+++ b/src/test/compile-fail/dropck_trait_cycle_checked.rs
@@ -13,7 +13,7 @@
 //
 // (Compare against compile-fail/dropck_vec_cycle_checked.rs)
 
-#![feature(const_fn)]
+#![feature(const_atomic_usize_new)]
 
 use std::cell::Cell;
 use id::Id;
diff --git a/src/test/run-pass/const-fn-cross-crate.rs b/src/test/compile-fail/feature-gate-rustc_const_unstable.rs
index 7b4b751fd7f..38a3e15fd7e 100644
--- a/src/test/run-pass/const-fn-cross-crate.rs
+++ b/src/test/compile-fail/feature-gate-rustc_const_unstable.rs
@@ -8,19 +8,16 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// aux-build:const_fn_lib.rs
-
-// A very basic test of const fn functionality.
+// Test internal const fn feature gate.
 
+#![feature(staged_api)]
 #![feature(const_fn)]
+//#![feature(rustc_const_unstable)]
 
-extern crate const_fn_lib;
-
-use const_fn_lib::foo;
-
-const FOO: usize = foo();
+#[stable(feature="zing", since="1.0.0")]
+#[rustc_const_unstable(feature="fzzzzzt")] //~ERROR internal feature
+pub const fn bazinga() {}
 
 fn main() {
-    assert_eq!(FOO, 22);
-    let _: [i32; foo()] = [42; 22];
 }
+
diff --git a/src/test/compile-fail/functional-struct-update-respects-privacy.rs b/src/test/compile-fail/functional-struct-update-respects-privacy.rs
index d2df0d9ef27..3f41401eb69 100644
--- a/src/test/compile-fail/functional-struct-update-respects-privacy.rs
+++ b/src/test/compile-fail/functional-struct-update-respects-privacy.rs
@@ -10,8 +10,6 @@
 
 // RFC 736 (and Issue 21407): functional struct update should respect privacy.
 
-#![feature(const_fn)]
-
 // The `foo` module attempts to maintains an invariant that each `S`
 // has a unique `u64` id.
 use self::foo::S;
diff --git a/src/test/compile-fail/issue-17718-const-borrow.rs b/src/test/compile-fail/issue-17718-const-borrow.rs
index 327b6946822..1464fcd9a1c 100644
--- a/src/test/compile-fail/issue-17718-const-borrow.rs
+++ b/src/test/compile-fail/issue-17718-const-borrow.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(const_fn)]
+#![feature(const_unsafe_cell_new)]
 
 use std::cell::UnsafeCell;
 
diff --git a/src/test/compile-fail/issue-43733-2.rs b/src/test/compile-fail/issue-43733-2.rs
index 0fd31454596..1bf165c89d3 100644
--- a/src/test/compile-fail/issue-43733-2.rs
+++ b/src/test/compile-fail/issue-43733-2.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(const_fn)]
+#![feature(const_fn, const_cell_new, const_unsafe_cell_new)]
 #![feature(cfg_target_thread_local, thread_local_internals)]
 
 // On platforms *without* `#[thread_local]`, use
diff --git a/src/test/compile-fail/issue-7364.rs b/src/test/compile-fail/issue-7364.rs
index bd32317ae78..ef53be75780 100644
--- a/src/test/compile-fail/issue-7364.rs
+++ b/src/test/compile-fail/issue-7364.rs
@@ -8,9 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(box_syntax)]
-#![feature(const_fn)]
-#![allow(warnings)]
+#![feature(box_syntax, const_refcell_new)]
 
 use std::cell::RefCell;
 
@@ -18,5 +16,6 @@ use std::cell::RefCell;
 static boxed: Box<RefCell<isize>> = box RefCell::new(0);
 //~^ ERROR allocations are not allowed in statics
 //~| ERROR `std::cell::RefCell<isize>: std::marker::Sync` is not satisfied
+//~| WARN unsupported constant expr
 
 fn main() { }
diff --git a/src/test/compile-fail/stability-attribute-sanity.rs b/src/test/compile-fail/stability-attribute-sanity.rs
index d35f2cbb584..263ac427b76 100644
--- a/src/test/compile-fail/stability-attribute-sanity.rs
+++ b/src/test/compile-fail/stability-attribute-sanity.rs
@@ -10,7 +10,7 @@
 
 // Various checks that stability attributes are used correctly, per RFC 507
 
-#![feature(staged_api)]
+#![feature(const_fn, staged_api, rustc_const_unstable)]
 
 #![stable(feature = "rust1", since = "1.0.0")]
 
@@ -88,8 +88,11 @@ fn multiple3() { }
 #[stable(feature = "a", since = "b")]
 #[rustc_deprecated(since = "b", reason = "text")]
 #[rustc_deprecated(since = "b", reason = "text")]
-fn multiple4() { } //~ ERROR multiple rustc_deprecated attributes [E0540]
+#[rustc_const_unstable(feature = "a")]
+#[rustc_const_unstable(feature = "b")]
+pub const fn multiple4() { } //~ ERROR multiple rustc_deprecated attributes [E0540]
 //~^ ERROR Invalid stability or deprecation version found
+//~| ERROR multiple rustc_const_unstable attributes
 
 #[rustc_deprecated(since = "a", reason = "text")]
 fn deprecated_without_unstable_or_stable() { }
diff --git a/src/test/debuginfo/constant-debug-locs.rs b/src/test/debuginfo/constant-debug-locs.rs
index 7b7bda30225..7a24510b7d4 100644
--- a/src/test/debuginfo/constant-debug-locs.rs
+++ b/src/test/debuginfo/constant-debug-locs.rs
@@ -15,7 +15,7 @@
 #![allow(dead_code, unused_variables)]
 #![feature(omit_gdb_pretty_printer_section)]
 #![omit_gdb_pretty_printer_section]
-#![feature(const_fn)]
+#![feature(const_unsafe_cell_new)]
 #![feature(static_mutex)]
 
 // This test makes sure that the compiler doesn't crash when trying to assign
diff --git a/src/test/run-pass-valgrind/cast-enum-with-dtor.rs b/src/test/run-pass-valgrind/cast-enum-with-dtor.rs
index 2815863fe99..439c1080f47 100644
--- a/src/test/run-pass-valgrind/cast-enum-with-dtor.rs
+++ b/src/test/run-pass-valgrind/cast-enum-with-dtor.rs
@@ -11,7 +11,7 @@
 // no-prefer-dynamic
 
 #![allow(dead_code)]
-#![feature(const_fn)]
+#![feature(const_atomic_usize_new)]
 
 // check dtor calling order when casting enums.
 
diff --git a/src/test/run-pass/associated-types-project-from-type-param-via-bound-in-where-clause.rs b/src/test/run-pass/associated-types-project-from-type-param-via-bound-in-where-clause.rs
index 8dc7d79ec2a..7cde780cc54 100644
--- a/src/test/run-pass/associated-types-project-from-type-param-via-bound-in-where-clause.rs
+++ b/src/test/run-pass/associated-types-project-from-type-param-via-bound-in-where-clause.rs
@@ -12,7 +12,7 @@
 // `Item` originates in a where-clause, not the declaration of
 // `T`. Issue #20300.
 
-#![feature(const_fn)]
+#![feature(const_atomic_usize_new)]
 
 use std::marker::{PhantomData};
 use std::sync::atomic::{AtomicUsize};
diff --git a/src/test/run-pass/auxiliary/const_fn_lib.rs b/src/test/run-pass/auxiliary/const_fn_lib.rs
index b0d5a6b1272..be06e8dd570 100644
--- a/src/test/run-pass/auxiliary/const_fn_lib.rs
+++ b/src/test/run-pass/auxiliary/const_fn_lib.rs
@@ -13,4 +13,4 @@
 #![crate_type="rlib"]
 #![feature(const_fn)]
 
-pub const fn foo() -> usize { 22 } //~ ERROR const fn is unstable
+pub const fn foo() -> usize { 22 }
diff --git a/src/test/run-pass/auxiliary/issue-17718-aux.rs b/src/test/run-pass/auxiliary/issue-17718-aux.rs
index cf7fdd7f983..36891a1ecad 100644
--- a/src/test/run-pass/auxiliary/issue-17718-aux.rs
+++ b/src/test/run-pass/auxiliary/issue-17718-aux.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(const_fn)]
+#![feature(const_atomic_usize_new)]
 
 use std::sync::atomic;
 
diff --git a/src/test/run-pass/auxiliary/thread-local-extern-static.rs b/src/test/run-pass/auxiliary/thread-local-extern-static.rs
index e9457886be8..bce87ef5a26 100644
--- a/src/test/run-pass/auxiliary/thread-local-extern-static.rs
+++ b/src/test/run-pass/auxiliary/thread-local-extern-static.rs
@@ -9,6 +9,7 @@
 // except according to those terms.
 
 #![feature(cfg_target_thread_local, const_fn, thread_local)]
+#![feature(const_cell_new)]
 #![crate_type = "lib"]
 
 #[cfg(target_thread_local)]
diff --git a/src/test/run-pass/box-of-array-of-drop-1.rs b/src/test/run-pass/box-of-array-of-drop-1.rs
index a63a232e1b5..47b44863a74 100644
--- a/src/test/run-pass/box-of-array-of-drop-1.rs
+++ b/src/test/run-pass/box-of-array-of-drop-1.rs
@@ -13,7 +13,7 @@
 
 // ignore-emscripten no threads support
 
-#![feature(const_fn)]
+#![feature(const_atomic_usize_new)]
 
 use std::thread;
 use std::sync::atomic::{AtomicUsize, Ordering};
diff --git a/src/test/run-pass/box-of-array-of-drop-2.rs b/src/test/run-pass/box-of-array-of-drop-2.rs
index ca179429172..54be4955baf 100644
--- a/src/test/run-pass/box-of-array-of-drop-2.rs
+++ b/src/test/run-pass/box-of-array-of-drop-2.rs
@@ -13,7 +13,7 @@
 
 // ignore-emscripten no threads support
 
-#![feature(const_fn)]
+#![feature(const_atomic_usize_new)]
 
 use std::thread;
 use std::sync::atomic::{AtomicUsize, Ordering};
diff --git a/src/test/run-pass/const-fn-feature-flags.rs b/src/test/run-pass/const-fn-feature-flags.rs
new file mode 100644
index 00000000000..1e27a3edac8
--- /dev/null
+++ b/src/test/run-pass/const-fn-feature-flags.rs
@@ -0,0 +1,25 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <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.
+
+// Test use of const fns in std using individual feature gates.
+
+#![feature(const_cell_new)]
+
+use std::cell::Cell;
+
+const CELL: Cell<i32> = Cell::new(42);
+
+fn main() {
+    let v = CELL.get();
+    CELL.set(v+1);
+
+    assert_eq!(CELL.get(), v);
+}
+
diff --git a/src/test/compile-fail/const-fn-stability-calls.rs b/src/test/run-pass/const-fn-stability-calls.rs
index 609077663ef..c5f97d55c06 100644
--- a/src/test/compile-fail/const-fn-stability-calls.rs
+++ b/src/test/run-pass/const-fn-stability-calls.rs
@@ -16,8 +16,8 @@ extern crate const_fn_lib;
 
 use const_fn_lib::foo;
 
-static FOO: usize = foo(); //~ ERROR const fns are an unstable feature
-const BAR: usize = foo(); //~ ERROR const fns are an unstable feature
+static FOO: usize = foo();
+const BAR: usize = foo();
 
 macro_rules! constant {
     ($n:ident: $t:ty = $v:expr) => {
@@ -26,9 +26,9 @@ macro_rules! constant {
 }
 
 constant! {
-    BAZ: usize = foo() //~ ERROR const fns are an unstable feature
+    BAZ: usize = foo()
 }
 
 fn main() {
-//    let x: [usize; foo()] = [];
+    let x: [usize; foo()] = [42; foo()];
 }
diff --git a/src/test/run-pass/const-size_of-align_of.rs b/src/test/run-pass/const-size_of-align_of.rs
index 06fbe9bf4f6..d5547ea5add 100644
--- a/src/test/run-pass/const-size_of-align_of.rs
+++ b/src/test/run-pass/const-size_of-align_of.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(const_fn)]
+#![feature(const_fn, const_size_of, const_align_of)]
 
 use std::mem;
 
diff --git a/src/test/run-pass/issue-17718-static-unsafe-interior.rs b/src/test/run-pass/issue-17718-static-unsafe-interior.rs
index 993e5e1c1e6..66f70cdaeb0 100644
--- a/src/test/run-pass/issue-17718-static-unsafe-interior.rs
+++ b/src/test/run-pass/issue-17718-static-unsafe-interior.rs
@@ -11,8 +11,7 @@
 // pretty-expanded FIXME #23616
 
 #![feature(core)]
-#![feature(const_fn)]
-
+#![feature(const_unsafe_cell_new)]
 
 use std::marker;
 use std::cell::UnsafeCell;
diff --git a/src/test/run-pass/issue-17718.rs b/src/test/run-pass/issue-17718.rs
index 744e63f159b..1b8fbc1ad2f 100644
--- a/src/test/run-pass/issue-17718.rs
+++ b/src/test/run-pass/issue-17718.rs
@@ -12,7 +12,7 @@
 
 
 #![feature(core)]
-#![feature(const_fn)]
+#![feature(const_atomic_usize_new)]
 
 extern crate issue_17718_aux as other;
 
diff --git a/src/test/run-pass/issue-21486.rs b/src/test/run-pass/issue-21486.rs
index 699189a4e6a..23d06c4324d 100644
--- a/src/test/run-pass/issue-21486.rs
+++ b/src/test/run-pass/issue-21486.rs
@@ -12,7 +12,7 @@
 // created via FRU and control-flow breaks in the middle of
 // construction.
 
-#![feature(const_fn)]
+#![feature(const_atomic_usize_new)]
 
 use std::sync::atomic::{Ordering, AtomicUsize};
 
diff --git a/src/test/run-pass/issue-26655.rs b/src/test/run-pass/issue-26655.rs
index 402460e7253..3e252b8629e 100644
--- a/src/test/run-pass/issue-26655.rs
+++ b/src/test/run-pass/issue-26655.rs
@@ -10,10 +10,10 @@
 
 // ignore-emscripten no threads support
 
-#![feature(const_fn)]
-
 // Check that the destructors of simple enums are run on unwinding
 
+#![feature(const_atomic_usize_new)]
+
 use std::sync::atomic::{Ordering, AtomicUsize};
 use std::thread;
 
diff --git a/src/test/run-pass/issue-27997.rs b/src/test/run-pass/issue-27997.rs
index cd81f689693..dab42e48e16 100644
--- a/src/test/run-pass/issue-27997.rs
+++ b/src/test/run-pass/issue-27997.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(const_fn)]
+#![feature(const_atomic_usize_new)]
 
 use std::sync::atomic::{Ordering, AtomicUsize};
 
diff --git a/src/test/run-pass/nested-vec-3.rs b/src/test/run-pass/nested-vec-3.rs
index 458b6c16e62..9141b5f29ce 100644
--- a/src/test/run-pass/nested-vec-3.rs
+++ b/src/test/run-pass/nested-vec-3.rs
@@ -14,7 +14,7 @@
 // the contents implement Drop and we hit a panic in the middle of
 // construction.
 
-#![feature(const_fn)]
+#![feature(const_atomic_usize_new)]
 
 use std::thread;
 use std::sync::atomic::{AtomicUsize, Ordering};
diff --git a/src/test/run-pass/panic-handler-chain.rs b/src/test/run-pass/panic-handler-chain.rs
index 1ad43f5f17f..c5dc8ccd2ee 100644
--- a/src/test/run-pass/panic-handler-chain.rs
+++ b/src/test/run-pass/panic-handler-chain.rs
@@ -10,7 +10,8 @@
 
 // ignore-emscripten no threads support
 
-#![feature(panic_handler, const_fn, std_panic)]
+#![feature(panic_handler, std_panic)]
+#![feature(const_atomic_usize_new)]
 
 use std::sync::atomic::{AtomicUsize, Ordering};
 use std::panic;
diff --git a/src/test/run-pass/panic-handler-set-twice.rs b/src/test/run-pass/panic-handler-set-twice.rs
index 196e08a63a7..8bf2683cd9f 100644
--- a/src/test/run-pass/panic-handler-set-twice.rs
+++ b/src/test/run-pass/panic-handler-set-twice.rs
@@ -7,7 +7,8 @@
 // <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(panic_handler, const_fn, std_panic)]
+#![feature(panic_handler, std_panic)]
+#![feature(const_atomic_usize_new)]
 
 // ignore-emscripten no threads support
 
diff --git a/src/test/run-pass/struct-order-of-eval-3.rs b/src/test/run-pass/struct-order-of-eval-3.rs
index b67eb205396..cf93133d205 100644
--- a/src/test/run-pass/struct-order-of-eval-3.rs
+++ b/src/test/run-pass/struct-order-of-eval-3.rs
@@ -11,7 +11,7 @@
 // Checks that functional-record-update order-of-eval is as expected
 // even when no Drop-implementations are involved.
 
-#![feature(const_fn)]
+#![feature(const_atomic_usize_new)]
 
 use std::sync::atomic::{Ordering, AtomicUsize};
 
diff --git a/src/test/run-pass/struct-order-of-eval-4.rs b/src/test/run-pass/struct-order-of-eval-4.rs
index 20d27d8b309..d442923478f 100644
--- a/src/test/run-pass/struct-order-of-eval-4.rs
+++ b/src/test/run-pass/struct-order-of-eval-4.rs
@@ -11,7 +11,7 @@
 // Checks that struct-literal expression order-of-eval is as expected
 // even when no Drop-implementations are involved.
 
-#![feature(const_fn)]
+#![feature(const_atomic_usize_new)]
 
 use std::sync::atomic::{Ordering, AtomicUsize};
 
diff --git a/src/test/run-pass/vector-sort-panic-safe.rs b/src/test/run-pass/vector-sort-panic-safe.rs
index 4387a43f03b..c6a1859de30 100644
--- a/src/test/run-pass/vector-sort-panic-safe.rs
+++ b/src/test/run-pass/vector-sort-panic-safe.rs
@@ -10,9 +10,9 @@
 
 // ignore-emscripten no threads support
 
-#![feature(const_fn)]
 #![feature(rand)]
 #![feature(sort_unstable)]
+#![feature(const_atomic_usize_new)]
 
 use std::__rand::{thread_rng, Rng};
 use std::cell::Cell;
diff --git a/src/test/ui/span/dropck_arr_cycle_checked.rs b/src/test/ui/span/dropck_arr_cycle_checked.rs
index 8e8b3c24c76..995a198271c 100644
--- a/src/test/ui/span/dropck_arr_cycle_checked.rs
+++ b/src/test/ui/span/dropck_arr_cycle_checked.rs
@@ -13,7 +13,7 @@
 //
 // (Compare against compile-fail/dropck_vec_cycle_checked.rs)
 
-#![feature(const_fn)]
+#![feature(const_atomic_usize_new)]
 
 use std::cell::Cell;
 use id::Id;
diff --git a/src/test/ui/span/dropck_vec_cycle_checked.rs b/src/test/ui/span/dropck_vec_cycle_checked.rs
index 65db2a56b7d..5bcaa71f73c 100644
--- a/src/test/ui/span/dropck_vec_cycle_checked.rs
+++ b/src/test/ui/span/dropck_vec_cycle_checked.rs
@@ -12,7 +12,7 @@
 //
 // (Compare against compile-fail/dropck_arr_cycle_checked.rs)
 
-#![feature(const_fn)]
+#![feature(const_atomic_usize_new)]
 
 use std::cell::Cell;
 use id::Id;
diff --git a/src/test/ui/span/vec-must-not-hide-type-from-dropck.rs b/src/test/ui/span/vec-must-not-hide-type-from-dropck.rs
index 310ab20489a..d99f3bb19db 100644
--- a/src/test/ui/span/vec-must-not-hide-type-from-dropck.rs
+++ b/src/test/ui/span/vec-must-not-hide-type-from-dropck.rs
@@ -23,7 +23,7 @@
 // conditions above to be satisfied, meaning that if the dropck is
 // sound, it should reject this code.
 
-#![feature(const_fn)]
+#![feature(const_atomic_usize_new)]
 
 use std::cell::Cell;
 use id::Id;