-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-const-genericsArea: const generics (parameters and arguments)Area: const generics (parameters and arguments)A-lazy-normalizationArea: Lazy normalization (tracking issue: #60471)Area: Lazy normalization (tracking issue: #60471)E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.F-const_generics`#![feature(const_generics)]``#![feature(const_generics)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
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
A-const-genericsArea: const generics (parameters and arguments)Area: const generics (parameters and arguments)A-lazy-normalizationArea: Lazy normalization (tracking issue: #60471)Area: Lazy normalization (tracking issue: #60471)E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.F-const_generics`#![feature(const_generics)]``#![feature(const_generics)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Activity
Manishearth commentedon Dec 31, 2019
(discovered by @jcoglan)
Centril commentedon Dec 31, 2019
cc @nikomatsakis @eddyb @varkor
Simplified:
jonas-schievink commentedon Dec 31, 2019
Isn't this expected fallout?
varkor commentedon Dec 31, 2019
This is an expected consequence of #66883.
16 remaining items