blob: 996d7ed4a2360ccb58f9cad3e3eb2eca3fba814d [file] [log] [blame]
//@error-in-other-file: memory leaked
//@normalize-stderr-test: ".*│.*" -> "$$stripped$$"
use std::cell::Cell;
pub fn main() {
thread_local! {
static TLS: Cell<Option<&'static i32>> = Cell::new(None);
}
std::thread::spawn(|| {
TLS.with(|cell| {
cell.set(Some(Box::leak(Box::new(123))));
});
})
.join()
.unwrap();
// Imagine the program running for a long time while the thread is gone
// and this memory still sits around, unused -- leaked.
}