Skip to content

Commit 9a493ce

Browse files
committed
add test for closures in abstract consts
1 parent 7a02ebd commit 9a493ce

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#![feature(const_generics, const_evaluatable_checked)]
2+
#![allow(incomplete_features)]
3+
fn test<const N: usize>() -> [u8; N + (|| 42)()] {}
4+
//~^ ERROR overly complex generic constant
5+
6+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
error: overly complex generic constant
2+
--> $DIR/closures.rs:3:35
3+
|
4+
LL | fn test<const N: usize>() -> [u8; N + (|| 42)()] {}
5+
| ^^^^^^^^^^^^^
6+
|
7+
note: unsupported rvalue
8+
--> $DIR/closures.rs:3:39
9+
|
10+
LL | fn test<const N: usize>() -> [u8; N + (|| 42)()] {}
11+
| ^^^^^^^
12+
= help: consider moving this anonymous constant into a `const` function
13+
14+
error: aborting due to previous error
15+

0 commit comments

Comments
 (0)