Include multiple cases generating correct return code

futures-rs-676
Mahmoud Al-Qudsi 2017-12-09 13:13:51 -06:00
parent 1020a23c0e
commit 46c5d902ee
2 changed files with 6 additions and 5 deletions

@ -1,22 +1,22 @@
Compiling futuretest v0.1.0 (file:///mnt/c/Users/Mahmoud/git/futuretest) 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` error[E0271]: type mismatch resolving `<futures::FutureResult<(), std::string::String> as futures::IntoFuture>::Error == &str`
--> src/main.rs:12:10 --> src/main.rs:13:10
| |
12 | .and_then(|_| 13 | .and_then(|_|
| ^^^^^^^^ expected struct `std::string::String`, found &str | ^^^^^^^^ expected struct `std::string::String`, found &str
| |
= note: expected type `std::string::String` = note: expected type `std::string::String`
found type `&str` found type `&str`
error[E0271]: type mismatch resolving `<futures::FutureResult<(), std::string::String> as futures::IntoFuture>::Error == &str` error[E0271]: type mismatch resolving `<futures::FutureResult<(), std::string::String> as futures::IntoFuture>::Error == &str`
--> src/main.rs:19:10 --> src/main.rs:20:10
| |
19 | core.run(f).unwrap(); 20 | core.run(f).unwrap();
| ^^^ expected struct `std::string::String`, found &str | ^^^ expected struct `std::string::String`, found &str
| |
= note: expected type `std::string::String` = note: expected type `std::string::String`
found type `&str` found type `&str`
= note: required because of the requirements on the impl of `futures::Future` for `futures::AndThen<futures::MapErr<futures::FutureResult<(), ()>, [closure@src/main.rs:11:18: 11:43]>, futures::FutureResult<(), std::string::String>, [closure@src/main.rs:12:19: 15:14]>` = 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 2 previous errors

@ -9,6 +9,7 @@ fn main() {
let f = future::result(Ok(())) let f = future::result(Ok(()))
.map_err(|()| "&'static str error") .map_err(|()| "&'static str error")
.map(|_| future::result(Err("another &'static str error")))
.and_then(|_| .and_then(|_|
future::result(Ok(()) future::result(Ok(())
.map_err(|()| "String error".to_owned()) .map_err(|()| "String error".to_owned())