add test for closures in abstract consts

This commit is contained in:
Bastian Kauschke 2020-09-21 22:01:18 +02:00
parent 7a02ebd828
commit 9a493ced74
2 changed files with 21 additions and 0 deletions

View File

@ -0,0 +1,6 @@
#![feature(const_generics, const_evaluatable_checked)]
#![allow(incomplete_features)]
fn test<const N: usize>() -> [u8; N + (|| 42)()] {}
//~^ ERROR overly complex generic constant
fn main() {}

View File

@ -0,0 +1,15 @@
error: overly complex generic constant
--> $DIR/closures.rs:3:35
|
LL | fn test<const N: usize>() -> [u8; N + (|| 42)()] {}
| ^^^^^^^^^^^^^
|
note: unsupported rvalue
--> $DIR/closures.rs:3:39
|
LL | fn test<const N: usize>() -> [u8; N + (|| 42)()] {}
| ^^^^^^^
= help: consider moving this anonymous constant into a `const` function
error: aborting due to previous error