add a test for the TLS memory leak

This commit is contained in:
Ralf Jung 2024-04-23 08:43:06 +02:00
parent f38dba69b1
commit ea9cff254f

View file

@ -0,0 +1,13 @@
//! Regression test for <https://github.com/rust-lang/rust/issues/123583>.
use std::thread;
pub(crate) fn with_thread_local() {
thread_local! { static X: Box<u8> = Box::new(0); }
X.with(|_x| {})
}
fn main() {
let j2 = thread::spawn(with_thread_local);
with_thread_local();
j2.join().unwrap();
}