Advertisement
Guest User

Untitled

a guest
Jan 13th, 2018
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Rust 1.95 KB | None | 0 0
  1. C:/Users/user/.cargo/bin/cargo.exe run --package mvc --bin mvc
  2.    Compiling mvc v0.1.0 (file:///C:/Users/user/Documents/rust/mvc)
  3. error[E0495]: cannot infer an appropriate lifetime for capture of `self` by closure due to conflicting requirements
  4.   --> src\presenter.rs:12:24
  5.    |
  6. 12 |           let callback = ||{
  7.    |  ________________________^
  8. 13 | |                     self.login(&String::from("123"), &String::from("123"));
  9. 14 | |                     };
  10.    | |_____________________^
  11.    |
  12. note: first, the lifetime cannot outlive the anonymous lifetime #1 defined on the method body at 9:5...
  13.   --> src\presenter.rs:9:5
  14.    |
  15. 9  | /     pub fn register(&mut self, view: Box<ViewT>, service: Box<LoginService>) {
  16. 10 | |         self._view = Some(view);
  17. 11 | |         self._service = Some(service);
  18. 12 | |         let callback = ||{
  19. ...  |
  20. 21 | |         }
  21. 22 | |     }
  22.    | |_____^
  23. note: ...so that the reference type `&&mut presenter::LoginPresenter<ViewT>` does not outlive the data it points at
  24.   --> src\presenter.rs:18:17
  25.    |
  26. 18 |                 v.set_login_callback(callback);
  27.    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  28.    = note: but, the lifetime must be valid for the static lifetime...
  29. note: ...so that the type `[closure@src\presenter.rs:12:24: 14:22 self:&&mut presenter::LoginPresenter<ViewT>]` will meet its required lifetime bounds
  30.   --> src\presenter.rs:18:19
  31.    |
  32. 18 |                 v.set_login_callback(callback);
  33.    |                   ^^^^^^^^^^^^^^^^^^
  34.  
  35. error[E0477]: the type `[closure@src\presenter.rs:12:24: 14:22 self:&&mut presenter::LoginPresenter<ViewT>]` does not fulfill the required lifetime
  36.   --> src\presenter.rs:18:19
  37.    |
  38. 18 |                 v.set_login_callback(callback);
  39.    |                   ^^^^^^^^^^^^^^^^^^
  40.    |
  41.    = note: type must satisfy the static lifetime
  42.  
  43. error: aborting due to 2 previous errors
  44.  
  45. error: Could not compile `mvc`.
  46.  
  47. To learn more, run the command again with --verbose.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement