Closed
Description
#![feature(const_generics)]
fn main() {
takes_closure_of_array_3(|[x, y, z]| {
println!("args: x={}, y={}, z={}", x, y, z);
});
}
fn takes_closure_of_array_3<F>(f: F)
where
F: Fn([i32; 3]),
{
f([1, 2, 3]);
}
(playpen)
Gives the error:
Compiling playground v0.0.1 (/playground)
warning: the feature `const_generics` is incomplete and may cause the compiler to crash
--> src/main.rs:1:12
|
1 | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
error[E0391]: cycle detected when const-evaluating + checking `takes_closure_of_array_3::{{constant}}#0`
--> src/main.rs:11:17
|
11 | F: Fn([i32; 3]),
| ^
|
note: ...which requires const-evaluating + checking `takes_closure_of_array_3::{{constant}}#0`...
--> src/main.rs:11:17
|
11 | F: Fn([i32; 3]),
| ^
......................
9 | / fn takes_closure_of_array_3<F>(f: F)
10 | | where
11 | | F: Fn([i32; 3]),
12 | | {
13 | | f([1, 2, 3]);
14 | | }
| |_^
This compiles fine with const_generics not enabled, and is a regression
Metadata
Metadata
Assignees
Labels
Area: const generics (parameters and arguments)Area: Lazy normalization (tracking issue: #60471)Call for participation: An issue has been fixed and does not reproduce, but no test has been added.`#![feature(const_generics)]`Relevant to the compiler team, which will review and decide on the PR/issue.