Closed
Description
First reported at rust-lang/futures-rs#97
xx.rs:
use futures::*;
pub fn yy() -> BoxFuture<u32, ::std::io::Error> {
done(Ok(1)).boxed()
}
main.rs:
extern crate futures;
mod xx;
use futures::Future;
fn main() {
let f = xx::yy();
println!("wait: {:?}", f.wait());
}
This code works.
If use futures::Future
is commented out in main.rs
, compiler complains:
src/main.rs:10:30: 10:34 error: the trait bound `futures::Future<Error=std::io::Error, Item=u32> + Send: std::marker::Sized` is not satisfied [E0277]
src/main.rs:10 println!("wait: {:?}", f.wait());
^~~~
<std macros>:2:27: 2:58 note: in this expansion of format_args!
<std macros>:3:1: 3:54 note: in this expansion of print! (defined in <std macros>)
src/main.rs:10:5: 10:38 note: in this expansion of println! (defined in <std macros>)
src/main.rs:10:30: 10:34 help: run `rustc --explain E0277` to see a detailed explanation
src/main.rs:10:30: 10:34 note: `futures::Future<Error=std::io::Error, Item=u32> + Send` does not have a constant size known at compile-time
error: aborting due to previous error
error: Could not compile `futures-rs-td`.
I'm not sure if is it a bug, or just a usability problem, is it in futures-rs or in rust language, but it is hard to understand error message.
rustc 1.11.0 (9b21dcd 2016-08-15), futures-rs from master
cc @stepancheg
cc @jonathandturner
cc @nikomatsakis