From 0b9b1df0064396708a5e5ca27fd010ae3ad3a305 Mon Sep 17 00:00:00 2001 From: "Celina G. Val" Date: Wed, 11 Jun 2025 11:12:32 -0700 Subject: Fix format and tidy for code moved from rayon --- .../tests/stack_overflow_crash.rs | 25 ++++++---------------- 1 file changed, 6 insertions(+), 19 deletions(-) (limited to 'compiler/rustc_thread_pool/tests/stack_overflow_crash.rs') 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(); -- cgit 1.4.1-3-g733a5