rust/tests/ui/coroutine/resume-arg-outlives-2.stderr

22 lines
821 B
Plaintext

error[E0521]: borrowed data escapes outside of function
--> $DIR/resume-arg-outlives-2.rs:21: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 | / thread::spawn(move || {
LL | |
LL | | thread::sleep(time::Duration::from_millis(200));
LL | | generator.as_mut().resume(""); // <- resumes from the last `yield`, running `dbg!(ctx)`.
LL | | })
| | ^
| | |
| |______`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`.