-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
Description
fn bar() {
for i in range(0, 10u) {
println!("{}", i)
}
}
fn callit(f: ||) { f() }
fn main() {
// callit(bar);
let f = bar;
callit(f)
}
prints
<anon>:12:12: 12:13 error: cannot coerce non-statically resolved bare fn
<anon>:12 callit(f)
^
We can do better here, e.g. by suggesting to the user that they make the closure construction explicit via eta-expansion, i.e. writing callit(||f())
(or callit(|x|g(x))
, etc).
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.