Skip to content

Commit aef6288

Browse files
committed
const fn feature gate is not needed anymore in a lot of tests
1 parent a49acea commit aef6288

13 files changed

+38
-37
lines changed

src/test/run-pass/ctfe/const-block-non-item-statement-3.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,6 @@
33

44
type Array = [u32; { let x = 2; 5 }];
55

6-
pub fn main() {}
6+
pub fn main() {
7+
let _: Array = [0; 5];
8+
}
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
// run-pass
22
#![allow(dead_code)]
33

4+
#[repr(u8)]
45
enum Foo {
56
Bar = { let x = 1; 3 }
67
}
78

8-
pub fn main() {}
9+
pub fn main() {
10+
assert_eq!(3, Foo::Bar as u8);
11+
}

src/test/run-pass/ctfe/locals-in-const-fn.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
// https://github.com/rust-lang/rust/issues/48821
44

5-
#![feature(const_fn)]
6-
75
const fn foo(i: usize) -> usize {
86
let x = i;
97
x

src/test/ui/consts/const_let_assign2.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
// compile-pass
22

3-
#![feature(const_fn)]
4-
53
pub struct AA {
64
pub data: [u8; 10],
75
}

src/test/ui/consts/const_let_assign3.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,14 @@ const FOO: S = {
1717
s
1818
};
1919

20-
type Array = [u32; { let mut x = 2; let y = &mut x; *y = 42; *y}];
20+
type Array = [u32; {
21+
let mut x = 2;
22+
let y = &mut x;
2123
//~^ ERROR references in constants may only refer to immutable values
22-
//~| ERROR constant contains unimplemented expression type
24+
*y = 42;
25+
//~^ ERROR constant contains unimplemented expression type
26+
*y
27+
}];
2328

2429
fn main() {
2530
assert_eq!(FOO.state, 3);

src/test/ui/consts/const_let_assign3.stderr

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@ LL | s.foo(3); //~ ERROR references in constants may only refer to immutable
1111
| ^ constants require immutable values
1212

1313
error[E0017]: references in constants may only refer to immutable values
14-
--> $DIR/const_let_assign3.rs:20:45
14+
--> $DIR/const_let_assign3.rs:22:13
1515
|
16-
LL | type Array = [u32; { let mut x = 2; let y = &mut x; *y = 42; *y}];
17-
| ^^^^^^ constants require immutable values
16+
LL | let y = &mut x;
17+
| ^^^^^^ constants require immutable values
1818

1919
error[E0019]: constant contains unimplemented expression type
20-
--> $DIR/const_let_assign3.rs:20:53
20+
--> $DIR/const_let_assign3.rs:24:5
2121
|
22-
LL | type Array = [u32; { let mut x = 2; let y = &mut x; *y = 42; *y}];
23-
| ^^^^^^^
22+
LL | *y = 42;
23+
| ^^^^^^^
2424

2525
error: aborting due to 4 previous errors
2626

src/test/ui/consts/const_let_eq.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![feature(const_fn)]
2-
31
// run-pass
42

53
struct Foo<T>(T);

src/test/ui/issues/issue-32829-2.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
// ignore-tidy-linelength
22

3-
#![feature(const_fn)]
4-
53
const bad : u32 = {
64
{
75
5;

src/test/ui/issues/issue-32829-2.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
error[E0015]: calls in constants are limited to constant functions, tuple structs and tuple variants
2-
--> $DIR/issue-32829-2.rs:14:9
2+
--> $DIR/issue-32829-2.rs:12:9
33
|
44
LL | invalid();
55
| ^^^^^^^^^
66

77
error[E0015]: calls in statics are limited to constant functions, tuple structs and tuple variants
8-
--> $DIR/issue-32829-2.rs:36:9
8+
--> $DIR/issue-32829-2.rs:34:9
99
|
1010
LL | invalid();
1111
| ^^^^^^^^^
1212

1313
error[E0015]: calls in statics are limited to constant functions, tuple structs and tuple variants
14-
--> $DIR/issue-32829-2.rs:58:9
14+
--> $DIR/issue-32829-2.rs:56:9
1515
|
1616
LL | invalid();
1717
| ^^^^^^^^^
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![feature(rustc_attrs, const_fn)]
1+
#![feature(rustc_attrs)]
22

33
#[rustc_layout_scalar_valid_range_start(1)]
44
#[repr(transparent)]
@@ -8,13 +8,13 @@ fn main() {
88

99
const fn foo() -> NonZero<u32> {
1010
let mut x = unsafe { NonZero(1) };
11-
let y = &mut x.0; //~ ERROR references in constant functions may only refer to immutable
11+
let y = &mut x.0; //~ ERROR references in const fn are unstable
1212
//~^ ERROR mutation of layout constrained field is unsafe
1313
unsafe { NonZero(1) }
1414
}
1515

1616
const fn bar() -> NonZero<u32> {
1717
let mut x = unsafe { NonZero(1) };
18-
let y = unsafe { &mut x.0 }; //~ ERROR references in constant functions may only refer to immut
18+
let y = unsafe { &mut x.0 }; //~ ERROR mutable references in const fn are unstable
1919
unsafe { NonZero(1) }
2020
}
Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,23 @@
1-
error[E0017]: references in constant functions may only refer to immutable values
2-
--> $DIR/ranged_ints2_const.rs:11:13
1+
error: mutable references in const fn are unstable
2+
--> $DIR/ranged_ints2_const.rs:11:9
33
|
4-
LL | let y = &mut x.0; //~ ERROR references in constant functions may only refer to immutable
5-
| ^^^^^^^^ constant functions require immutable values
4+
LL | let y = &mut x.0; //~ ERROR references in const fn are unstable
5+
| ^
66

7-
error[E0017]: references in constant functions may only refer to immutable values
8-
--> $DIR/ranged_ints2_const.rs:18:22
7+
error: mutable references in const fn are unstable
8+
--> $DIR/ranged_ints2_const.rs:18:9
99
|
10-
LL | let y = unsafe { &mut x.0 }; //~ ERROR references in constant functions may only refer to immut
11-
| ^^^^^^^^ constant functions require immutable values
10+
LL | let y = unsafe { &mut x.0 }; //~ ERROR mutable references in const fn are unstable
11+
| ^
1212

1313
error[E0133]: mutation of layout constrained field is unsafe and requires unsafe function or block
1414
--> $DIR/ranged_ints2_const.rs:11:13
1515
|
16-
LL | let y = &mut x.0; //~ ERROR references in constant functions may only refer to immutable
16+
LL | let y = &mut x.0; //~ ERROR references in const fn are unstable
1717
| ^^^^^^^^ mutation of layout constrained field
1818
|
1919
= note: mutating layout constrained fields cannot statically be checked for valid values
2020

2121
error: aborting due to 3 previous errors
2222

23-
Some errors occurred: E0017, E0133.
24-
For more information about an error, try `rustc --explain E0017`.
23+
For more information about this error, try `rustc --explain E0133`.

src/test/ui/unsafe/ranged_ints3_const.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![feature(rustc_attrs, const_fn)]
1+
#![feature(rustc_attrs)]
22

33
use std::cell::Cell;
44

src/test/ui/unsafe/ranged_ints4_const.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![feature(rustc_attrs, const_fn)]
1+
#![feature(rustc_attrs)]
22

33
#[rustc_layout_scalar_valid_range_start(1)]
44
#[repr(transparent)]

0 commit comments

Comments
 (0)