From: Bastian Kauschke Date: Mon, 21 Sep 2020 20:01:18 +0000 (+0200) Subject: add test for closures in abstract consts X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=9a493ced748e2e3e7390fc6f28640d23cb90e67b;p=rust.git add test for closures in abstract consts --- diff --git a/src/test/ui/const-generics/const_evaluatable_checked/closures.rs b/src/test/ui/const-generics/const_evaluatable_checked/closures.rs new file mode 100644 index 00000000000..32f43591e37 --- /dev/null +++ b/src/test/ui/const-generics/const_evaluatable_checked/closures.rs @@ -0,0 +1,6 @@ +#![feature(const_generics, const_evaluatable_checked)] +#![allow(incomplete_features)] +fn test() -> [u8; N + (|| 42)()] {} +//~^ ERROR overly complex generic constant + +fn main() {} diff --git a/src/test/ui/const-generics/const_evaluatable_checked/closures.stderr b/src/test/ui/const-generics/const_evaluatable_checked/closures.stderr new file mode 100644 index 00000000000..7bb23f1488d --- /dev/null +++ b/src/test/ui/const-generics/const_evaluatable_checked/closures.stderr @@ -0,0 +1,15 @@ +error: overly complex generic constant + --> $DIR/closures.rs:3:35 + | +LL | fn test() -> [u8; N + (|| 42)()] {} + | ^^^^^^^^^^^^^ + | +note: unsupported rvalue + --> $DIR/closures.rs:3:39 + | +LL | fn test() -> [u8; N + (|| 42)()] {} + | ^^^^^^^ + = help: consider moving this anonymous constant into a `const` function + +error: aborting due to previous error +