Skip to content

Commit

Permalink
Auto merge of #85109 - RalfJung:remove-const_fn, r=oli-obk
Browse files Browse the repository at this point in the history
remove const_fn feature gate

Fixes #84510
r? `@oli-obk`
  • Loading branch information
bors committed May 11, 2021
2 parents 382f748 + 74918b7 commit 506e75c
Show file tree
Hide file tree
Showing 31 changed files with 55 additions and 136 deletions.
3 changes: 0 additions & 3 deletions compiler/rustc_feature/src/active.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,9 +274,6 @@ declare_features! (
/// Allows using non lexical lifetimes (RFC 2094).
(active, nll, "1.0.0", Some(43234), None),

/// Allows the definition of `const` functions with some advanced features.
(active, const_fn, "1.2.0", Some(57563), None),

/// Allows associated type defaults.
(active, associated_type_defaults, "1.2.0", Some(29661), None),

Expand Down
3 changes: 3 additions & 0 deletions compiler/rustc_feature/src/removed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@ declare_features! (
(removed, main, "1.53.0", Some(29634), None, None),
(removed, pub_macro_rules, "1.53.0", Some(78855), None,
Some("removed due to being incomplete, in particular it does not work across crates")),
/// Allows the definition of `const` functions with some advanced features.
(removed, const_fn, "1.54.0", Some(57563), None,
Some("split into finer-grained feature gates")),

// -------------------------------------------------------------------------
// feature-group-end: removed features
Expand Down
1 change: 0 additions & 1 deletion library/std/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,6 @@
#![feature(const_cstr_unchecked)]
#![feature(const_fn_floating_point_arithmetic)]
#![feature(const_fn_transmute)]
#![feature(const_fn)]
#![feature(const_fn_fn_ptr_basics)]
#![feature(const_io_structs)]
#![feature(const_ip)]
Expand Down
2 changes: 1 addition & 1 deletion src/ci/pgo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ RUSTC_BOOTSTRAP=1 ./build/$PGO_HOST/stage2/bin/rustc --edition=2018 \

# Download and build a single-file stress test benchmark on perf.rust-lang.org.
function pgo_perf_benchmark {
local PERF=9442def56a39d742bf27ebcc3e0614cf117e1bc2
local PERF=1e19fc4c6168d2f7596e512f42f358f245d8f09d
local github_prefix=https://raw.githubusercontent.com/rust-lang/rustc-perf/$PERF
local name=$1
curl -o /tmp/$name.rs $github_prefix/collector/benchmarks/$name/src/lib.rs
Expand Down
10 changes: 0 additions & 10 deletions src/doc/unstable-book/src/language-features/const-fn.md

This file was deleted.

35 changes: 0 additions & 35 deletions src/test/ui/feature-gates/feature-gate-const_fn.rs

This file was deleted.

21 changes: 0 additions & 21 deletions src/test/ui/feature-gates/feature-gate-const_fn.stderr

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// Test internal const fn feature gate.

#![feature(const_fn)]

#[rustc_const_unstable(feature="fzzzzzt")] //~ stability attributes may not be used outside
pub const fn bazinga() {}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0734]: stability attributes may not be used outside of the standard library
--> $DIR/feature-gate-rustc_const_unstable.rs:5:1
--> $DIR/feature-gate-rustc_const_unstable.rs:3:1
|
LL | #[rustc_const_unstable(feature="fzzzzzt")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/internal/internal-unstable-const.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#![stable(feature = "rust1", since = "1.0.0")]

#![feature(staged_api)]
#![feature(const_transmute, const_fn)]
#![feature(const_transmute)]

#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_stable(feature = "rust1", since = "1.0.0")]
Expand Down
2 changes: 0 additions & 2 deletions src/test/ui/issues/issue-54954.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![feature(const_fn)]

const ARR_LEN: usize = Tt::const_val::<[i8; 123]>();
//~^ ERROR type annotations needed

Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/issues/issue-54954.stderr
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
error[E0379]: functions in traits cannot be declared const
--> $DIR/issue-54954.rs:7:5
--> $DIR/issue-54954.rs:5:5
|
LL | const fn const_val<T: Sized>() -> usize {
| ^^^^^ functions in traits cannot be const

error[E0283]: type annotations needed
--> $DIR/issue-54954.rs:3:24
--> $DIR/issue-54954.rs:1:24
|
LL | const ARR_LEN: usize = Tt::const_val::<[i8; 123]>();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type
Expand Down
2 changes: 0 additions & 2 deletions src/test/ui/mismatched_types/const-fn-in-trait.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![feature(const_fn)]

trait Foo {
fn f() -> u32;
const fn g(); //~ ERROR cannot be declared const
Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/mismatched_types/const-fn-in-trait.stderr
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
error[E0379]: functions in traits cannot be declared const
--> $DIR/const-fn-in-trait.rs:5:5
--> $DIR/const-fn-in-trait.rs:3:5
|
LL | const fn g();
| ^^^^^ functions in traits cannot be const

error[E0379]: functions in traits cannot be declared const
--> $DIR/const-fn-in-trait.rs:9:5
--> $DIR/const-fn-in-trait.rs:7:5
|
LL | const fn f() -> u32 { 22 }
| ^^^^^ functions in traits cannot be const
Expand Down
1 change: 0 additions & 1 deletion src/test/ui/parser/fn-header-semantic-fail.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// edition:2018

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

fn main() {
async fn ff1() {} // OK.
Expand Down
40 changes: 20 additions & 20 deletions src/test/ui/parser/fn-header-semantic-fail.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: functions cannot be both `const` and `async`
--> $DIR/fn-header-semantic-fail.rs:13:5
--> $DIR/fn-header-semantic-fail.rs:12:5
|
LL | const async unsafe extern "C" fn ff5() {} // OK.
| ^^^^^-^^^^^------------------------------
Expand All @@ -8,7 +8,7 @@ LL | const async unsafe extern "C" fn ff5() {} // OK.
| `const` because of this

error[E0706]: functions in traits cannot be declared `async`
--> $DIR/fn-header-semantic-fail.rs:17:9
--> $DIR/fn-header-semantic-fail.rs:16:9
|
LL | async fn ft1();
| -----^^^^^^^^^^
Expand All @@ -19,19 +19,19 @@ LL | async fn ft1();
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait

error[E0379]: functions in traits cannot be declared const
--> $DIR/fn-header-semantic-fail.rs:19:9
--> $DIR/fn-header-semantic-fail.rs:18:9
|
LL | const fn ft3();
| ^^^^^ functions in traits cannot be const

error[E0379]: functions in traits cannot be declared const
--> $DIR/fn-header-semantic-fail.rs:21:9
--> $DIR/fn-header-semantic-fail.rs:20:9
|
LL | const async unsafe extern "C" fn ft5();
| ^^^^^ functions in traits cannot be const

error[E0706]: functions in traits cannot be declared `async`
--> $DIR/fn-header-semantic-fail.rs:21:9
--> $DIR/fn-header-semantic-fail.rs:20:9
|
LL | const async unsafe extern "C" fn ft5();
| ^^^^^^-----^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand All @@ -42,7 +42,7 @@ LL | const async unsafe extern "C" fn ft5();
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait

error: functions cannot be both `const` and `async`
--> $DIR/fn-header-semantic-fail.rs:21:9
--> $DIR/fn-header-semantic-fail.rs:20:9
|
LL | const async unsafe extern "C" fn ft5();
| ^^^^^-^^^^^----------------------------
Expand All @@ -51,7 +51,7 @@ LL | const async unsafe extern "C" fn ft5();
| `const` because of this

error[E0706]: functions in traits cannot be declared `async`
--> $DIR/fn-header-semantic-fail.rs:29:9
--> $DIR/fn-header-semantic-fail.rs:28:9
|
LL | async fn ft1() {}
| -----^^^^^^^^^^^^
Expand All @@ -62,19 +62,19 @@ LL | async fn ft1() {}
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait

error[E0379]: functions in traits cannot be declared const
--> $DIR/fn-header-semantic-fail.rs:32:9
--> $DIR/fn-header-semantic-fail.rs:31:9
|
LL | const fn ft3() {}
| ^^^^^ functions in traits cannot be const

error[E0379]: functions in traits cannot be declared const
--> $DIR/fn-header-semantic-fail.rs:34:9
--> $DIR/fn-header-semantic-fail.rs:33:9
|
LL | const async unsafe extern "C" fn ft5() {}
| ^^^^^ functions in traits cannot be const

error[E0706]: functions in traits cannot be declared `async`
--> $DIR/fn-header-semantic-fail.rs:34:9
--> $DIR/fn-header-semantic-fail.rs:33:9
|
LL | const async unsafe extern "C" fn ft5() {}
| ^^^^^^-----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand All @@ -85,7 +85,7 @@ LL | const async unsafe extern "C" fn ft5() {}
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait

error: functions cannot be both `const` and `async`
--> $DIR/fn-header-semantic-fail.rs:34:9
--> $DIR/fn-header-semantic-fail.rs:33:9
|
LL | const async unsafe extern "C" fn ft5() {}
| ^^^^^-^^^^^------------------------------
Expand All @@ -94,7 +94,7 @@ LL | const async unsafe extern "C" fn ft5() {}
| `const` because of this

error: functions cannot be both `const` and `async`
--> $DIR/fn-header-semantic-fail.rs:46:9
--> $DIR/fn-header-semantic-fail.rs:45:9
|
LL | const async unsafe extern "C" fn fi5() {}
| ^^^^^-^^^^^------------------------------
Expand All @@ -103,7 +103,7 @@ LL | const async unsafe extern "C" fn fi5() {}
| `const` because of this

error: functions in `extern` blocks cannot have qualifiers
--> $DIR/fn-header-semantic-fail.rs:51:18
--> $DIR/fn-header-semantic-fail.rs:50:18
|
LL | extern "C" {
| ---------- in this `extern` block
Expand All @@ -116,7 +116,7 @@ LL | fn fe1();
| ^^

error: functions in `extern` blocks cannot have qualifiers
--> $DIR/fn-header-semantic-fail.rs:52:19
--> $DIR/fn-header-semantic-fail.rs:51:19
|
LL | extern "C" {
| ---------- in this `extern` block
Expand All @@ -130,7 +130,7 @@ LL | fn fe2();
| ^^

error: functions in `extern` blocks cannot have qualifiers
--> $DIR/fn-header-semantic-fail.rs:53:18
--> $DIR/fn-header-semantic-fail.rs:52:18
|
LL | extern "C" {
| ---------- in this `extern` block
Expand All @@ -144,7 +144,7 @@ LL | fn fe3();
| ^^

error: functions in `extern` blocks cannot have qualifiers
--> $DIR/fn-header-semantic-fail.rs:54:23
--> $DIR/fn-header-semantic-fail.rs:53:23
|
LL | extern "C" {
| ---------- in this `extern` block
Expand All @@ -158,7 +158,7 @@ LL | fn fe4();
| ^^

error: functions in `extern` blocks cannot have qualifiers
--> $DIR/fn-header-semantic-fail.rs:55:42
--> $DIR/fn-header-semantic-fail.rs:54:42
|
LL | extern "C" {
| ---------- in this `extern` block
Expand All @@ -172,7 +172,7 @@ LL | fn fe5();
| ^^

error: functions cannot be both `const` and `async`
--> $DIR/fn-header-semantic-fail.rs:55:9
--> $DIR/fn-header-semantic-fail.rs:54:9
|
LL | const async unsafe extern "C" fn fe5();
| ^^^^^-^^^^^----------------------------
Expand All @@ -181,7 +181,7 @@ LL | const async unsafe extern "C" fn fe5();
| `const` because of this

error[E0053]: method `ft1` has an incompatible type for trait
--> $DIR/fn-header-semantic-fail.rs:29:24
--> $DIR/fn-header-semantic-fail.rs:28:24
|
LL | async fn ft1();
| - type in trait
Expand All @@ -197,7 +197,7 @@ LL | async fn ft1() {}
found fn pointer `fn() -> impl Future`

error[E0053]: method `ft5` has an incompatible type for trait
--> $DIR/fn-header-semantic-fail.rs:34:48
--> $DIR/fn-header-semantic-fail.rs:33:48
|
LL | const async unsafe extern "C" fn ft5();
| - type in trait
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// run-pass
// compile-flags: -Z unleash-the-miri-inside-of-you

#![feature(core_intrinsics, const_caller_location, const_fn)]
#![feature(core_intrinsics, const_caller_location)]

type L = &'static std::panic::Location<'static>;

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/rfc-2091-track-caller/const-caller-location.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// revisions: default mir-opt
//[mir-opt] compile-flags: -Zmir-opt-level=4

#![feature(const_caller_location, const_fn)]
#![feature(const_caller_location)]

use std::panic::Location;

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/rustc-args-required-const2.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![feature(rustc_attrs, const_fn)]
#![feature(rustc_attrs)]

#[rustc_args_required_const(0)]
fn foo(_a: i32) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Various checks that stability attributes are used correctly, per RFC 507

#![feature(const_fn, staged_api)]
#![feature(staged_api)]

#![stable(feature = "rust1", since = "1.0.0")]

Expand Down
2 changes: 0 additions & 2 deletions src/test/ui/static/static-drop-scope.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![feature(const_fn)]

struct WithDtor;

impl Drop for WithDtor {
Expand Down
Loading

0 comments on commit 506e75c

Please sign in to comment.