These are chat archives for rust-lang/rust

5th
Jun 2017
Edouard Menayde
@edouardmenayde
Jun 05 2017 20:15

Hi there,
I'm pretty new with rust and got this code : https://gist.github.com/Scrunshes/d6bfa202f2cab898450e11286c15b7fd
I get this error :

error[E0477]: the type `[closure@src/main.rs:104:30: 114:4 application:&'a Application]` does not fulfill the required lifetime
   --> src/main.rs:104:9
    |
104 |   scale.connect_change_value(move |scale, _, value| {
    |         ^^^^^^^^^^^^^^^^^^^^
    |
    = note: type must outlive the static lifetime

error: aborting due to previous error

error: Could not compile `keyboard-controller`.

My understanding is that the compiler thinks the referene will die before the closure ends and thus big problem will arise. But the fact is that gtk::main() calls an endless loop and closure where application is passed are gonna die before gtk::main does.