Skip to content

Commit 3c6678a

Browse files
Add const_for test
1 parent dbd1269 commit 3c6678a

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

src/test/ui/consts/const-for.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#![feature(const_for)]
2+
#![feature(const_mut_refs)]
3+
4+
const _: () = {
5+
for _ in 0..5 {}
6+
//~^ error: calls in constants are limited to
7+
//~| error: calls in constants are limited to
8+
};
9+
10+
fn main() {}

src/test/ui/consts/const-for.stderr

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
error[E0015]: calls in constants are limited to constant functions, tuple structs and tuple variants
2+
--> $DIR/const-for.rs:5:14
3+
|
4+
LL | for _ in 0..5 {}
5+
| ^^^^
6+
7+
error[E0015]: calls in constants are limited to constant functions, tuple structs and tuple variants
8+
--> $DIR/const-for.rs:5:14
9+
|
10+
LL | for _ in 0..5 {}
11+
| ^^^^
12+
13+
error: aborting due to 2 previous errors
14+
15+
For more information about this error, try `rustc --explain E0015`.

0 commit comments

Comments
 (0)