Compare commits

...

2 Commits

Author SHA1 Message Date
Mahmoud Al-Qudsi 005530355c Corrected error output 2017-12-10 15:53:33 -06:00
Mahmoud Al-Qudsi 9ec63c8b6a Detailing rust-lang/rust#46644 2017-12-10 15:52:10 -06:00
3 changed files with 18 additions and 28 deletions

@ -1,4 +1,5 @@
CARGO = cargo
CARGO = cargo +$(TOOLCHAIN)
TOOLCHAIN = nightly
.PHONY: all bench build check clean doc install publish run test update

@ -1,24 +1,15 @@
Compiling futuretest v0.1.0 (file:///mnt/c/Users/Mahmoud/git/futuretest)
error[E0271]: type mismatch resolving `<futures::FutureResult<(), std::string::String> as futures::IntoFuture>::Error == &str`
--> src/main.rs:13:10
Compiling futuretest v0.1.0 (file:///mnt/d/GIT/futuretest)
error[E0271]: type mismatch resolving `<futures::FutureResult<std::result::Result<(), _>, ()> as futures::Future>::Item == ()`
--> src/main.rs:17:23
|
13 | .and_then(|_|
| ^^^^^^^^ expected struct `std::string::String`, found &str
17 | fn create_future() -> impl Future<Item=(), Error=()> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected enum `std::result::Result`, found ()
|
= note: expected type `std::string::String`
found type `&str`
= note: expected type `std::result::Result<(), _>`
found type `()`
= note: the return type of a function must have a statically known size
error[E0271]: type mismatch resolving `<futures::FutureResult<(), std::string::String> as futures::IntoFuture>::Error == &str`
--> src/main.rs:20:10
|
20 | core.run(f).unwrap();
| ^^^ expected struct `std::string::String`, found &str
|
= note: expected type `std::string::String`
found type `&str`
= note: required because of the requirements on the impl of `futures::Future` for `futures::AndThen<futures::Map<futures::MapErr<futures::FutureResult<(), ()>, [closure@src/main.rs:11:18: 11:43]>, [closure@src/main.rs:12:14: 12:67]>, futures::FutureResult<(), std::string::String>, [closure@src/main.rs:13:19: 16:14]>`
error: aborting due to 2 previous errors
error: aborting due to previous error
error: Could not compile `futuretest`.

@ -1,3 +1,5 @@
#![feature(conservative_impl_trait)]
extern crate futures;
extern crate tokio_core;
use futures::future::{self};
@ -7,15 +9,11 @@ use tokio_core::reactor::Core;
fn main() {
let mut core = Core::new().expect("Failed to initialize tokio_core reactor!");
let f = future::result(Ok(()))
.map_err(|()| "&'static str error")
.map(|_| future::result(Err("another &'static str error")))
.and_then(|_|
future::result(Ok(())
.map_err(|()| "String error".to_owned())
)
)
;
let f = create_future();
core.run(f).unwrap();
}
fn create_future() -> impl Future<Item=(), Error=()> {
return future::ok(Ok(()));
}