about summary refs log tree commit diff
path: root/compiler/rustc_thread_pool/tests/stack_overflow_crash.rs
diff options
context:
space:
mode:
authorCelina G. Val <celinval@amazon.com>2025-06-11 11:12:32 -0700
committerCelina G. Val <celinval@amazon.com>2025-06-11 11:12:32 -0700
commit0b9b1df0064396708a5e5ca27fd010ae3ad3a305 (patch)
treec854a9e2fd775dba7f0a5e70a2c7be121b5fec0b /compiler/rustc_thread_pool/tests/stack_overflow_crash.rs
parent35c5144394c1b93784867d330f694fa7c8f480e3 (diff)
downloadrust-0b9b1df0064396708a5e5ca27fd010ae3ad3a305.tar.gz
rust-0b9b1df0064396708a5e5ca27fd010ae3ad3a305.zip
Fix format and tidy for code moved from rayon
Diffstat (limited to 'compiler/rustc_thread_pool/tests/stack_overflow_crash.rs')
-rw-r--r--compiler/rustc_thread_pool/tests/stack_overflow_crash.rs25
1 files changed, 6 insertions, 19 deletions
diff --git a/compiler/rustc_thread_pool/tests/stack_overflow_crash.rs b/compiler/rustc_thread_pool/tests/stack_overflow_crash.rs
index a6494069212..c7a880de8bb 100644
--- a/compiler/rustc_thread_pool/tests/stack_overflow_crash.rs
+++ b/compiler/rustc_thread_pool/tests/stack_overflow_crash.rs
@@ -1,10 +1,9 @@
-use rayon_core::ThreadPoolBuilder;
-
 use std::env;
-use std::process::{Command, ExitStatus, Stdio};
-
 #[cfg(target_os = "linux")]
 use std::os::unix::process::ExitStatusExt;
+use std::process::{Command, ExitStatus, Stdio};
+
+use rayon_core::ThreadPoolBuilder;
 
 fn force_stack_overflow(depth: u32) {
     let mut buffer = [0u8; 1024 * 1024];
@@ -18,13 +17,7 @@ fn force_stack_overflow(depth: u32) {
 #[cfg(unix)]
 fn disable_core() {
     unsafe {
-        libc::setrlimit(
-            libc::RLIMIT_CORE,
-            &libc::rlimit {
-                rlim_cur: 0,
-                rlim_max: 0,
-            },
-        );
+        libc::setrlimit(libc::RLIMIT_CORE, &libc::rlimit { rlim_cur: 0, rlim_max: 0 });
     }
 }
 
@@ -50,10 +43,7 @@ fn stack_overflow_crash() {
     #[cfg(any(unix, windows))]
     assert_eq!(status.code(), overflow_code());
     #[cfg(target_os = "linux")]
-    assert!(matches!(
-        status.signal(),
-        Some(libc::SIGABRT | libc::SIGSEGV)
-    ));
+    assert!(matches!(status.signal(), Some(libc::SIGABRT | libc::SIGSEGV)));
 
     // Now run with a larger stack and verify correct operation.
     let status = run_ignored("run_with_large_stack");
@@ -86,10 +76,7 @@ fn run_with_large_stack() {
 }
 
 fn run_with_stack(stack_size_in_mb: usize) {
-    let pool = ThreadPoolBuilder::new()
-        .stack_size(stack_size_in_mb * 1024 * 1024)
-        .build()
-        .unwrap();
+    let pool = ThreadPoolBuilder::new().stack_size(stack_size_in_mb * 1024 * 1024).build().unwrap();
     pool.install(|| {
         #[cfg(unix)]
         disable_core();