about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorJules Bertholet <julesbertholet@quoi.xyz>2025-10-01 11:32:54 -0400
committerJules Bertholet <julesbertholet@quoi.xyz>2025-10-01 12:28:18 -0400
commit94f00f4e4a0240bc7b8284c78482e37af252309a (patch)
treec7277d6d0326ec8591062a739c10c6d41f357920 /src
parent4d32b9a1783343d42a9864fe3d2115daa2cb425e (diff)
downloadrust-94f00f4e4a0240bc7b8284c78482e37af252309a.tar.gz
rust-94f00f4e4a0240bc7b8284c78482e37af252309a.zip
Fix memory leak in `os` impl
Diffstat (limited to 'src')
-rw-r--r--src/tools/miri/tests/pass/thread_local-panic.rs8
-rw-r--r--src/tools/miri/tests/pass/thread_local-panic.stderr5
2 files changed, 13 insertions, 0 deletions
diff --git a/src/tools/miri/tests/pass/thread_local-panic.rs b/src/tools/miri/tests/pass/thread_local-panic.rs
new file mode 100644
index 00000000000..549acd23987
--- /dev/null
+++ b/src/tools/miri/tests/pass/thread_local-panic.rs
@@ -0,0 +1,8 @@
+thread_local! {
+    static LOCAL: u64 = panic!();
+
+}
+
+fn main() {
+    let _ = std::panic::catch_unwind(|| LOCAL.with(|_| {}));
+}
diff --git a/src/tools/miri/tests/pass/thread_local-panic.stderr b/src/tools/miri/tests/pass/thread_local-panic.stderr
new file mode 100644
index 00000000000..e69340a8102
--- /dev/null
+++ b/src/tools/miri/tests/pass/thread_local-panic.stderr
@@ -0,0 +1,5 @@
+
+thread 'main' ($TID) panicked at tests/pass/thread_local-panic.rs:LL:CC:
+explicit panic
+note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
+note: in Miri, you may have to set `MIRIFLAGS=-Zmiri-env-forward=RUST_BACKTRACE` for the environment variable to have an effect