Add const_for test

This commit is contained in:
Jonas Schievink 2021-07-29 02:56:03 +02:00
parent dbd126901a
commit 3c6678a968
2 changed files with 25 additions and 0 deletions

View file

@ -0,0 +1,10 @@
#![feature(const_for)]
#![feature(const_mut_refs)]
const _: () = {
for _ in 0..5 {}
//~^ error: calls in constants are limited to
//~| error: calls in constants are limited to
};
fn main() {}

View file

@ -0,0 +1,15 @@
error[E0015]: calls in constants are limited to constant functions, tuple structs and tuple variants
--> $DIR/const-for.rs:5:14
|
LL | for _ in 0..5 {}
| ^^^^
error[E0015]: calls in constants are limited to constant functions, tuple structs and tuple variants
--> $DIR/const-for.rs:5:14
|
LL | for _ in 0..5 {}
| ^^^^
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0015`.