-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Closed
Labels
A-closuresArea: Closures (`|…| { … }`)Area: Closures (`|…| { … }`)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.
Description
It may be that overloaded calls aren't meant to be abused this way; even if that's the case I think the error message (at least the second one) could be improved:
#![feature(unboxed_closures)]
use std::ops::Fn;
struct Foo;
impl Fn<(isize, isize), ()> for Foo {
extern "rust-call" fn call(&self, args: (isize, isize)) {
println!("{:?}", args);
}
}
impl Fn<(isize, isize, isize), ()> for Foo {
extern "rust-call" fn call(&self, args: (isize, isize, isize)) {
println!("{:?}", args);
}
}
fn main() {
let foo = Foo;
foo(1, 1);
}
<anon>:22:5: 22:14 error: the type of this value must be known in this context
<anon>:22 foo(1, 1);
^~~~~~~~~
<anon>:22:5: 22:14 error: cannot use call notation; the first type parameter for the function trait is neither a tuple nor unit [E0059]
<anon>:22 foo(1, 1);
^~~~~~~~~
edit: updated source for rust changes on 2014-12-03
edit: another update 2015-01-20
timmclean, nooberfsh, mtak-, Dushistov and schneiderfelipe
Metadata
Metadata
Assignees
Labels
A-closuresArea: Closures (`|…| { … }`)Area: Closures (`|…| { … }`)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.