Closed
Description
Given the following code:
#![feature(unboxed_closures)]
#![feature(overloaded_calls)]
fn action<T: Send, F: FnOnce<(T,), ()> + Send>(v: T, f: F) {
f(v);
}
pub fn main() {
let (tx, rx) = channel();
action("zomg", move |:v| tx.send(v));
rx.recv();
}
I get the error message:
fnonce.rs:11:5: 11:11 error: unable to infer enough type information to locate the impl of the trait `core::kinds::Send` for the type `closure`; type annotations required
fnonce.rs:11 action("zomg", move |:v| tx.send(v));
^~~~~~
fnonce.rs:11:5: 11:11 note: the trait `core::kinds::Send` must be implemented because it is required by `action`
fnonce.rs:11 action("zomg", move |:v| tx.send(v));
^~~~~~
This error message was quite confusing and the actual error was caused by the type inferencer not being able to figure out the type of channel(). If I change that bit to: channel::<&'static str>()
, everything compiles fine.
Metadata
Metadata
Assignees
Labels
No labels