Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add test for closures in abstract consts
- Loading branch information
Showing
2 changed files
with
21 additions
and
0 deletions.
There are no files selected for viewing
6 changes: 6 additions & 0 deletions
6
src/test/ui/const-generics/const_evaluatable_checked/closures.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() {} |
15 changes: 15 additions & 0 deletions
15
src/test/ui/const-generics/const_evaluatable_checked/closures.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|