[SOLVED] Unsized issues and Futures


#1

I’m currently getting a unsized error on this line:
https://github.com/bluejekyll/trust-dns/blob/bfry/futures/src/udp/udp_client_stream.rs#L40

this message:

src/udp/udp_client_stream.rs:40:12: 40:16 error: the trait bound futures::Future<Error=std::io::Error, Item=tokio_core::UdpSocket> + Send + 'static: std::marker::Sized is not satisfied [E0277]
src/udp/udp_client_stream.rs:40 socket.join(outbound_messages).and_then(move |(socket, rx)| {
src/udp/udp_client_stream.rs:40:12: 40:16 help: run rustc --explain E0277 to see a detailed explanation
src/udp/udp_client_stream.rs:40:12: 40:16 note: futures::Future<Error=std::io::Error, Item=tokio_core::UdpSocket> + Send + 'static does not have a constant size known at compile-time

I can’t for the life of me see the exact issue, Vec is sized, right? I tried switching to Box<[u8]>, but that didn’t resolve the issue.

@alexcrichton moved the convo here for broader audience.


#2

Ah yeah this is unfortunate I believe is a bug in the compiler, but the core issue is that you’ll need to import either the Future or Stream trait.


#3

Ah, ok. I’m importing Stream here:

https://github.com/bluejekyll/trust-dns/blob/bfry/futures/src/udp/udp_client_stream.rs#L7

but not Future. I will try that.


#4

ok, including Future explicitly resolved that issue. Now I have some others, but get to move on from that confusion. thanks.