Skip to content

Instantly share code, notes, and snippets.

@joshthecoder
Created October 28, 2019 04:07
Show Gist options
  • Save joshthecoder/16e2f496dc45fca83f95f2d2d153e068 to your computer and use it in GitHub Desktop.
Save joshthecoder/16e2f496dc45fca83f95f2d2d153e068 to your computer and use it in GitHub Desktop.
<3 Rust Compile Errors
Compiling chat-rs v0.1.0 (/mnt/c/Users/jroes/Development/chat-rs)
error[E0373]: closure may outlive the current function, but it borrows `out`, which is owned by the current function --> src/main.rs:6:34
|
6 | listen("127.0.0.1:8888", |out| |msg| out.send(msg)).unwrap()
| ^^^^^ --- `out` is borrowed here
| |
| may outlive borrowed value `out`
|
note: closure is returned here
--> src/main.rs:6:34
|
6 | listen("127.0.0.1:8888", |out| |msg| out.send(msg)).unwrap()
| ^^^^^^^^^^^^^^^^^^^
help: to force the closure to take ownership of `out` (and any other referenced variables), use the `move` keyword |
6 | listen("127.0.0.1:8888", |out| move |msg| out.send(msg)).unwrap()
| ^^^^^^^^^^
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment