From 3c6678a968cef1e3b9024b28c8a0130728027e27 Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Thu, 29 Jul 2021 02:56:03 +0200 Subject: [PATCH] Add `const_for` test --- src/test/ui/consts/const-for.rs | 10 ++++++++++ src/test/ui/consts/const-for.stderr | 15 +++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 src/test/ui/consts/const-for.rs create mode 100644 src/test/ui/consts/const-for.stderr diff --git a/src/test/ui/consts/const-for.rs b/src/test/ui/consts/const-for.rs new file mode 100644 index 00000000000..5fc1ee0e369 --- /dev/null +++ b/src/test/ui/consts/const-for.rs @@ -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() {} diff --git a/src/test/ui/consts/const-for.stderr b/src/test/ui/consts/const-for.stderr new file mode 100644 index 00000000000..a35c04b3570 --- /dev/null +++ b/src/test/ui/consts/const-for.stderr @@ -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`.