On 02/14/2013 02:40 PM, [email protected] wrote:
I'm trying to write some code where a task does something and sends a struct through a Chan to the function that created the task, and it's giving me some serious issues with not letting me actually send it. The full error is:glfw.rs:135:8: 135:12 error: not a sendable value glfw.rs:135 chan.send(first_glfw); ^~~~glfw.rs:135:8: 135:30 error: instantiating a type parameter with an incompatible type (needs `owned`, got `copy durable`, missing `owned`)glfw.rs:135 chan.send(first_glfw); ^~~~~~~~~~~~~~~~~~~~~~From the code: http://pastebin.com/f3XFxBuQ (this is at line 80 of the pastebin code). I asked IRC about this as well, and someone suggested changing "let first_glfw = GLFW" to "let first_glfw = ~GLFW" but that didn't change the error. Any help getting this worked out would be seriously appreciated.
That's vexing. It's suspicious that the error is pointing to `chan` and not `first_glfw`, but maybe it just imprecise. GLFW<~T> looks owned to me, though I'll note that `impl<T: Owned> GLFW<T>: Owned` is incorrect (as is the impl of `Copy`) - `Owned` and `Copy` are not supposed to be implementable by user code. Taking those out could maybe disconfuse rustc. You may also try changing the `stream` call to mention the type and see if that stirs up any different errors, `stream::<GLFW<~T>>()`.
Is it possible that this code is using a bogus definition of the `Owned' trait and not the one from core? That could explain why everything looks owned but the compiler can't see it, and also why rustc isn't complaining about the impl of `Owned`. Which version of rustc are you using?
_______________________________________________ Rust-dev mailing list [email protected] https://mail.mozilla.org/listinfo/rust-dev
