Closed
Description
This compiles
fn func(){}
fn main(){
run(func);
run(func);
}
fn run<T>(f: T)
where T: Fn() + Copy{
f();
}
but this does not (playground)
fn func(){}
fn main(){
run(func);
run(func);
}
fn run<T>(f: T)
where T: Fn() + Clone{
f();
}
The only difference is the bounds on T. The Copy trait requires that the Clone trait is also implemented, so I believe both of these should compile.
Metadata
Metadata
Assignees
Labels
Area: Type systemCategory: This is a bug.Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Low priorityRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the language team, which will review and decide on the PR/issue.