Browse Source

Include multiple cases generating correct return code

rust-46606
Mahmoud Al-Qudsi 1 year ago
parent
commit
46c5d902ee
2 changed files with 6 additions and 5 deletions
  1. 5
    5
      cargo.out
  2. 1
    0
      src/main.rs

+ 5
- 5
cargo.out View File

@@ -1,22 +1,22 @@
1 1
    Compiling futuretest v0.1.0 (file:///mnt/c/Users/Mahmoud/git/futuretest)
2 2
 error[E0271]: type mismatch resolving `<futures::FutureResult<(), std::string::String> as futures::IntoFuture>::Error == &str`
3
-  --> src/main.rs:12:10
3
+  --> src/main.rs:13:10
4 4
    |
5
-12 |         .and_then(|_|
5
+13 |         .and_then(|_|
6 6
    |          ^^^^^^^^ expected struct `std::string::String`, found &str
7 7
    |
8 8
    = note: expected type `std::string::String`
9 9
               found type `&str`
10 10
 
11 11
 error[E0271]: type mismatch resolving `<futures::FutureResult<(), std::string::String> as futures::IntoFuture>::Error == &str`
12
-  --> src/main.rs:19:10
12
+  --> src/main.rs:20:10
13 13
    |
14
-19 |     core.run(f).unwrap();
14
+20 |     core.run(f).unwrap();
15 15
    |          ^^^ expected struct `std::string::String`, found &str
16 16
    |
17 17
    = note: expected type `std::string::String`
18 18
               found type `&str`
19
-   = 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]>`
19
+   = 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]>`
20 20
 
21 21
 error: aborting due to 2 previous errors
22 22
 

+ 1
- 0
src/main.rs View File

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

Loading…
Cancel
Save