about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-09-01 11:26:24 +0000
committerbors <bors@rust-lang.org>2018-09-01 11:26:24 +0000
commitfea32f1b775b3f37fc4abfa6391c1bebe48af9d1 (patch)
treeab51afef12f740e9b7e2ffd7595ce0869c7e45a1 /src/test
parente6381a7f37402dd5f346256b3773ae2e72853fc3 (diff)
parent2839f4f0e8d58c295e146999961b78e2cc47354f (diff)
downloadrust-fea32f1b775b3f37fc4abfa6391c1bebe48af9d1.tar.gz
rust-fea32f1b775b3f37fc4abfa6391c1bebe48af9d1.zip
Auto merge of #53604 - oli-obk:min_const_fn, r=Centril,varkor
Implement the `min_const_fn` feature gate

cc @RalfJung @eddyb

r? @Centril

implements the feature gate for #53555

I added a hack so the `const_fn` feature gate also enables the `min_const_fn` feature gate. This ensures that nightly users of `const_fn` don't have to touch their code at all.

The `min_const_fn` checks are run first, and if they succeeded, the `const_fn` checks are run additionally to ensure we didn't miss anything.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/codegen-units/item-collection/unreferenced-const-fn.rs2
-rw-r--r--src/test/codegen/link-dead-code.rs2
-rw-r--r--src/test/compile-fail/issue-43733-2.rs2
-rw-r--r--src/test/mir-opt/lower_128bit_debug_test.rs2
-rw-r--r--src/test/mir-opt/lower_128bit_test.rs154
-rw-r--r--src/test/run-fail/issue-29798.rs2
-rw-r--r--src/test/run-pass/auxiliary/const_fn_lib.rs2
-rw-r--r--src/test/run-pass/auxiliary/issue-36954.rs2
-rw-r--r--src/test/run-pass/const-fn-const-eval.rs2
-rw-r--r--src/test/run-pass/const-fn-method.rs2
-rw-r--r--src/test/run-pass/const-fn-nested.rs2
-rw-r--r--src/test/run-pass/const-meth-pattern.rs2
-rw-r--r--src/test/run-pass/const-pattern-variant.rs2
-rw-r--r--src/test/run-pass/const-size_of-align_of.rs2
-rw-r--r--src/test/run-pass/const-unsafe-fn.rs2
-rw-r--r--src/test/run-pass/consts-in-patterns.rs2
-rw-r--r--src/test/run-pass/ctfe/ice-48279.rs2
-rw-r--r--src/test/run-pass/ctfe/match-const-fn-structs.rs2
-rw-r--r--src/test/run-pass/ctfe/return-in-const-fn.rs2
-rw-r--r--src/test/run-pass/invalid_const_promotion.rs4
-rw-r--r--src/test/run-pass/issue-28822.rs2
-rw-r--r--src/test/run-pass/issue-29927.rs2
-rw-r--r--src/test/run-pass/issue-33537.rs2
-rw-r--r--src/test/run-pass/issue-37991.rs2
-rw-r--r--src/test/run-pass/issue29927-1.rs2
-rw-r--r--src/test/rustdoc/auxiliary/issue-27362.rs2
-rw-r--r--src/test/rustdoc/const-fn.rs2
-rw-r--r--src/test/rustdoc/const.rs2
-rw-r--r--src/test/ui/borrowck/move-in-static-initializer-issue-38520.rs2
-rw-r--r--src/test/ui/consts/auxiliary/const_fn_lib.rs2
-rw-r--r--src/test/ui/consts/const-eval/issue-43197.rs2
-rw-r--r--src/test/ui/consts/const-eval/issue-47971.rs2
-rw-r--r--src/test/ui/consts/const-pattern-not-const-evaluable.rs2
-rw-r--r--src/test/ui/consts/const-size_of-cycle.rs2
-rw-r--r--src/test/ui/consts/const-size_of-cycle.stderr8
-rw-r--r--src/test/ui/consts/min_const_fn/min_const_fn.nll.stderr224
-rw-r--r--src/test/ui/consts/min_const_fn/min_const_fn.rs156
-rw-r--r--src/test/ui/consts/min_const_fn/min_const_fn.stderr213
-rw-r--r--src/test/ui/consts/min_const_fn/min_const_fn_dyn.nll.stderr25
-rw-r--r--src/test/ui/consts/min_const_fn/min_const_fn_dyn.rs27
-rw-r--r--src/test/ui/consts/min_const_fn/min_const_fn_dyn.stderr14
-rw-r--r--src/test/ui/consts/min_const_fn/min_const_fn_fn_ptr.rs29
-rw-r--r--src/test/ui/consts/min_const_fn/min_const_fn_fn_ptr.stderr14
-rw-r--r--src/test/ui/consts/min_const_fn/min_const_fn_libstd.rs38
-rw-r--r--src/test/ui/consts/min_const_fn/min_const_fn_libstd_stability.rs46
-rw-r--r--src/test/ui/consts/min_const_fn/min_const_fn_libstd_stability.stderr26
-rw-r--r--src/test/ui/consts/min_const_fn/min_const_fn_unsafe.rs38
-rw-r--r--src/test/ui/consts/min_const_fn/min_const_fn_unsafe.stderr59
-rw-r--r--src/test/ui/error-codes/E0308.stderr4
-rw-r--r--src/test/ui/feature-gates/feature-gate-const_fn.rs11
-rw-r--r--src/test/ui/feature-gates/feature-gate-const_fn.stderr38
-rw-r--r--src/test/ui/feature-gates/feature-gate-min_const_fn.rs46
-rw-r--r--src/test/ui/feature-gates/feature-gate-min_const_fn.stderr62
-rw-r--r--src/test/ui/infinite/infinite-recursion-const-fn.rs2
-rw-r--r--src/test/ui/issues/issue-44415.rs2
-rw-r--r--src/test/ui/unsafe/unsafe-const-fn.rs2
56 files changed, 1131 insertions, 175 deletions
diff --git a/src/test/codegen-units/item-collection/unreferenced-const-fn.rs b/src/test/codegen-units/item-collection/unreferenced-const-fn.rs
index c2ff846721c..14624176436 100644
--- a/src/test/codegen-units/item-collection/unreferenced-const-fn.rs
+++ b/src/test/codegen-units/item-collection/unreferenced-const-fn.rs
@@ -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"]
 
diff --git a/src/test/codegen/link-dead-code.rs b/src/test/codegen/link-dead-code.rs
index 9cabcd9157a..3ea20aa921e 100644
--- a/src/test/codegen/link-dead-code.rs
+++ b/src/test/codegen/link-dead-code.rs
@@ -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
diff --git a/src/test/compile-fail/issue-43733-2.rs b/src/test/compile-fail/issue-43733-2.rs
index a5ba9ef9bd3..fea81f0cc8f 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(min_const_fn)]
 #![feature(cfg_target_thread_local, thread_local_internals)]
 
 // On platforms *without* `#[thread_local]`, use
diff --git a/src/test/mir-opt/lower_128bit_debug_test.rs b/src/test/mir-opt/lower_128bit_debug_test.rs
index 646c4312fc2..1bf740fdec6 100644
--- a/src/test/mir-opt/lower_128bit_debug_test.rs
+++ b/src/test/mir-opt/lower_128bit_debug_test.rs
@@ -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);
diff --git a/src/test/mir-opt/lower_128bit_test.rs b/src/test/mir-opt/lower_128bit_test.rs
index b4b54e13a69..235df8a6785 100644
--- a/src/test/mir-opt/lower_128bit_test.rs
+++ b/src/test/mir-opt/lower_128bit_test.rs
@@ -10,9 +10,9 @@
 
 // ignore-emscripten
 
-// compile-flags: -Z lower_128bit_ops=yes -C debug_assertions=no
+// 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);
@@ -63,103 +63,65 @@ fn main() {
 // END RUST SOURCE
 
 // START rustc.const_signed.Lower128Bit.after.mir
-//     _8 = _1;
-//     _9 = const compiler_builtins::int::addsub::rust_i128_addo(move _8, const 1i128) -> bb10;
-//     ...
-//     _7 = move (_9.0: i128);
-//     ...
-//     _10 = const compiler_builtins::int::addsub::rust_i128_subo(move _7, const 2i128) -> bb11;
-//     ...
-//     _6 = move (_10.0: i128);
-//     ...
-//     _11 = const compiler_builtins::int::mul::rust_i128_mulo(move _6, const 3i128) -> bb12;
-//     ...
-//     _5 = move (_11.0: i128);
-//     ...
-//     _12 = Eq(const 4i128, const 0i128);
-//     assert(!move _12, "attempt to divide by zero") -> bb4;
-//     ...
-//     _13 = Eq(const 4i128, const -1i128);
-//     _14 = Eq(_5, const -170141183460469231731687303715884105728i128);
-//     _15 = BitAnd(move _13, move _14);
-//     assert(!move _15, "attempt to divide with overflow") -> bb5;
-//     ...
-//     _4 = const compiler_builtins::int::sdiv::rust_i128_div(move _5, const 4i128) -> bb13;
-//     ...
-//     _17 = Eq(const 5i128, const -1i128);
-//     _18 = Eq(_4, const -170141183460469231731687303715884105728i128);
-//     _19 = BitAnd(move _17, move _18);
-//     assert(!move _19, "attempt to calculate the remainder with overflow") -> bb7;
-//     ...
-//     _3 = const compiler_builtins::int::sdiv::rust_i128_rem(move _4, const 5i128) -> bb15;
-//     ...
-//     _2 = move (_20.0: i128);
-//     ...
-//     _23 = const 7i32 as u128 (Misc);
-//     _21 = const compiler_builtins::int::shift::rust_i128_shro(move _2, move _23) -> bb16;
-//     ...
-//     _0 = move (_21.0: i128);
-//     ...
-//     assert(!move (_9.1: bool), "attempt to add with overflow") -> bb1;
-//     ...
-//     assert(!move (_10.1: bool), "attempt to subtract with overflow") -> bb2;
-//     ...
-//     assert(!move (_11.1: bool), "attempt to multiply with overflow") -> bb3;
-//     ...
-//     _16 = Eq(const 5i128, const 0i128);
-//     assert(!move _16, "attempt to calculate the remainder with a divisor of zero") -> bb6;
-//     ...
-//     assert(!move (_20.1: bool), "attempt to shift left with overflow") -> bb8;
-//     ...
-//     _22 = const 6i32 as u128 (Misc);
-//     _20 = const compiler_builtins::int::shift::rust_i128_shlo(move _3, move _22) -> bb14;
-//     ...
-//     assert(!move (_21.1: bool), "attempt to shift right with overflow") -> bb9;
+// _7 = const compiler_builtins::int::addsub::rust_i128_add(move _8, const 1i128) -> bb7;
+// ...
+// _10 = Eq(const 4i128, const -1i128);
+// _11 = Eq(_5, const -170141183460469231731687303715884105728i128);
+// _12 = BitAnd(move _10, move _11);
+// assert(!move _12, "attempt to divide with overflow") -> bb2;
+// ...
+// _4 = const compiler_builtins::int::sdiv::rust_i128_div(move _5, const 4i128) -> bb8;
+// ...
+// _14 = Eq(const 5i128, const -1i128);
+// _15 = Eq(_4, const -170141183460469231731687303715884105728i128);
+// _16 = BitAnd(move _14, move _15);
+// assert(!move _16, "attempt to calculate the remainder with overflow") -> bb4;
+// ...
+// _3 = const compiler_builtins::int::sdiv::rust_i128_rem(move _4, const 5i128) -> bb11;
+// ...
+// _9 = Eq(const 4i128, const 0i128);
+// assert(!move _9, "attempt to divide by zero") -> bb1;
+// ...
+// _5 = const compiler_builtins::int::mul::rust_i128_mul(move _6, const 3i128) -> bb5;
+// ...
+// _6 = const compiler_builtins::int::addsub::rust_i128_sub(move _7, const 2i128) -> bb6;
+// ...
+// _13 = Eq(const 5i128, const 0i128);
+// assert(!move _13, "attempt to calculate the remainder with a divisor of zero") -> bb3;
+// ...
+// _17 = const 7i32 as u32 (Misc);
+// _0 = const compiler_builtins::int::shift::rust_i128_shr(move _2, move _17) -> bb9;
+// ...
+// _18 = const 6i32 as u32 (Misc);
+// _2 = const compiler_builtins::int::shift::rust_i128_shl(move _3, move _18) -> bb10;
 // END rustc.const_signed.Lower128Bit.after.mir
 
 // START rustc.const_unsigned.Lower128Bit.after.mir
-//     _8 = _1;
-//     _9 = const compiler_builtins::int::addsub::rust_u128_addo(move _8, const 1u128) -> bb8;
-//     ...
-//     _7 = move (_9.0: u128);
-//     ...
-//     _10 = const compiler_builtins::int::addsub::rust_u128_subo(move _7, const 2u128) -> bb9;
-//     ...
-//     _6 = move (_10.0: u128);
-//     ...
-//     _11 = const compiler_builtins::int::mul::rust_u128_mulo(move _6, const 3u128) -> bb10;
-//     ...
-//     _5 = move (_11.0: u128);
-//     ...
-//     _12 = Eq(const 4u128, const 0u128);
-//     assert(!move _12, "attempt to divide by zero") -> bb4;
-//     ...
-//     _4 = const compiler_builtins::int::udiv::rust_u128_div(move _5, const 4u128) -> bb11;
-//     ...
-//     _3 = const compiler_builtins::int::udiv::rust_u128_rem(move _4, const 5u128) -> bb13;
-//     ...
-//     _2 = move (_14.0: u128);
-//     ...
-//     _17 = const 7i32 as u128 (Misc);
-//     _15 = const compiler_builtins::int::shift::rust_u128_shro(move _2, move _17) -> bb14;
-//     ...
-//     _0 = move (_15.0: u128);
-//     ...
-//     assert(!move (_9.1: bool), "attempt to add with overflow") -> bb1;
-//     ...
-//     assert(!move (_10.1: bool), "attempt to subtract with overflow") -> bb2;
-//     ...
-//     assert(!move (_11.1: bool), "attempt to multiply with overflow") -> bb3;
-//     ...
-//     _13 = Eq(const 5u128, const 0u128);
-//     assert(!move _13, "attempt to calculate the remainder with a divisor of zero") -> bb5;
-//     ...
-//     assert(!move (_14.1: bool), "attempt to shift left with overflow") -> bb6;
-//     ...
-//     _16 = const 6i32 as u128 (Misc);
-//     _14 = const compiler_builtins::int::shift::rust_u128_shlo(move _3, move _16) -> bb12;
-//     ...
-//     assert(!move (_15.1: bool), "attempt to shift right with overflow") -> bb7;
+// _8 = _1;
+// _7 = const compiler_builtins::int::addsub::rust_u128_add(move _8, const 1u128) -> bb5;
+// ...
+// _4 = const compiler_builtins::int::udiv::rust_u128_div(move _5, const 4u128) -> bb6;
+// ...
+// _3 = const compiler_builtins::int::udiv::rust_u128_rem(move _4, const 5u128) -> bb9;
+// ...
+// _9 = Eq(const 4u128, const 0u128);
+// assert(!move _9, "attempt to divide by zero") -> bb1;
+// ...
+// _5 = const compiler_builtins::int::mul::rust_u128_mul(move _6, const 3u128) -> bb3;
+// ...
+// _6 = const compiler_builtins::int::addsub::rust_u128_sub(move _7, const 2u128) -> bb4;
+// ...
+// _10 = Eq(const 5u128, const 0u128);
+// assert(!move _10, "attempt to calculate the remainder with a divisor of zero") -> bb2;
+// ...
+// return;
+// ...
+// _11 = const 7i32 as u32 (Misc);
+// _0 = const compiler_builtins::int::shift::rust_u128_shr(move _2, move _11) -> bb7;
+// ...
+// _12 = const 6i32 as u32 (Misc);
+// _2 = const compiler_builtins::int::shift::rust_u128_shl(move _3, move _12) -> bb8;
+
 // END rustc.const_unsigned.Lower128Bit.after.mir
 
 // START rustc.test_signed.Lower128Bit.after.mir
diff --git a/src/test/run-fail/issue-29798.rs b/src/test/run-fail/issue-29798.rs
index a77175975f9..30efe3b9ab2 100644
--- a/src/test/run-fail/issue-29798.rs
+++ b/src/test/run-fail/issue-29798.rs
@@ -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]
 }
diff --git a/src/test/run-pass/auxiliary/const_fn_lib.rs b/src/test/run-pass/auxiliary/const_fn_lib.rs
index be06e8dd570..6985a6527c8 100644
--- a/src/test/run-pass/auxiliary/const_fn_lib.rs
+++ b/src/test/run-pass/auxiliary/const_fn_lib.rs
@@ -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 }
diff --git a/src/test/run-pass/auxiliary/issue-36954.rs b/src/test/run-pass/auxiliary/issue-36954.rs
index 832ee1d7c1b..5351a40916b 100644
--- a/src/test/run-pass/auxiliary/issue-36954.rs
+++ b/src/test/run-pass/auxiliary/issue-36954.rs
@@ -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 {
diff --git a/src/test/run-pass/const-fn-const-eval.rs b/src/test/run-pass/const-fn-const-eval.rs
index 77c70fe7f63..3fe27ca200c 100644
--- a/src/test/run-pass/const-fn-const-eval.rs
+++ b/src/test/run-pass/const-fn-const-eval.rs
@@ -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
diff --git a/src/test/run-pass/const-fn-method.rs b/src/test/run-pass/const-fn-method.rs
index 7d8d941439c..bed78f1e897 100644
--- a/src/test/run-pass/const-fn-method.rs
+++ b/src/test/run-pass/const-fn-method.rs
@@ -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 }
 
diff --git a/src/test/run-pass/const-fn-nested.rs b/src/test/run-pass/const-fn-nested.rs
index 86f5dedc4d1..d5959a89e51 100644
--- a/src/test/run-pass/const-fn-nested.rs
+++ b/src/test/run-pass/const-fn-nested.rs
@@ -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
diff --git a/src/test/run-pass/const-meth-pattern.rs b/src/test/run-pass/const-meth-pattern.rs
index 3b27987f190..836716051d2 100644
--- a/src/test/run-pass/const-meth-pattern.rs
+++ b/src/test/run-pass/const-meth-pattern.rs
@@ -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;
 
diff --git a/src/test/run-pass/const-pattern-variant.rs b/src/test/run-pass/const-pattern-variant.rs
index 104ab6e19db..689ae19e7d4 100644
--- a/src/test/run-pass/const-pattern-variant.rs
+++ b/src/test/run-pass/const-pattern-variant.rs
@@ -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 {
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..245dd673b51 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(min_const_fn)]
 
 use std::mem;
 
diff --git a/src/test/run-pass/const-unsafe-fn.rs b/src/test/run-pass/const-unsafe-fn.rs
index 2511cfd0422..b267245b789 100644
--- a/src/test/run-pass/const-unsafe-fn.rs
+++ b/src/test/run-pass/const-unsafe-fn.rs
@@ -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
diff --git a/src/test/run-pass/consts-in-patterns.rs b/src/test/run-pass/consts-in-patterns.rs
index eec4c940585..574fb29e82c 100644
--- a/src/test/run-pass/consts-in-patterns.rs
+++ b/src/test/run-pass/consts-in-patterns.rs
@@ -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;
diff --git a/src/test/run-pass/ctfe/ice-48279.rs b/src/test/run-pass/ctfe/ice-48279.rs
index c435e5fdaab..f59a6810e3a 100644
--- a/src/test/run-pass/ctfe/ice-48279.rs
+++ b/src/test/run-pass/ctfe/ice-48279.rs
@@ -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 {
diff --git a/src/test/run-pass/ctfe/match-const-fn-structs.rs b/src/test/run-pass/ctfe/match-const-fn-structs.rs
index 0bb253d1a64..352958f4c6a 100644
--- a/src/test/run-pass/ctfe/match-const-fn-structs.rs
+++ b/src/test/run-pass/ctfe/match-const-fn-structs.rs
@@ -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 }
diff --git a/src/test/run-pass/ctfe/return-in-const-fn.rs b/src/test/run-pass/ctfe/return-in-const-fn.rs
index d57d3bcb49a..87fdac4bfb4 100644
--- a/src/test/run-pass/ctfe/return-in-const-fn.rs
+++ b/src/test/run-pass/ctfe/return-in-const-fn.rs
@@ -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;
 }
diff --git a/src/test/run-pass/invalid_const_promotion.rs b/src/test/run-pass/invalid_const_promotion.rs
index 53cb4c4b009..a18d82fb7a4 100644
--- a/src/test/run-pass/invalid_const_promotion.rs
+++ b/src/test/run-pass/invalid_const_promotion.rs
@@ -11,6 +11,8 @@
 // ignore-wasm32
 // ignore-emscripten
 
+// compile-flags: -C debug_assertions=yes
+
 #![feature(const_fn, libc)]
 #![allow(const_err)]
 
@@ -19,7 +21,7 @@ extern crate libc;
 use std::env;
 use std::process::{Command, Stdio};
 
-// this will panic in debug mode
+// this will panic in debug mode and overflow in release mode
 const fn bar() -> usize { 0 - 1 }
 
 fn foo() {
diff --git a/src/test/run-pass/issue-28822.rs b/src/test/run-pass/issue-28822.rs
index 5a010f2be7a..10482139a97 100644
--- a/src/test/run-pass/issue-28822.rs
+++ b/src/test/run-pass/issue-28822.rs
@@ -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() {}
 
diff --git a/src/test/run-pass/issue-29927.rs b/src/test/run-pass/issue-29927.rs
index 6d9adbcd579..3079d9de3c2 100644
--- a/src/test/run-pass/issue-29927.rs
+++ b/src/test/run-pass/issue-29927.rs
@@ -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,
 }
diff --git a/src/test/run-pass/issue-33537.rs b/src/test/run-pass/issue-33537.rs
index 24f4c9f590b..7be79f3a450 100644
--- a/src/test/run-pass/issue-33537.rs
+++ b/src/test/run-pass/issue-33537.rs
@@ -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
diff --git a/src/test/run-pass/issue-37991.rs b/src/test/run-pass/issue-37991.rs
index 9bdde02d006..9b3289e6785 100644
--- a/src/test/run-pass/issue-37991.rs
+++ b/src/test/run-pass/issue-37991.rs
@@ -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
diff --git a/src/test/run-pass/issue29927-1.rs b/src/test/run-pass/issue29927-1.rs
index 68271accb61..488bc6e6927 100644
--- a/src/test/run-pass/issue29927-1.rs
+++ b/src/test/run-pass/issue29927-1.rs
@@ -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
 }
diff --git a/src/test/rustdoc/auxiliary/issue-27362.rs b/src/test/rustdoc/auxiliary/issue-27362.rs
index 25de698cad1..0c1eedc86cc 100644
--- a/src/test/rustdoc/auxiliary/issue-27362.rs
+++ b/src/test/rustdoc/auxiliary/issue-27362.rs
@@ -10,7 +10,7 @@
 
 // compile-flags: -Cmetadata=aux
 
-#![feature(const_fn)]
+#![feature(min_const_fn)]
 
 pub const fn foo() {}
 pub const unsafe fn bar() {}
diff --git a/src/test/rustdoc/const-fn.rs b/src/test/rustdoc/const-fn.rs
index c323681f60b..dc7a2799b46 100644
--- a/src/test/rustdoc/const-fn.rs
+++ b/src/test/rustdoc/const-fn.rs
@@ -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
diff --git a/src/test/rustdoc/const.rs b/src/test/rustdoc/const.rs
index 380feb941d6..49694e3ae08 100644
--- a/src/test/rustdoc/const.rs
+++ b/src/test/rustdoc/const.rs
@@ -10,7 +10,7 @@
 
 #![crate_type="lib"]
 
-#![feature(const_fn)]
+#![feature(min_const_fn)]
 
 pub struct Foo;
 
diff --git a/src/test/ui/borrowck/move-in-static-initializer-issue-38520.rs b/src/test/ui/borrowck/move-in-static-initializer-issue-38520.rs
index 508e09318ae..d71c8462587 100644
--- a/src/test/ui/borrowck/move-in-static-initializer-issue-38520.rs
+++ b/src/test/ui/borrowck/move-in-static-initializer-issue-38520.rs
@@ -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);
 
diff --git a/src/test/ui/consts/auxiliary/const_fn_lib.rs b/src/test/ui/consts/auxiliary/const_fn_lib.rs
index b0d5a6b1272..499227e71a7 100644
--- a/src/test/ui/consts/auxiliary/const_fn_lib.rs
+++ b/src/test/ui/consts/auxiliary/const_fn_lib.rs
@@ -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
diff --git a/src/test/ui/consts/const-eval/issue-43197.rs b/src/test/ui/consts/const-eval/issue-43197.rs
index c0b45f0ba30..200f423f6e3 100644
--- a/src/test/ui/consts/const-eval/issue-43197.rs
+++ b/src/test/ui/consts/const-eval/issue-43197.rs
@@ -10,7 +10,7 @@
 
 #![warn(const_err)]
 
-#![feature(const_fn)]
+#![feature(min_const_fn)]
 
 const fn foo(x: u32) -> u32 {
     x
diff --git a/src/test/ui/consts/const-eval/issue-47971.rs b/src/test/ui/consts/const-eval/issue-47971.rs
index f6a2db31d37..2bc860e3ef9 100644
--- a/src/test/ui/consts/const-eval/issue-47971.rs
+++ b/src/test/ui/consts/const-eval/issue-47971.rs
@@ -10,7 +10,7 @@
 
 // compile-pass
 
-#![feature(const_fn)]
+#![feature(min_const_fn)]
 
 struct S(pub &'static u32, pub u32);
 
diff --git a/src/test/ui/consts/const-pattern-not-const-evaluable.rs b/src/test/ui/consts/const-pattern-not-const-evaluable.rs
index 87d5e13df6e..4f02b1eef3a 100644
--- a/src/test/ui/consts/const-pattern-not-const-evaluable.rs
+++ b/src/test/ui/consts/const-pattern-not-const-evaluable.rs
@@ -10,7 +10,7 @@
 
 // compile-pass
 
-#![feature(const_fn)]
+#![feature(min_const_fn)]
 
 #[derive(PartialEq, Eq)]
 enum Cake {
diff --git a/src/test/ui/consts/const-size_of-cycle.rs b/src/test/ui/consts/const-size_of-cycle.rs
index fed8e1885de..04c054f8b6d 100644
--- a/src/test/ui/consts/const-size_of-cycle.rs
+++ b/src/test/ui/consts/const-size_of-cycle.rs
@@ -10,8 +10,6 @@
 
 // error-pattern: cycle detected
 
-#![feature(const_fn)]
-
 struct Foo {
     bytes: [u8; std::mem::size_of::<Foo>()]
 }
diff --git a/src/test/ui/consts/const-size_of-cycle.stderr b/src/test/ui/consts/const-size_of-cycle.stderr
index 16d87f7e31c..ab8b5792e68 100644
--- a/src/test/ui/consts/const-size_of-cycle.stderr
+++ b/src/test/ui/consts/const-size_of-cycle.stderr
@@ -4,14 +4,14 @@ note: ...which requires normalizing `ParamEnvAnd { param_env: ParamEnv { caller_
 note: ...which requires const-evaluating `Foo::bytes::{{constant}}`...
   --> $SRC_DIR/libcore/mem.rs:LL:COL
    |
-LL |     unsafe { intrinsics::size_of::<T>() }
-   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL |     intrinsics::size_of::<T>()
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
    = note: ...which again requires computing layout of `Foo`, completing the cycle
 note: cycle used when const-evaluating `Foo::bytes::{{constant}}`
   --> $SRC_DIR/libcore/mem.rs:LL:COL
    |
-LL |     unsafe { intrinsics::size_of::<T>() }
-   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL |     intrinsics::size_of::<T>()
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/consts/min_const_fn/min_const_fn.nll.stderr b/src/test/ui/consts/min_const_fn/min_const_fn.nll.stderr
new file mode 100644
index 00000000000..b156e5a9731
--- /dev/null
+++ b/src/test/ui/consts/min_const_fn/min_const_fn.nll.stderr
@@ -0,0 +1,224 @@
+error[E0493]: destructors cannot be evaluated at compile-time
+  --> $DIR/min_const_fn.rs:49:25
+   |
+LL |     const fn into_inner(self) -> T { self.0 } //~ destructors cannot be evaluated
+   |                         ^^^^ constant functions cannot evaluate destructors
+
+error: mutable references in const fn are unstable
+  --> $DIR/min_const_fn.rs:51:5
+   |
+LL |     const fn get_mut(&mut self) -> &mut T { &mut self.0 }
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0493]: destructors cannot be evaluated at compile-time
+  --> $DIR/min_const_fn.rs:56:28
+   |
+LL |     const fn into_inner_lt(self) -> T { self.0 } //~ destructors cannot be evaluated
+   |                            ^^^^ constant functions cannot evaluate destructors
+
+error: mutable references in const fn are unstable
+  --> $DIR/min_const_fn.rs:58:5
+   |
+LL |     const fn get_mut_lt(&'a mut self) -> &mut T { &mut self.0 }
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0493]: destructors cannot be evaluated at compile-time
+  --> $DIR/min_const_fn.rs:63:27
+   |
+LL |     const fn into_inner_s(self) -> T { self.0 } //~ ERROR destructors
+   |                           ^^^^ constant functions cannot evaluate destructors
+
+error: mutable references in const fn are unstable
+  --> $DIR/min_const_fn.rs:65:5
+   |
+LL |     const fn get_mut_s(&mut self) -> &mut T { &mut self.0 }
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: mutable references in const fn are unstable
+  --> $DIR/min_const_fn.rs:70:5
+   |
+LL |     const fn get_mut_sq(&mut self) -> &mut T { &mut self.0 }
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: trait bounds other than `Sized` on const fn parameters are unstable
+  --> $DIR/min_const_fn.rs:88:16
+   |
+LL | const fn foo11<T: std::fmt::Display>(t: T) -> T { t }
+   |                ^
+
+error: trait bounds other than `Sized` on const fn parameters are unstable
+  --> $DIR/min_const_fn.rs:90:18
+   |
+LL | const fn foo11_2<T: Send>(t: T) -> T { t }
+   |                  ^
+
+error: only int, `bool` and `char` operations are stable in const fn
+  --> $DIR/min_const_fn.rs:92:33
+   |
+LL | const fn foo19(f: f32) -> f32 { f * 2.0 }
+   |                                 ^^^^^^^
+
+error: only int, `bool` and `char` operations are stable in const fn
+  --> $DIR/min_const_fn.rs:94:35
+   |
+LL | const fn foo19_2(f: f32) -> f32 { 2.0 - f }
+   |                                   ^^^^^^^
+
+error: only int and `bool` operations are stable in const fn
+  --> $DIR/min_const_fn.rs:96:35
+   |
+LL | const fn foo19_3(f: f32) -> f32 { -f }
+   |                                   ^^
+
+error: only int, `bool` and `char` operations are stable in const fn
+  --> $DIR/min_const_fn.rs:98:43
+   |
+LL | const fn foo19_4(f: f32, g: f32) -> f32 { f / g }
+   |                                           ^^^^^
+
+error: cannot access `static` items in const fn
+  --> $DIR/min_const_fn.rs:102:27
+   |
+LL | const fn foo25() -> u32 { BAR } //~ ERROR cannot access `static` items in const fn
+   |                           ^^^
+
+error: cannot access `static` items in const fn
+  --> $DIR/min_const_fn.rs:103:36
+   |
+LL | const fn foo26() -> &'static u32 { &BAR } //~ ERROR cannot access `static` items
+   |                                    ^^^^
+
+error: casting pointers to ints is unstable in const fn
+  --> $DIR/min_const_fn.rs:104:42
+   |
+LL | const fn foo30(x: *const u32) -> usize { x as usize }
+   |                                          ^^^^^^^^^^
+
+error: casting pointers to ints is unstable in const fn
+  --> $DIR/min_const_fn.rs:106:42
+   |
+LL | const fn foo30_2(x: *mut u32) -> usize { x as usize }
+   |                                          ^^^^^^^^^^
+
+error: `if`, `match`, `&&` and `||` are not stable in const fn
+  --> $DIR/min_const_fn.rs:108:38
+   |
+LL | const fn foo30_4(b: bool) -> usize { if b { 1 } else { 42 } }
+   |                                      ^^^^^^^^^^^^^^^^^^^^^^
+
+error: `if`, `match`, `&&` and `||` are not stable in const fn
+  --> $DIR/min_const_fn.rs:110:29
+   |
+LL | const fn foo30_5(b: bool) { while b { } } //~ ERROR not stable in const fn
+   |                             ^^^^^^^^^^^
+
+error: local variables in const fn are unstable
+  --> $DIR/min_const_fn.rs:111:34
+   |
+LL | const fn foo30_6() -> bool { let x = true; x } //~ ERROR local variables in const fn are unstable
+   |                                  ^
+
+error: `if`, `match`, `&&` and `||` are not stable in const fn
+  --> $DIR/min_const_fn.rs:112:44
+   |
+LL | const fn foo36(a: bool, b: bool) -> bool { a && b }
+   |                                            ^^^^^^
+
+error: `if`, `match`, `&&` and `||` are not stable in const fn
+  --> $DIR/min_const_fn.rs:114:44
+   |
+LL | const fn foo37(a: bool, b: bool) -> bool { a || b }
+   |                                            ^^^^^^
+
+error: mutable references in const fn are unstable
+  --> $DIR/min_const_fn.rs:116:14
+   |
+LL | const fn inc(x: &mut i32) { *x += 1 }
+   |              ^
+
+error: trait bounds other than `Sized` on const fn parameters are unstable
+  --> $DIR/min_const_fn.rs:121:6
+   |
+LL | impl<T: std::fmt::Debug> Foo<T> {
+   |      ^
+
+error: trait bounds other than `Sized` on const fn parameters are unstable
+  --> $DIR/min_const_fn.rs:126:6
+   |
+LL | impl<T: std::fmt::Debug + Sized> Foo<T> {
+   |      ^
+
+error: trait bounds other than `Sized` on const fn parameters are unstable
+  --> $DIR/min_const_fn.rs:131:6
+   |
+LL | impl<T: Sync + Sized> Foo<T> {
+   |      ^
+
+error: `impl Trait` in const fn is unstable
+  --> $DIR/min_const_fn.rs:137:1
+   |
+LL | const fn no_rpit2() -> AlanTuring<impl std::fmt::Debug> { AlanTuring(0) }
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: trait bounds other than `Sized` on const fn parameters are unstable
+  --> $DIR/min_const_fn.rs:139:34
+   |
+LL | const fn no_apit2(_x: AlanTuring<impl std::fmt::Debug>) {}
+   |                                  ^^^^^^^^^^^^^^^^^^^^
+
+error: trait bounds other than `Sized` on const fn parameters are unstable
+  --> $DIR/min_const_fn.rs:141:22
+   |
+LL | const fn no_apit(_x: impl std::fmt::Debug) {} //~ ERROR trait bounds other than `Sized`
+   |                      ^^^^^^^^^^^^^^^^^^^^
+
+error: `impl Trait` in const fn is unstable
+  --> $DIR/min_const_fn.rs:142:1
+   |
+LL | const fn no_rpit() -> impl std::fmt::Debug {} //~ ERROR `impl Trait` in const fn is unstable
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: trait bounds other than `Sized` on const fn parameters are unstable
+  --> $DIR/min_const_fn.rs:143:23
+   |
+LL | const fn no_dyn_trait(_x: &dyn std::fmt::Debug) {} //~ ERROR trait bounds other than `Sized`
+   |                       ^^
+
+error: trait bounds other than `Sized` on const fn parameters are unstable
+  --> $DIR/min_const_fn.rs:144:1
+   |
+LL | const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() }
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0597]: borrowed value does not live long enough
+  --> $DIR/min_const_fn.rs:144:64
+   |
+LL | const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() }
+   |                                                                ^^ - temporary value only lives until here
+   |                                                                |
+   |                                                                temporary value does not live long enough
+   |
+   = note: borrowed value must be valid for the static lifetime...
+
+error: trait bounds other than `Sized` on const fn parameters are unstable
+  --> $DIR/min_const_fn.rs:149:41
+   |
+LL | const fn really_no_traits_i_mean_it() { (&() as &std::fmt::Debug, ()).1 }
+   |                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: function pointers in const fn are unstable
+  --> $DIR/min_const_fn.rs:152:21
+   |
+LL | const fn no_fn_ptrs(_x: fn()) {}
+   |                     ^^
+
+error: function pointers in const fn are unstable
+  --> $DIR/min_const_fn.rs:154:1
+   |
+LL | const fn no_fn_ptrs2() -> fn() { fn foo() {} foo }
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 36 previous errors
+
+Some errors occurred: E0493, E0597.
+For more information about an error, try `rustc --explain E0493`.
diff --git a/src/test/ui/consts/min_const_fn/min_const_fn.rs b/src/test/ui/consts/min_const_fn/min_const_fn.rs
new file mode 100644
index 00000000000..b861e312d42
--- /dev/null
+++ b/src/test/ui/consts/min_const_fn/min_const_fn.rs
@@ -0,0 +1,156 @@
+// Copyright 2018 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.
+
+#![feature(min_const_fn)]
+
+// ok
+const fn foo1() {}
+const fn foo2(x: i32) -> i32 { x }
+const fn foo3<T>(x: T) -> T { x }
+const fn foo7() {
+    (
+        foo1(),
+        foo2(420),
+        foo3(69),
+    ).0
+}
+const fn foo12<T: Sized>(t: T) -> T { t }
+const fn foo13<T: ?Sized>(t: &T) -> &T { t }
+const fn foo14<'a, T: 'a>(t: &'a T) -> &'a T { t }
+const fn foo15<T>(t: T) -> T where T: Sized { t }
+const fn foo15_2<T>(t: &T) -> &T where T: ?Sized { t }
+const fn foo16(f: f32) -> f32 { f }
+const fn foo17(f: f32) -> u32 { f as u32 }
+const fn foo18(i: i32) -> i32 { i * 3 }
+const fn foo20(b: bool) -> bool { !b }
+const fn foo21<T, U>(t: T, u: U) -> (T, U) { (t, u) }
+const fn foo22(s: &[u8], i: usize) -> u8 { s[i] }
+const FOO: u32 = 42;
+const fn foo23() -> u32 { FOO }
+const fn foo24() -> &'static u32 { &FOO }
+const fn foo27(x: &u32) -> u32 { *x }
+const fn foo28(x: u32) -> u32 { *&x }
+const fn foo29(x: u32) -> i32 { x as i32 }
+const fn foo31(a: bool, b: bool) -> bool { a & b }
+const fn foo32(a: bool, b: bool) -> bool { a | b }
+const fn foo33(a: bool, b: bool) -> bool { a & b }
+const fn foo34(a: bool, b: bool) -> bool { a | b }
+const fn foo35(a: bool, b: bool) -> bool { a ^ b }
+struct Foo<T: ?Sized>(T);
+impl<T> Foo<T> {
+    const fn new(t: T) -> Self { Foo(t) }
+    const fn into_inner(self) -> T { self.0 } //~ destructors cannot be evaluated
+    const fn get(&self) -> &T { &self.0 }
+    const fn get_mut(&mut self) -> &mut T { &mut self.0 }
+    //~^ mutable references in const fn are unstable
+}
+impl<'a, T> Foo<T> {
+    const fn new_lt(t: T) -> Self { Foo(t) }
+    const fn into_inner_lt(self) -> T { self.0 } //~ destructors cannot be evaluated
+    const fn get_lt(&'a self) -> &T { &self.0 }
+    const fn get_mut_lt(&'a mut self) -> &mut T { &mut self.0 }
+    //~^ mutable references in const fn are unstable
+}
+impl<T: Sized> Foo<T> {
+    const fn new_s(t: T) -> Self { Foo(t) }
+    const fn into_inner_s(self) -> T { self.0 } //~ ERROR destructors
+    const fn get_s(&self) -> &T { &self.0 }
+    const fn get_mut_s(&mut self) -> &mut T { &mut self.0 }
+    //~^ mutable references in const fn are unstable
+}
+impl<T: ?Sized> Foo<T> {
+    const fn get_sq(&self) -> &T { &self.0 }
+    const fn get_mut_sq(&mut self) -> &mut T { &mut self.0 }
+    //~^ mutable references in const fn are unstable
+}
+
+
+const fn char_ops(c: char, d: char) -> bool { c == d }
+const fn char_ops2(c: char, d: char) -> bool { c < d }
+const fn char_ops3(c: char, d: char) -> bool { c != d }
+const fn i32_ops(c: i32, d: i32) -> bool { c == d }
+const fn i32_ops2(c: i32, d: i32) -> bool { c < d }
+const fn i32_ops3(c: i32, d: i32) -> bool { c != d }
+const fn i32_ops4(c: i32, d: i32) -> i32 { c + d }
+const fn char_cast(u: u8) -> char { u as char }
+const unsafe fn foo4() -> i32 { 42 }
+const unsafe fn foo5<T>() -> *const T { 0 as *const T }
+const unsafe fn foo6<T>() -> *mut T { 0 as *mut T }
+
+// not ok
+const fn foo11<T: std::fmt::Display>(t: T) -> T { t }
+//~^ ERROR trait bounds other than `Sized` on const fn parameters are unstable
+const fn foo11_2<T: Send>(t: T) -> T { t }
+//~^ ERROR trait bounds other than `Sized` on const fn parameters are unstable
+const fn foo19(f: f32) -> f32 { f * 2.0 }
+//~^ ERROR only int, `bool` and `char` operations are stable in const fn
+const fn foo19_2(f: f32) -> f32 { 2.0 - f }
+//~^ ERROR only int, `bool` and `char` operations are stable in const fn
+const fn foo19_3(f: f32) -> f32 { -f }
+//~^ ERROR only int and `bool` operations are stable in const fn
+const fn foo19_4(f: f32, g: f32) -> f32 { f / g }
+//~^ ERROR only int, `bool` and `char` operations are stable in const fn
+
+static BAR: u32 = 42;
+const fn foo25() -> u32 { BAR } //~ ERROR cannot access `static` items in const fn
+const fn foo26() -> &'static u32 { &BAR } //~ ERROR cannot access `static` items
+const fn foo30(x: *const u32) -> usize { x as usize }
+//~^ ERROR casting pointers to int
+const fn foo30_2(x: *mut u32) -> usize { x as usize }
+//~^ ERROR casting pointers to int
+const fn foo30_4(b: bool) -> usize { if b { 1 } else { 42 } }
+//~^ ERROR `if`, `match`, `&&` and `||` are not stable in const fn
+const fn foo30_5(b: bool) { while b { } } //~ ERROR not stable in const fn
+const fn foo30_6() -> bool { let x = true; x } //~ ERROR local variables in const fn are unstable
+const fn foo36(a: bool, b: bool) -> bool { a && b }
+//~^ ERROR `if`, `match`, `&&` and `||` are not stable in const fn
+const fn foo37(a: bool, b: bool) -> bool { a || b }
+//~^ ERROR `if`, `match`, `&&` and `||` are not stable in const fn
+const fn inc(x: &mut i32) { *x += 1 }
+//~^ ERROR mutable references in const fn are unstable
+
+fn main() {}
+
+impl<T: std::fmt::Debug> Foo<T> {
+//~^ ERROR trait bounds other than `Sized` on const fn parameters are unstable
+    const fn foo(&self) {}
+}
+
+impl<T: std::fmt::Debug + Sized> Foo<T> {
+//~^ ERROR trait bounds other than `Sized` on const fn parameters are unstable
+    const fn foo2(&self) {}
+}
+
+impl<T: Sync + Sized> Foo<T> {
+//~^ ERROR trait bounds other than `Sized` on const fn parameters are unstable
+    const fn foo3(&self) {}
+}
+
+struct AlanTuring<T>(T);
+const fn no_rpit2() -> AlanTuring<impl std::fmt::Debug> { AlanTuring(0) }
+//~^ ERROR `impl Trait` in const fn is unstable
+const fn no_apit2(_x: AlanTuring<impl std::fmt::Debug>) {}
+//~^ ERROR trait bounds other than `Sized`
+const fn no_apit(_x: impl std::fmt::Debug) {} //~ ERROR trait bounds other than `Sized`
+const fn no_rpit() -> impl std::fmt::Debug {} //~ ERROR `impl Trait` in const fn is unstable
+const fn no_dyn_trait(_x: &dyn std::fmt::Debug) {} //~ ERROR trait bounds other than `Sized`
+const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() }
+//~^ ERROR trait bounds other than `Sized`
+
+const fn no_unsafe() { unsafe {} }
+
+const fn really_no_traits_i_mean_it() { (&() as &std::fmt::Debug, ()).1 }
+//~^ ERROR trait bounds other than `Sized`
+
+const fn no_fn_ptrs(_x: fn()) {}
+//~^ ERROR function pointers in const fn are unstable
+const fn no_fn_ptrs2() -> fn() { fn foo() {} foo }
+//~^ ERROR function pointers in const fn are unstable
+
diff --git a/src/test/ui/consts/min_const_fn/min_const_fn.stderr b/src/test/ui/consts/min_const_fn/min_const_fn.stderr
new file mode 100644
index 00000000000..019948c31b1
--- /dev/null
+++ b/src/test/ui/consts/min_const_fn/min_const_fn.stderr
@@ -0,0 +1,213 @@
+error[E0493]: destructors cannot be evaluated at compile-time
+  --> $DIR/min_const_fn.rs:49:25
+   |
+LL |     const fn into_inner(self) -> T { self.0 } //~ destructors cannot be evaluated
+   |                         ^^^^ constant functions cannot evaluate destructors
+
+error: mutable references in const fn are unstable
+  --> $DIR/min_const_fn.rs:51:5
+   |
+LL |     const fn get_mut(&mut self) -> &mut T { &mut self.0 }
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0493]: destructors cannot be evaluated at compile-time
+  --> $DIR/min_const_fn.rs:56:28
+   |
+LL |     const fn into_inner_lt(self) -> T { self.0 } //~ destructors cannot be evaluated
+   |                            ^^^^ constant functions cannot evaluate destructors
+
+error: mutable references in const fn are unstable
+  --> $DIR/min_const_fn.rs:58:5
+   |
+LL |     const fn get_mut_lt(&'a mut self) -> &mut T { &mut self.0 }
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0493]: destructors cannot be evaluated at compile-time
+  --> $DIR/min_const_fn.rs:63:27
+   |
+LL |     const fn into_inner_s(self) -> T { self.0 } //~ ERROR destructors
+   |                           ^^^^ constant functions cannot evaluate destructors
+
+error: mutable references in const fn are unstable
+  --> $DIR/min_const_fn.rs:65:5
+   |
+LL |     const fn get_mut_s(&mut self) -> &mut T { &mut self.0 }
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: mutable references in const fn are unstable
+  --> $DIR/min_const_fn.rs:70:5
+   |
+LL |     const fn get_mut_sq(&mut self) -> &mut T { &mut self.0 }
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: trait bounds other than `Sized` on const fn parameters are unstable
+  --> $DIR/min_const_fn.rs:88:16
+   |
+LL | const fn foo11<T: std::fmt::Display>(t: T) -> T { t }
+   |                ^
+
+error: trait bounds other than `Sized` on const fn parameters are unstable
+  --> $DIR/min_const_fn.rs:90:18
+   |
+LL | const fn foo11_2<T: Send>(t: T) -> T { t }
+   |                  ^
+
+error: only int, `bool` and `char` operations are stable in const fn
+  --> $DIR/min_const_fn.rs:92:33
+   |
+LL | const fn foo19(f: f32) -> f32 { f * 2.0 }
+   |                                 ^^^^^^^
+
+error: only int, `bool` and `char` operations are stable in const fn
+  --> $DIR/min_const_fn.rs:94:35
+   |
+LL | const fn foo19_2(f: f32) -> f32 { 2.0 - f }
+   |                                   ^^^^^^^
+
+error: only int and `bool` operations are stable in const fn
+  --> $DIR/min_const_fn.rs:96:35
+   |
+LL | const fn foo19_3(f: f32) -> f32 { -f }
+   |                                   ^^
+
+error: only int, `bool` and `char` operations are stable in const fn
+  --> $DIR/min_const_fn.rs:98:43
+   |
+LL | const fn foo19_4(f: f32, g: f32) -> f32 { f / g }
+   |                                           ^^^^^
+
+error: cannot access `static` items in const fn
+  --> $DIR/min_const_fn.rs:102:27
+   |
+LL | const fn foo25() -> u32 { BAR } //~ ERROR cannot access `static` items in const fn
+   |                           ^^^
+
+error: cannot access `static` items in const fn
+  --> $DIR/min_const_fn.rs:103:36
+   |
+LL | const fn foo26() -> &'static u32 { &BAR } //~ ERROR cannot access `static` items
+   |                                    ^^^^
+
+error: casting pointers to ints is unstable in const fn
+  --> $DIR/min_const_fn.rs:104:42
+   |
+LL | const fn foo30(x: *const u32) -> usize { x as usize }
+   |                                          ^^^^^^^^^^
+
+error: casting pointers to ints is unstable in const fn
+  --> $DIR/min_const_fn.rs:106:42
+   |
+LL | const fn foo30_2(x: *mut u32) -> usize { x as usize }
+   |                                          ^^^^^^^^^^
+
+error: `if`, `match`, `&&` and `||` are not stable in const fn
+  --> $DIR/min_const_fn.rs:108:38
+   |
+LL | const fn foo30_4(b: bool) -> usize { if b { 1 } else { 42 } }
+   |                                      ^^^^^^^^^^^^^^^^^^^^^^
+
+error: `if`, `match`, `&&` and `||` are not stable in const fn
+  --> $DIR/min_const_fn.rs:110:29
+   |
+LL | const fn foo30_5(b: bool) { while b { } } //~ ERROR not stable in const fn
+   |                             ^^^^^^^^^^^
+
+error: local variables in const fn are unstable
+  --> $DIR/min_const_fn.rs:111:34
+   |
+LL | const fn foo30_6() -> bool { let x = true; x } //~ ERROR local variables in const fn are unstable
+   |                                  ^
+
+error: `if`, `match`, `&&` and `||` are not stable in const fn
+  --> $DIR/min_const_fn.rs:112:44
+   |
+LL | const fn foo36(a: bool, b: bool) -> bool { a && b }
+   |                                            ^^^^^^
+
+error: `if`, `match`, `&&` and `||` are not stable in const fn
+  --> $DIR/min_const_fn.rs:114:44
+   |
+LL | const fn foo37(a: bool, b: bool) -> bool { a || b }
+   |                                            ^^^^^^
+
+error: mutable references in const fn are unstable
+  --> $DIR/min_const_fn.rs:116:14
+   |
+LL | const fn inc(x: &mut i32) { *x += 1 }
+   |              ^
+
+error: trait bounds other than `Sized` on const fn parameters are unstable
+  --> $DIR/min_const_fn.rs:121:6
+   |
+LL | impl<T: std::fmt::Debug> Foo<T> {
+   |      ^
+
+error: trait bounds other than `Sized` on const fn parameters are unstable
+  --> $DIR/min_const_fn.rs:126:6
+   |
+LL | impl<T: std::fmt::Debug + Sized> Foo<T> {
+   |      ^
+
+error: trait bounds other than `Sized` on const fn parameters are unstable
+  --> $DIR/min_const_fn.rs:131:6
+   |
+LL | impl<T: Sync + Sized> Foo<T> {
+   |      ^
+
+error: `impl Trait` in const fn is unstable
+  --> $DIR/min_const_fn.rs:137:1
+   |
+LL | const fn no_rpit2() -> AlanTuring<impl std::fmt::Debug> { AlanTuring(0) }
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: trait bounds other than `Sized` on const fn parameters are unstable
+  --> $DIR/min_const_fn.rs:139:34
+   |
+LL | const fn no_apit2(_x: AlanTuring<impl std::fmt::Debug>) {}
+   |                                  ^^^^^^^^^^^^^^^^^^^^
+
+error: trait bounds other than `Sized` on const fn parameters are unstable
+  --> $DIR/min_const_fn.rs:141:22
+   |
+LL | const fn no_apit(_x: impl std::fmt::Debug) {} //~ ERROR trait bounds other than `Sized`
+   |                      ^^^^^^^^^^^^^^^^^^^^
+
+error: `impl Trait` in const fn is unstable
+  --> $DIR/min_const_fn.rs:142:1
+   |
+LL | const fn no_rpit() -> impl std::fmt::Debug {} //~ ERROR `impl Trait` in const fn is unstable
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: trait bounds other than `Sized` on const fn parameters are unstable
+  --> $DIR/min_const_fn.rs:143:23
+   |
+LL | const fn no_dyn_trait(_x: &dyn std::fmt::Debug) {} //~ ERROR trait bounds other than `Sized`
+   |                       ^^
+
+error: trait bounds other than `Sized` on const fn parameters are unstable
+  --> $DIR/min_const_fn.rs:144:1
+   |
+LL | const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() }
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: trait bounds other than `Sized` on const fn parameters are unstable
+  --> $DIR/min_const_fn.rs:149:41
+   |
+LL | const fn really_no_traits_i_mean_it() { (&() as &std::fmt::Debug, ()).1 }
+   |                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: function pointers in const fn are unstable
+  --> $DIR/min_const_fn.rs:152:21
+   |
+LL | const fn no_fn_ptrs(_x: fn()) {}
+   |                     ^^
+
+error: function pointers in const fn are unstable
+  --> $DIR/min_const_fn.rs:154:1
+   |
+LL | const fn no_fn_ptrs2() -> fn() { fn foo() {} foo }
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 35 previous errors
+
+For more information about this error, try `rustc --explain E0493`.
diff --git a/src/test/ui/consts/min_const_fn/min_const_fn_dyn.nll.stderr b/src/test/ui/consts/min_const_fn/min_const_fn_dyn.nll.stderr
new file mode 100644
index 00000000000..cfcc7990fb3
--- /dev/null
+++ b/src/test/ui/consts/min_const_fn/min_const_fn_dyn.nll.stderr
@@ -0,0 +1,25 @@
+error: trait bounds other than `Sized` on const fn parameters are unstable
+  --> $DIR/min_const_fn_dyn.rs:21:5
+   |
+LL |     x.0.field;
+   |     ^^^^^^^^^
+
+error: trait bounds other than `Sized` on const fn parameters are unstable
+  --> $DIR/min_const_fn_dyn.rs:24:66
+   |
+LL | const fn no_inner_dyn_trait_ret() -> Hide { Hide(HasDyn { field: &0 }) }
+   |                                                                  ^^
+
+error[E0597]: borrowed value does not live long enough
+  --> $DIR/min_const_fn_dyn.rs:24:67
+   |
+LL | const fn no_inner_dyn_trait_ret() -> Hide { Hide(HasDyn { field: &0 }) }
+   |                                                                   ^    - temporary value only lives until here
+   |                                                                   |
+   |                                                                   temporary value does not live long enough
+   |
+   = note: borrowed value must be valid for the static lifetime...
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/consts/min_const_fn/min_const_fn_dyn.rs b/src/test/ui/consts/min_const_fn/min_const_fn_dyn.rs
new file mode 100644
index 00000000000..38e28256430
--- /dev/null
+++ b/src/test/ui/consts/min_const_fn/min_const_fn_dyn.rs
@@ -0,0 +1,27 @@
+// Copyright 2018 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.
+
+#![feature(min_const_fn)]
+
+struct HasDyn {
+    field: &'static dyn std::fmt::Debug,
+}
+
+struct Hide(HasDyn);
+
+const fn no_inner_dyn_trait(_x: Hide) {}
+const fn no_inner_dyn_trait2(x: Hide) {
+    x.0.field;
+//~^ ERROR trait bounds other than `Sized`
+}
+const fn no_inner_dyn_trait_ret() -> Hide { Hide(HasDyn { field: &0 }) }
+//~^ ERROR trait bounds other than `Sized`
+
+fn main() {}
diff --git a/src/test/ui/consts/min_const_fn/min_const_fn_dyn.stderr b/src/test/ui/consts/min_const_fn/min_const_fn_dyn.stderr
new file mode 100644
index 00000000000..3a1055f2ede
--- /dev/null
+++ b/src/test/ui/consts/min_const_fn/min_const_fn_dyn.stderr
@@ -0,0 +1,14 @@
+error: trait bounds other than `Sized` on const fn parameters are unstable
+  --> $DIR/min_const_fn_dyn.rs:21:5
+   |
+LL |     x.0.field;
+   |     ^^^^^^^^^
+
+error: trait bounds other than `Sized` on const fn parameters are unstable
+  --> $DIR/min_const_fn_dyn.rs:24:66
+   |
+LL | const fn no_inner_dyn_trait_ret() -> Hide { Hide(HasDyn { field: &0 }) }
+   |                                                                  ^^
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/consts/min_const_fn/min_const_fn_fn_ptr.rs b/src/test/ui/consts/min_const_fn/min_const_fn_fn_ptr.rs
new file mode 100644
index 00000000000..100d275f97e
--- /dev/null
+++ b/src/test/ui/consts/min_const_fn/min_const_fn_fn_ptr.rs
@@ -0,0 +1,29 @@
+// Copyright 2018 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.
+
+#![feature(min_const_fn)]
+
+struct HasPtr {
+    field: fn(),
+}
+
+struct Hide(HasPtr);
+
+fn field() {}
+
+const fn no_inner_dyn_trait(_x: Hide) {}
+const fn no_inner_dyn_trait2(x: Hide) {
+    x.0.field;
+//~^ ERROR function pointers in const fn
+}
+const fn no_inner_dyn_trait_ret() -> Hide { Hide(HasPtr { field }) }
+//~^ ERROR function pointers in const fn
+
+fn main() {}
diff --git a/src/test/ui/consts/min_const_fn/min_const_fn_fn_ptr.stderr b/src/test/ui/consts/min_const_fn/min_const_fn_fn_ptr.stderr
new file mode 100644
index 00000000000..c10af3d2c8e
--- /dev/null
+++ b/src/test/ui/consts/min_const_fn/min_const_fn_fn_ptr.stderr
@@ -0,0 +1,14 @@
+error: function pointers in const fn are unstable
+  --> $DIR/min_const_fn_fn_ptr.rs:23:5
+   |
+LL |     x.0.field;
+   |     ^^^^^^^^^
+
+error: function pointers in const fn are unstable
+  --> $DIR/min_const_fn_fn_ptr.rs:26:59
+   |
+LL | const fn no_inner_dyn_trait_ret() -> Hide { Hide(HasPtr { field }) }
+   |                                                           ^^^^^
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/consts/min_const_fn/min_const_fn_libstd.rs b/src/test/ui/consts/min_const_fn/min_const_fn_libstd.rs
new file mode 100644
index 00000000000..fcc9545d97f
--- /dev/null
+++ b/src/test/ui/consts/min_const_fn/min_const_fn_libstd.rs
@@ -0,0 +1,38 @@
+// Copyright 2018 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.
+
+#![feature(integer_atomics, min_const_fn)]
+
+// compile-pass
+
+use std::cell::UnsafeCell;
+use std::sync::atomic::AtomicU32;
+pub struct Condvar {
+    condvar: UnsafeCell<AtomicU32>,
+}
+
+unsafe impl Send for Condvar {}
+unsafe impl Sync for Condvar {}
+
+#[repr(C)]
+#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
+struct NoWait(u32);
+
+const CONDVAR_HAS_NO_WAITERS: NoWait = NoWait(42);
+
+impl Condvar {
+    pub const fn new() -> Condvar {
+        Condvar {
+            condvar: UnsafeCell::new(AtomicU32::new(CONDVAR_HAS_NO_WAITERS.0)),
+        }
+    }
+}
+
+fn main() {}
diff --git a/src/test/ui/consts/min_const_fn/min_const_fn_libstd_stability.rs b/src/test/ui/consts/min_const_fn/min_const_fn_libstd_stability.rs
new file mode 100644
index 00000000000..9f5d0ad5df3
--- /dev/null
+++ b/src/test/ui/consts/min_const_fn/min_const_fn_libstd_stability.rs
@@ -0,0 +1,46 @@
+// Copyright 2018 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.
+
+#![unstable(feature = "humans",
+            reason = "who ever let humans program computers,
+            we're apparently really bad at it",
+            issue = "0")]
+
+#![feature(rustc_const_unstable, const_fn, foo, foo2)]
+#![feature(staged_api)]
+
+#[stable(feature = "rust1", since = "1.0.0")]
+#[rustc_const_unstable(feature="foo")]
+const fn foo() -> u32 { 42 }
+
+#[stable(feature = "rust1", since = "1.0.0")]
+// can't call non-min_const_fn
+const fn bar() -> u32 { foo() } //~ ERROR can only call other `min_const_fn`
+
+#[unstable(feature = "rust1", issue="0")]
+const fn foo2() -> u32 { 42 }
+
+#[stable(feature = "rust1", since = "1.0.0")]
+// can't call non-min_const_fn
+const fn bar2() -> u32 { foo2() } //~ ERROR can only call other `min_const_fn`
+
+#[stable(feature = "rust1", since = "1.0.0")]
+// conformity is required, even with `const_fn` feature gate
+const fn bar3() -> u32 { (5f32 + 6f32) as u32 } //~ ERROR only int, `bool` and `char` operations
+
+// check whether this function cannot be called even with the feature gate active
+#[unstable(feature = "foo2", issue="0")]
+const fn foo2_gated() -> u32 { 42 }
+
+#[stable(feature = "rust1", since = "1.0.0")]
+// can't call non-min_const_fn
+const fn bar2_gated() -> u32 { foo2_gated() } //~ ERROR can only call other `min_const_fn`
+
+fn main() {}
diff --git a/src/test/ui/consts/min_const_fn/min_const_fn_libstd_stability.stderr b/src/test/ui/consts/min_const_fn/min_const_fn_libstd_stability.stderr
new file mode 100644
index 00000000000..1ef7ffd3a91
--- /dev/null
+++ b/src/test/ui/consts/min_const_fn/min_const_fn_libstd_stability.stderr
@@ -0,0 +1,26 @@
+error: can only call other `min_const_fn` within a `min_const_fn`
+  --> $DIR/min_const_fn_libstd_stability.rs:25:25
+   |
+LL | const fn bar() -> u32 { foo() } //~ ERROR can only call other `min_const_fn`
+   |                         ^^^^^
+
+error: can only call other `min_const_fn` within a `min_const_fn`
+  --> $DIR/min_const_fn_libstd_stability.rs:32:26
+   |
+LL | const fn bar2() -> u32 { foo2() } //~ ERROR can only call other `min_const_fn`
+   |                          ^^^^^^
+
+error: only int, `bool` and `char` operations are stable in const fn
+  --> $DIR/min_const_fn_libstd_stability.rs:36:26
+   |
+LL | const fn bar3() -> u32 { (5f32 + 6f32) as u32 } //~ ERROR only int, `bool` and `char` operations
+   |                          ^^^^^^^^^^^^^
+
+error: can only call other `min_const_fn` within a `min_const_fn`
+  --> $DIR/min_const_fn_libstd_stability.rs:44:32
+   |
+LL | const fn bar2_gated() -> u32 { foo2_gated() } //~ ERROR can only call other `min_const_fn`
+   |                                ^^^^^^^^^^^^
+
+error: aborting due to 4 previous errors
+
diff --git a/src/test/ui/consts/min_const_fn/min_const_fn_unsafe.rs b/src/test/ui/consts/min_const_fn/min_const_fn_unsafe.rs
new file mode 100644
index 00000000000..e7caa4c6cb4
--- /dev/null
+++ b/src/test/ui/consts/min_const_fn/min_const_fn_unsafe.rs
@@ -0,0 +1,38 @@
+// Copyright 2018 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.
+
+#![feature(min_const_fn)]
+
+// ok
+const unsafe fn foo4() -> i32 { 42 }
+const unsafe fn foo5<T>() -> *const T { 0 as *const T }
+const unsafe fn foo6<T>() -> *mut T { 0 as *mut T }
+const fn no_unsafe() { unsafe {} }
+
+// not ok
+const fn foo8() -> i32 {
+    unsafe { foo4() } //~ ERROR unsafe operations are not allowed in const fn
+}
+const fn foo9() -> *const String {
+    unsafe { foo5::<String>() } //~ ERROR unsafe operations are not allowed in const fn
+}
+const fn foo10() -> *const Vec<std::cell::Cell<u32>> {
+    unsafe { foo6::<Vec<std::cell::Cell<u32>>>() } //~ ERROR not allowed in const fn
+}
+const unsafe fn foo30_3(x: *mut usize) -> usize { *x } //~ ERROR not allowed in const fn
+//~^ dereferencing raw pointers in constant functions
+
+fn main() {}
+
+const unsafe fn no_union() {
+    union Foo { x: (), y: () }
+    Foo { x: () }.y //~ ERROR not allowed in const fn
+    //~^ unions in const fn
+}
diff --git a/src/test/ui/consts/min_const_fn/min_const_fn_unsafe.stderr b/src/test/ui/consts/min_const_fn/min_const_fn_unsafe.stderr
new file mode 100644
index 00000000000..17cba8569c1
--- /dev/null
+++ b/src/test/ui/consts/min_const_fn/min_const_fn_unsafe.stderr
@@ -0,0 +1,59 @@
+error[E0658]: dereferencing raw pointers in constant functions is unstable (see issue #51911)
+  --> $DIR/min_const_fn_unsafe.rs:29:51
+   |
+LL | const unsafe fn foo30_3(x: *mut usize) -> usize { *x } //~ ERROR not allowed in const fn
+   |                                                   ^^
+   |
+   = help: add #![feature(const_raw_ptr_deref)] to the crate attributes to enable
+
+error[E0658]: unions in const fn are unstable (see issue #51909)
+  --> $DIR/min_const_fn_unsafe.rs:36:5
+   |
+LL |     Foo { x: () }.y //~ ERROR not allowed in const fn
+   |     ^^^^^^^^^^^^^^^
+   |
+   = help: add #![feature(const_fn_union)] to the crate attributes to enable
+
+error: call to unsafe function is unsafe and unsafe operations are not allowed in const fn
+  --> $DIR/min_const_fn_unsafe.rs:21:14
+   |
+LL |     unsafe { foo4() } //~ ERROR unsafe operations are not allowed in const fn
+   |              ^^^^^^ call to unsafe function
+   |
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+
+error: call to unsafe function is unsafe and unsafe operations are not allowed in const fn
+  --> $DIR/min_const_fn_unsafe.rs:24:14
+   |
+LL |     unsafe { foo5::<String>() } //~ ERROR unsafe operations are not allowed in const fn
+   |              ^^^^^^^^^^^^^^^^ call to unsafe function
+   |
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+
+error: call to unsafe function is unsafe and unsafe operations are not allowed in const fn
+  --> $DIR/min_const_fn_unsafe.rs:27:14
+   |
+LL |     unsafe { foo6::<Vec<std::cell::Cell<u32>>>() } //~ ERROR not allowed in const fn
+   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
+   |
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+
+error: dereference of raw pointer is unsafe and unsafe operations are not allowed in const fn
+  --> $DIR/min_const_fn_unsafe.rs:29:51
+   |
+LL | const unsafe fn foo30_3(x: *mut usize) -> usize { *x } //~ ERROR not allowed in const fn
+   |                                                   ^^ dereference of raw pointer
+   |
+   = note: raw pointers may be NULL, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior
+
+error: access to union field is unsafe and unsafe operations are not allowed in const fn
+  --> $DIR/min_const_fn_unsafe.rs:36:5
+   |
+LL |     Foo { x: () }.y //~ ERROR not allowed in const fn
+   |     ^^^^^^^^^^^^^^^ access to union field
+   |
+   = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior
+
+error: aborting due to 7 previous errors
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/ui/error-codes/E0308.stderr b/src/test/ui/error-codes/E0308.stderr
index 490a8e0ff0f..438dd50f2bf 100644
--- a/src/test/ui/error-codes/E0308.stderr
+++ b/src/test/ui/error-codes/E0308.stderr
@@ -4,8 +4,8 @@ error[E0308]: intrinsic has wrong type
 LL |     fn size_of<T>(); //~ ERROR E0308
    |     ^^^^^^^^^^^^^^^^ expected (), found usize
    |
-   = note: expected type `unsafe extern "rust-intrinsic" fn()`
-              found type `unsafe extern "rust-intrinsic" fn() -> usize`
+   = note: expected type `extern "rust-intrinsic" fn()`
+              found type `extern "rust-intrinsic" fn() -> usize`
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/feature-gates/feature-gate-const_fn.rs b/src/test/ui/feature-gates/feature-gate-const_fn.rs
index 1d1dedddaaa..f774658975b 100644
--- a/src/test/ui/feature-gates/feature-gate-const_fn.rs
+++ b/src/test/ui/feature-gates/feature-gate-const_fn.rs
@@ -8,9 +8,11 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// Test use of const fn without feature gate.
+// Test use of const fn without the `const_fn` feature gate.
+// `min_const_fn` is checked in its own file
+#![feature(min_const_fn)]
 
-const fn foo() -> usize { 0 } //~ ERROR const fn is unstable
+const fn foo() -> usize { 0 } // ok
 
 trait Foo {
     const fn foo() -> u32; //~ ERROR const fn is unstable
@@ -20,12 +22,11 @@ trait Foo {
 }
 
 impl Foo {
-    const fn baz() -> u32 { 0 } //~ ERROR const fn is unstable
+    const fn baz() -> u32 { 0 } // ok
 }
 
 impl Foo for u32 {
-    const fn foo() -> u32 { 0 } //~ ERROR const fn is unstable
-                                //~| ERROR trait fns cannot be declared const
+    const fn foo() -> u32 { 0 } //~ ERROR trait fns cannot be declared const
 }
 
 static FOO: usize = foo();
diff --git a/src/test/ui/feature-gates/feature-gate-const_fn.stderr b/src/test/ui/feature-gates/feature-gate-const_fn.stderr
index d7c00a3e0cb..26c0c7877b4 100644
--- a/src/test/ui/feature-gates/feature-gate-const_fn.stderr
+++ b/src/test/ui/feature-gates/feature-gate-const_fn.stderr
@@ -1,31 +1,23 @@
 error[E0379]: trait fns cannot be declared const
-  --> $DIR/feature-gate-const_fn.rs:16:5
+  --> $DIR/feature-gate-const_fn.rs:18:5
    |
 LL |     const fn foo() -> u32; //~ ERROR const fn is unstable
    |     ^^^^^ trait fns cannot be const
 
 error[E0379]: trait fns cannot be declared const
-  --> $DIR/feature-gate-const_fn.rs:18:5
+  --> $DIR/feature-gate-const_fn.rs:20:5
    |
 LL |     const fn bar() -> u32 { 0 } //~ ERROR const fn is unstable
    |     ^^^^^ trait fns cannot be const
 
 error[E0379]: trait fns cannot be declared const
-  --> $DIR/feature-gate-const_fn.rs:27:5
+  --> $DIR/feature-gate-const_fn.rs:29:5
    |
-LL |     const fn foo() -> u32 { 0 } //~ ERROR const fn is unstable
+LL |     const fn foo() -> u32 { 0 } //~ ERROR trait fns cannot be declared const
    |     ^^^^^ trait fns cannot be const
 
 error[E0658]: const fn is unstable (see issue #24111)
-  --> $DIR/feature-gate-const_fn.rs:13:1
-   |
-LL | const fn foo() -> usize { 0 } //~ ERROR const fn is unstable
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-   = help: add #![feature(const_fn)] to the crate attributes to enable
-
-error[E0658]: const fn is unstable (see issue #24111)
-  --> $DIR/feature-gate-const_fn.rs:16:5
+  --> $DIR/feature-gate-const_fn.rs:18:5
    |
 LL |     const fn foo() -> u32; //~ ERROR const fn is unstable
    |     ^^^^^^^^^^^^^^^^^^^^^^
@@ -33,30 +25,14 @@ LL |     const fn foo() -> u32; //~ ERROR const fn is unstable
    = help: add #![feature(const_fn)] to the crate attributes to enable
 
 error[E0658]: const fn is unstable (see issue #24111)
-  --> $DIR/feature-gate-const_fn.rs:18:5
+  --> $DIR/feature-gate-const_fn.rs:20:5
    |
 LL |     const fn bar() -> u32 { 0 } //~ ERROR const fn is unstable
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: add #![feature(const_fn)] to the crate attributes to enable
 
-error[E0658]: const fn is unstable (see issue #24111)
-  --> $DIR/feature-gate-const_fn.rs:23:5
-   |
-LL |     const fn baz() -> u32 { 0 } //~ ERROR const fn is unstable
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-   = help: add #![feature(const_fn)] to the crate attributes to enable
-
-error[E0658]: const fn is unstable (see issue #24111)
-  --> $DIR/feature-gate-const_fn.rs:27:5
-   |
-LL |     const fn foo() -> u32 { 0 } //~ ERROR const fn is unstable
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-   = help: add #![feature(const_fn)] to the crate attributes to enable
-
-error: aborting due to 8 previous errors
+error: aborting due to 5 previous errors
 
 Some errors occurred: E0379, E0658.
 For more information about an error, try `rustc --explain E0379`.
diff --git a/src/test/ui/feature-gates/feature-gate-min_const_fn.rs b/src/test/ui/feature-gates/feature-gate-min_const_fn.rs
new file mode 100644
index 00000000000..e052ba9c8b4
--- /dev/null
+++ b/src/test/ui/feature-gates/feature-gate-min_const_fn.rs
@@ -0,0 +1,46 @@
+// 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 min_const_fn without feature gate.
+
+const fn foo() -> usize { 0 } //~ ERROR const fn is unstable
+
+trait Foo {
+    const fn foo() -> u32; //~ ERROR const fn is unstable
+                           //~| ERROR trait fns cannot be declared const
+    const fn bar() -> u32 { 0 } //~ ERROR const fn is unstable
+                                //~| ERROR trait fns cannot be declared const
+}
+
+impl Foo {
+    const fn baz() -> u32 { 0 } //~ ERROR const fn is unstable
+}
+
+impl Foo for u32 {
+    const fn foo() -> u32 { 0 } //~ ERROR const fn is unstable
+                                //~| ERROR trait fns cannot be declared const
+}
+
+static FOO: usize = foo();
+const BAR: usize = foo();
+
+macro_rules! constant {
+    ($n:ident: $t:ty = $v:expr) => {
+        const $n: $t = $v;
+    }
+}
+
+constant! {
+    BAZ: usize = foo()
+}
+
+fn main() {
+    let x: [usize; foo()] = [];
+}
diff --git a/src/test/ui/feature-gates/feature-gate-min_const_fn.stderr b/src/test/ui/feature-gates/feature-gate-min_const_fn.stderr
new file mode 100644
index 00000000000..aa7750362b2
--- /dev/null
+++ b/src/test/ui/feature-gates/feature-gate-min_const_fn.stderr
@@ -0,0 +1,62 @@
+error[E0379]: trait fns cannot be declared const
+  --> $DIR/feature-gate-min_const_fn.rs:16:5
+   |
+LL |     const fn foo() -> u32; //~ ERROR const fn is unstable
+   |     ^^^^^ trait fns cannot be const
+
+error[E0379]: trait fns cannot be declared const
+  --> $DIR/feature-gate-min_const_fn.rs:18:5
+   |
+LL |     const fn bar() -> u32 { 0 } //~ ERROR const fn is unstable
+   |     ^^^^^ trait fns cannot be const
+
+error[E0379]: trait fns cannot be declared const
+  --> $DIR/feature-gate-min_const_fn.rs:27:5
+   |
+LL |     const fn foo() -> u32 { 0 } //~ ERROR const fn is unstable
+   |     ^^^^^ trait fns cannot be const
+
+error[E0658]: const fn is unstable (see issue #53555)
+  --> $DIR/feature-gate-min_const_fn.rs:13:1
+   |
+LL | const fn foo() -> usize { 0 } //~ ERROR const fn is unstable
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = help: add #![feature(min_const_fn)] to the crate attributes to enable
+
+error[E0658]: const fn is unstable (see issue #24111)
+  --> $DIR/feature-gate-min_const_fn.rs:16:5
+   |
+LL |     const fn foo() -> u32; //~ ERROR const fn is unstable
+   |     ^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = help: add #![feature(const_fn)] to the crate attributes to enable
+
+error[E0658]: const fn is unstable (see issue #24111)
+  --> $DIR/feature-gate-min_const_fn.rs:18:5
+   |
+LL |     const fn bar() -> u32 { 0 } //~ ERROR const fn is unstable
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = help: add #![feature(const_fn)] to the crate attributes to enable
+
+error[E0658]: const fn is unstable (see issue #53555)
+  --> $DIR/feature-gate-min_const_fn.rs:23:5
+   |
+LL |     const fn baz() -> u32 { 0 } //~ ERROR const fn is unstable
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = help: add #![feature(min_const_fn)] to the crate attributes to enable
+
+error[E0658]: const fn is unstable (see issue #53555)
+  --> $DIR/feature-gate-min_const_fn.rs:27:5
+   |
+LL |     const fn foo() -> u32 { 0 } //~ ERROR const fn is unstable
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = help: add #![feature(min_const_fn)] to the crate attributes to enable
+
+error: aborting due to 8 previous errors
+
+Some errors occurred: E0379, E0658.
+For more information about an error, try `rustc --explain E0379`.
diff --git a/src/test/ui/infinite/infinite-recursion-const-fn.rs b/src/test/ui/infinite/infinite-recursion-const-fn.rs
index 4f1f6721450..63ae18cf9c2 100644
--- a/src/test/ui/infinite/infinite-recursion-const-fn.rs
+++ b/src/test/ui/infinite/infinite-recursion-const-fn.rs
@@ -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
diff --git a/src/test/ui/issues/issue-44415.rs b/src/test/ui/issues/issue-44415.rs
index 5d295510844..bd50f93945c 100644
--- a/src/test/ui/issues/issue-44415.rs
+++ b/src/test/ui/issues/issue-44415.rs
@@ -10,7 +10,7 @@
 
 //~^^^^^^^^^^ ERROR cycle detected when computing layout of
 
-#![feature(const_fn)]
+
 #![feature(core_intrinsics)]
 
 use std::intrinsics;
diff --git a/src/test/ui/unsafe/unsafe-const-fn.rs b/src/test/ui/unsafe/unsafe-const-fn.rs
index 765e2059a4b..fe0bb7533a8 100644
--- a/src/test/ui/unsafe/unsafe-const-fn.rs
+++ b/src/test/ui/unsafe/unsafe-const-fn.rs
@@ -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