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
}

0 commit comments

Comments
 (0)