summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorjoboet <jonasboettiger@icloud.com>2025-07-26 14:29:00 +0200
committerMark Rousskov <mark.simulacrum@gmail.com>2025-08-01 17:36:10 -0400
commit7ab3ec175f4adcdc2a4a4316a6d8603cf2e0b670 (patch)
tree0d014066c7e18d8d08539afc9183502d09866207 /tests
parentf433cb4489f9a4007e8ab230a6856051e067e56b (diff)
downloadrust-7ab3ec175f4adcdc2a4a4316a6d8603cf2e0b670.tar.gz
rust-7ab3ec175f4adcdc2a4a4316a6d8603cf2e0b670.zip
thread name in stack overflow message
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/runtime/out-of-stack.rs12
1 files changed, 9 insertions, 3 deletions
diff --git a/tests/ui/runtime/out-of-stack.rs b/tests/ui/runtime/out-of-stack.rs
index 6be34afb560..913d3637c8f 100644
--- a/tests/ui/runtime/out-of-stack.rs
+++ b/tests/ui/runtime/out-of-stack.rs
@@ -19,7 +19,7 @@ extern crate libc;
 use std::env;
 use std::hint::black_box;
 use std::process::Command;
-use std::thread;
+use std::thread::Builder;
 
 fn silent_recurse() {
     let buf = [0u8; 1000];
@@ -56,9 +56,9 @@ fn main() {
     } else if args.len() > 1 && args[1] == "loud" {
         loud_recurse();
     } else if args.len() > 1 && args[1] == "silent-thread" {
-        thread::spawn(silent_recurse).join();
+        Builder::new().name("ferris".to_string()).spawn(silent_recurse).unwrap().join();
     } else if args.len() > 1 && args[1] == "loud-thread" {
-        thread::spawn(loud_recurse).join();
+        Builder::new().name("ferris".to_string()).spawn(loud_recurse).unwrap().join();
     } else {
         let mut modes = vec![
             "silent-thread",
@@ -82,6 +82,12 @@ fn main() {
             let error = String::from_utf8_lossy(&silent.stderr);
             assert!(error.contains("has overflowed its stack"),
                     "missing overflow message: {}", error);
+
+            if mode.contains("thread") {
+                assert!(error.contains("ferris"), "missing thread name: {}", error);
+            } else {
+                assert!(error.contains("main"), "missing thread name: {}", error);
+            }
         }
     }
 }