Repository: PistonDevelopers/glfw-rs (language: rust)

Issue:
Fails to compile on current nightly
Looks like a minor trait issue, but I can't quite figure it out:

> glfw-rs-66a8b4b1793a8461/master/src/lib.rs:1101:1: 1101:68 error: the trait `core::marker::Send` is not implemented for the type `Message` [E0277]
> glfw-rs-66a8b4b1793a8461/master/src/lib.rs:1101 pub struct FlushedMessages<'a, Message: 'a>(&'a Receiver<Message>);
> 
> glfw-rs-66a8b4b1793a8461/master/src/lib.rs:1101:1: 1101:68 note: `Message` cannot be sent between threads safely
> glfw-rs-66a8b4b1793a8461/master/src/lib.rs:1101 pub struct FlushedMessages<'a, Message: 'a>(&'a Receiver<Message>);



Discussion / hints:

Fix patch:
diff --git a/src/lib.rs b/src/lib.rs
index b3162040..d5d1bf54 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1098,7 +1098,10 @@ pub fn flush_messages<'a, Message: Send>(receiver: &'a Receiver<Message>) -> Flu
 
 /// An iterator that yeilds until no more messages are contained in the
 /// `Receiver`'s queue.
-pub struct FlushedMessages<'a, Message: 'a>(&'a Receiver<Message>);
+pub struct FlushedMessages<'a, Message: 'a + Send>(&'a Receiver<Message>);
+
+unsafe impl<'a, Message: 'a + Send> Send for FlushedMessages<'a, Message> {
+}
 
 impl<'a, Message: 'static + Send> Iterator for FlushedMessages<'a, Message> {
     type Item = Message;


Test patch: