Skip to content

Commit 3752c6b

Browse files
committed
remove const_fn feature gate from const tests
1 parent 9a85277 commit 3752c6b

Some content is hidden

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

51 files changed

+69
-105
lines changed

src/test/ui/array-slice-vec/subslice-patterns-const-eval-match.rs

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

33
// run-pass
44

5-
#![feature(const_fn)]
6-
75
#[derive(PartialEq, Debug, Clone)]
86
struct N(u8);
97

src/test/ui/associated-consts/associated-const-in-trait.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// #29924
22

3-
#![feature(const_fn, associated_consts)]
3+
#![feature(associated_consts)]
44

55
trait Trait {
66
const N: usize;

src/test/ui/consts/const-eval/auxiliary/stability.rs

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#![crate_type="rlib"]
44
#![stable(feature = "rust1", since = "1.0.0")]
55

6-
#![feature(const_fn)]
76
#![feature(staged_api)]
87

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

src/test/ui/consts/const-eval/const_fn_ptr.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// run-pass
22
// compile-flags: -Zunleash-the-miri-inside-of-you
3-
#![feature(const_fn)]
43

54
fn double(x: usize) -> usize { x * 2 }
65
const fn double_const(x: usize) -> usize { x * 2 }

src/test/ui/consts/const-eval/const_fn_ptr.stderr

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
warning: skipping const checks
22
|
33
help: skipping check that does not even have a feature gate
4-
--> $DIR/const_fn_ptr.rs:12:5
4+
--> $DIR/const_fn_ptr.rs:11:5
55
|
66
LL | X(x)
77
| ^^^^
88
help: skipping check that does not even have a feature gate
9-
--> $DIR/const_fn_ptr.rs:16:5
9+
--> $DIR/const_fn_ptr.rs:15:5
1010
|
1111
LL | X_CONST(x)
1212
| ^^^^^^^^^^
1313
help: skipping check for `const_fn_fn_ptr_basics` feature
14-
--> $DIR/const_fn_ptr.rs:19:14
14+
--> $DIR/const_fn_ptr.rs:18:14
1515
|
1616
LL | const fn foo(x: fn(usize) -> usize, y: usize) -> usize {
1717
| ^
1818
help: skipping check for `const_fn_fn_ptr_basics` feature
19-
--> $DIR/const_fn_ptr.rs:20:5
19+
--> $DIR/const_fn_ptr.rs:19:5
2020
|
2121
LL | x(y)
2222
| ^
2323
help: skipping check that does not even have a feature gate
24-
--> $DIR/const_fn_ptr.rs:20:5
24+
--> $DIR/const_fn_ptr.rs:19:5
2525
|
2626
LL | x(y)
2727
| ^^^^

src/test/ui/consts/const-eval/const_fn_ptr_fail.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// run-pass
22
// compile-flags: -Zunleash-the-miri-inside-of-you
3-
#![feature(const_fn)]
43
#![allow(unused)]
54

65
fn double(x: usize) -> usize { x * 2 }

src/test/ui/consts/const-eval/const_fn_ptr_fail.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
warning: skipping const checks
22
|
33
help: skipping check that does not even have a feature gate
4-
--> $DIR/const_fn_ptr_fail.rs:10:5
4+
--> $DIR/const_fn_ptr_fail.rs:9:5
55
|
66
LL | X(x) // FIXME: this should error someday
77
| ^^^^

src/test/ui/consts/const-eval/const_fn_ptr_fail2.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// build-fail
22
// compile-flags: -Zunleash-the-miri-inside-of-you
33

4-
#![feature(const_fn)]
54
#![allow(const_err)]
65

76
fn double(x: usize) -> usize {

src/test/ui/consts/const-eval/const_fn_ptr_fail2.stderr

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11
error[E0080]: evaluation of constant value failed
2-
--> $DIR/const_fn_ptr_fail2.rs:20:16
2+
--> $DIR/const_fn_ptr_fail2.rs:19:16
33
|
44
LL | assert_eq!(Y, 4);
55
| ^ referenced constant has errors
66

77
error[E0080]: evaluation of constant value failed
8-
--> $DIR/const_fn_ptr_fail2.rs:22:16
8+
--> $DIR/const_fn_ptr_fail2.rs:21:16
99
|
1010
LL | assert_eq!(Z, 4);
1111
| ^ referenced constant has errors
1212

1313
warning: skipping const checks
1414
|
1515
help: skipping check for `const_fn_fn_ptr_basics` feature
16-
--> $DIR/const_fn_ptr_fail2.rs:12:14
16+
--> $DIR/const_fn_ptr_fail2.rs:11:14
1717
|
1818
LL | const fn bar(x: fn(usize) -> usize, y: usize) -> usize {
1919
| ^
2020
help: skipping check for `const_fn_fn_ptr_basics` feature
21-
--> $DIR/const_fn_ptr_fail2.rs:13:5
21+
--> $DIR/const_fn_ptr_fail2.rs:12:5
2222
|
2323
LL | x(y)
2424
| ^
2525
help: skipping check that does not even have a feature gate
26-
--> $DIR/const_fn_ptr_fail2.rs:13:5
26+
--> $DIR/const_fn_ptr_fail2.rs:12:5
2727
|
2828
LL | x(y)
2929
| ^^^^

src/test/ui/consts/const-eval/dont_promote_unstable_const_fn.rs

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
we're apparently really bad at it",
44
issue = "none")]
55

6-
#![feature(const_fn)]
76
#![feature(staged_api)]
87

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

src/test/ui/consts/const-eval/dont_promote_unstable_const_fn.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
error: `foo` is not yet stable as a const fn
2-
--> $DIR/dont_promote_unstable_const_fn.rs:15:25
2+
--> $DIR/dont_promote_unstable_const_fn.rs:14:25
33
|
44
LL | const fn bar() -> u32 { foo() }
55
| ^^^^^
66
|
77
= help: add `#![feature(foo)]` to the crate attributes to enable
88

99
error[E0716]: temporary value dropped while borrowed
10-
--> $DIR/dont_promote_unstable_const_fn.rs:18:28
10+
--> $DIR/dont_promote_unstable_const_fn.rs:17:28
1111
|
1212
LL | let _: &'static u32 = &foo();
1313
| ------------ ^^^^^ creates a temporary which is freed while still in use
@@ -17,7 +17,7 @@ LL | }
1717
| - temporary value is freed at the end of this statement
1818

1919
error[E0716]: temporary value dropped while borrowed
20-
--> $DIR/dont_promote_unstable_const_fn.rs:22:28
20+
--> $DIR/dont_promote_unstable_const_fn.rs:21:28
2121
|
2222
LL | let _: &'static u32 = &meh();
2323
| ------------ ^^^^^ creates a temporary which is freed while still in use
@@ -28,7 +28,7 @@ LL | }
2828
| - temporary value is freed at the end of this statement
2929

3030
error[E0716]: temporary value dropped while borrowed
31-
--> $DIR/dont_promote_unstable_const_fn.rs:23:26
31+
--> $DIR/dont_promote_unstable_const_fn.rs:22:26
3232
|
3333
LL | let x: &'static _ = &std::time::Duration::from_millis(42).subsec_millis();
3434
| ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use

src/test/ui/consts/const-eval/double_promotion.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// check-pass
22

3-
#![feature(const_fn, rustc_attrs)]
3+
#![feature(rustc_attrs)]
44

55
#[rustc_args_required_const(0)]
66
pub const fn a(value: u8) -> u8 {

src/test/ui/consts/const-eval/feature-gate-const_fn_union.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![feature(const_fn)]
2-
31
fn main() {}
42

53
#[repr(C)]

src/test/ui/consts/const-eval/feature-gate-const_fn_union.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0658]: unions in const fn are unstable
2-
--> $DIR/feature-gate-const_fn_union.rs:12:5
2+
--> $DIR/feature-gate-const_fn_union.rs:10:5
33
|
44
LL | Foo { u }.i
55
| ^^^^^^^^^^^

src/test/ui/consts/const-eval/promoted_const_fn_fail.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![feature(const_fn, const_fn_union)]
1+
#![feature(const_fn_union)]
22

33
#![allow(const_err)]
44

src/test/ui/consts/const-eval/promoted_const_fn_fail_deny_const_err.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![feature(const_fn, const_fn_union)]
1+
#![feature(const_fn_union)]
22

33
#![deny(const_err)]
44

src/test/ui/consts/const-eval/simd/insert_extract.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// run-pass
2-
#![feature(const_fn)]
32
#![feature(repr_simd)]
43
#![feature(platform_intrinsics)]
54
#![feature(staged_api)]

src/test/ui/consts/const-eval/union-const-eval-field.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// only-x86_64
2-
#![feature(const_fn)]
32

43
type Field1 = i32;
54
type Field2 = f32;

src/test/ui/consts/const-eval/union-const-eval-field.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0080]: it is undefined behavior to use this value
2-
--> $DIR/union-const-eval-field.rs:29:5
2+
--> $DIR/union-const-eval-field.rs:28:5
33
|
44
LL | const FIELD3: Field3 = unsafe { UNION.field3 };
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered uninitialized bytes, but expected initialized plain (non-pointer) bytes

src/test/ui/consts/const-eval/union-ice.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// only-x86_64
2-
#![feature(const_fn)]
32

43
type Field1 = i32;
54
type Field3 = i64;

src/test/ui/consts/const-eval/union-ice.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0080]: it is undefined behavior to use this value
2-
--> $DIR/union-ice.rs:15:1
2+
--> $DIR/union-ice.rs:14:1
33
|
44
LL | const FIELD3: Field3 = unsafe { UNION.field3 };
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered uninitialized bytes, but expected initialized plain (non-pointer) bytes
@@ -10,7 +10,7 @@ LL | const FIELD3: Field3 = unsafe { UNION.field3 };
1010
}
1111

1212
error[E0080]: it is undefined behavior to use this value
13-
--> $DIR/union-ice.rs:17:1
13+
--> $DIR/union-ice.rs:16:1
1414
|
1515
LL | / const FIELD_PATH: Struct = Struct {
1616
LL | | a: 42,
@@ -24,7 +24,7 @@ LL | | };
2424
}
2525

2626
error[E0080]: it is undefined behavior to use this value
27-
--> $DIR/union-ice.rs:27:1
27+
--> $DIR/union-ice.rs:26:1
2828
|
2929
LL | / const FIELD_PATH2: Struct2 = Struct2 {
3030
LL | | b: [

src/test/ui/consts/const-eval/validate_uninhabited_zsts.64bit.stderr

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
warning: any use of this value will cause an error
2-
--> $DIR/validate_uninhabited_zsts.rs:6:14
2+
--> $DIR/validate_uninhabited_zsts.rs:5:14
33
|
44
LL | unsafe { std::mem::transmute(()) }
55
| ^^^^^^^^^^^^^^^^^^^^^^^
66
| |
77
| transmuting to uninhabited type
8-
| inside `foo` at $DIR/validate_uninhabited_zsts.rs:6:14
9-
| inside `FOO` at $DIR/validate_uninhabited_zsts.rs:16:26
8+
| inside `foo` at $DIR/validate_uninhabited_zsts.rs:5:14
9+
| inside `FOO` at $DIR/validate_uninhabited_zsts.rs:15:26
1010
...
1111
LL | const FOO: [Empty; 3] = [foo(); 3];
1212
| -----------------------------------
1313
|
1414
note: the lint level is defined here
15-
--> $DIR/validate_uninhabited_zsts.rs:15:8
15+
--> $DIR/validate_uninhabited_zsts.rs:14:8
1616
|
1717
LL | #[warn(const_err)]
1818
| ^^^^^^^^^
1919
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
2020
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
2121

2222
error[E0080]: it is undefined behavior to use this value
23-
--> $DIR/validate_uninhabited_zsts.rs:19:1
23+
--> $DIR/validate_uninhabited_zsts.rs:18:1
2424
|
2525
LL | const BAR: [Empty; 3] = [unsafe { std::mem::transmute(()) }; 3];
2626
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a value of uninhabited type Empty at [0]
@@ -29,7 +29,7 @@ LL | const BAR: [Empty; 3] = [unsafe { std::mem::transmute(()) }; 3];
2929
= note: the raw bytes of the constant (size: 0, align: 1) {}
3030

3131
warning: the type `!` does not permit zero-initialization
32-
--> $DIR/validate_uninhabited_zsts.rs:6:14
32+
--> $DIR/validate_uninhabited_zsts.rs:5:14
3333
|
3434
LL | unsafe { std::mem::transmute(()) }
3535
| ^^^^^^^^^^^^^^^^^^^^^^^
@@ -41,7 +41,7 @@ LL | unsafe { std::mem::transmute(()) }
4141
= note: the `!` type has no valid value
4242

4343
warning: the type `Empty` does not permit zero-initialization
44-
--> $DIR/validate_uninhabited_zsts.rs:19:35
44+
--> $DIR/validate_uninhabited_zsts.rs:18:35
4545
|
4646
LL | const BAR: [Empty; 3] = [unsafe { std::mem::transmute(()) }; 3];
4747
| ^^^^^^^^^^^^^^^^^^^^^^^

src/test/ui/consts/const-eval/validate_uninhabited_zsts.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// stderr-per-bitwidth
2-
#![feature(const_fn)]
32
#![feature(const_fn_transmute)]
43

54
const fn foo() -> ! {

src/test/ui/consts/const-fn-error.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![feature(const_fn)]
2-
31
const X : usize = 2;
42

53
const fn f(x: usize) -> usize {

src/test/ui/consts/const-fn-error.stderr

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0744]: `for` is not allowed in a `const fn`
2-
--> $DIR/const-fn-error.rs:7:5
2+
--> $DIR/const-fn-error.rs:5:5
33
|
44
LL | / for i in 0..x {
55
LL | |
@@ -11,13 +11,13 @@ LL | | }
1111
| |_____^
1212

1313
error[E0015]: calls in constant functions are limited to constant functions, tuple structs and tuple variants
14-
--> $DIR/const-fn-error.rs:7:14
14+
--> $DIR/const-fn-error.rs:5:14
1515
|
1616
LL | for i in 0..x {
1717
| ^^^^
1818

1919
error[E0658]: mutable references are not allowed in constant functions
20-
--> $DIR/const-fn-error.rs:7:14
20+
--> $DIR/const-fn-error.rs:5:14
2121
|
2222
LL | for i in 0..x {
2323
| ^^^^
@@ -26,22 +26,22 @@ LL | for i in 0..x {
2626
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
2727

2828
error[E0015]: calls in constant functions are limited to constant functions, tuple structs and tuple variants
29-
--> $DIR/const-fn-error.rs:7:14
29+
--> $DIR/const-fn-error.rs:5:14
3030
|
3131
LL | for i in 0..x {
3232
| ^^^^
3333

3434
error[E0080]: evaluation of constant value failed
35-
--> $DIR/const-fn-error.rs:7:14
35+
--> $DIR/const-fn-error.rs:5:14
3636
|
3737
LL | for i in 0..x {
3838
| ^^^^
3939
| |
4040
| calling non-const function `<std::ops::Range<usize> as IntoIterator>::into_iter`
41-
| inside `f` at $DIR/const-fn-error.rs:7:14
41+
| inside `f` at $DIR/const-fn-error.rs:5:14
4242
...
4343
LL | let a : [i32; f(X)];
44-
| ---- inside `main::{constant#0}` at $DIR/const-fn-error.rs:20:19
44+
| ---- inside `main::{constant#0}` at $DIR/const-fn-error.rs:18:19
4545

4646
error: aborting due to 5 previous errors
4747

src/test/ui/consts/const-fn-mismatch.rs

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
// it if the trait fn is const (but right now no trait fns can be
44
// const).
55

6-
#![feature(const_fn)]
7-
86
trait Foo {
97
fn f() -> u32;
108
}

src/test/ui/consts/const-fn-mismatch.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0379]: functions in traits cannot be declared const
2-
--> $DIR/const-fn-mismatch.rs:13:5
2+
--> $DIR/const-fn-mismatch.rs:11:5
33
|
44
LL | const fn f() -> u32 {
55
| ^^^^^ functions in traits cannot be const

src/test/ui/consts/const-fn-not-in-trait.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
// Test that const fn is illegal in a trait declaration, whether or
22
// not a default is provided, and even with the feature gate.
33

4-
#![feature(const_fn)]
5-
64
trait Foo {
75
const fn f() -> u32;
86
//~^ ERROR functions in traits cannot be declared const

src/test/ui/consts/const-fn-not-in-trait.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
error[E0379]: functions in traits cannot be declared const
2-
--> $DIR/const-fn-not-in-trait.rs:7:5
2+
--> $DIR/const-fn-not-in-trait.rs:5:5
33
|
44
LL | const fn f() -> u32;
55
| ^^^^^ functions in traits cannot be const
66

77
error[E0379]: functions in traits cannot be declared const
8-
--> $DIR/const-fn-not-in-trait.rs:9:5
8+
--> $DIR/const-fn-not-in-trait.rs:7:5
99
|
1010
LL | const fn g() -> u32 {
1111
| ^^^^^ functions in traits cannot be const

0 commit comments

Comments
 (0)