Last active
May 3, 2021 19:45
-
-
Save glommer/3f1f706660352c0042f0947631b66fec to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn scoped_task_unsound() { | |
let le = LocalExecutor::default(); | |
le.run(async { | |
{ | |
let msg = &mut "hello"; | |
let scoped = ScopedTask::local(async { | |
eprintln!("write to invalid address"); | |
*msg = "oh no"; | |
}); | |
std::mem::forget(scoped); // drop() doesn't run, so the task survives. | |
} | |
eprintln!("\noff stack"); | |
}); | |
eprintln!("segfault before this"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment