error[E0521]: borrowed data escapes outside of function --> $DIR/resume-arg-outlives-2.rs:20:5 | LL | fn demo<'not_static>(s: &'not_static str) -> thread::JoinHandle<()> { | ----------- - `s` is a reference that is only valid in the function body | | | lifetime `'not_static` defined here ... LL | generator.as_mut().resume(s); // <- generator hoards it as `let ctx`. | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | `s` escapes the function body here | argument requires that `'not_static` must outlive `'static` error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0521`.