diff --git a/library/std/src/sys/unix/process/process_unix/tests.rs b/library/std/src/sys/unix/process/process_unix/tests.rs index 915402970f58c..5819d2c2a5a26 100644 --- a/library/std/src/sys/unix/process/process_unix/tests.rs +++ b/library/std/src/sys/unix/process/process_unix/tests.rs @@ -16,14 +16,15 @@ fn exitstatus_display_tests() { // https://github.com/rust-lang/rust/pull/82749#issuecomment-790525956 // The purpose of this test is to test our string formatting, not our understanding of the wait // status magic numbers. So restrict these to Linux. - #[cfg(target_os = "linux")] - t(0x0137f, "stopped (not terminated) by signal: 19"); - #[cfg(target_os = "linux")] - t(0x0ffff, "continued (WIFCONTINUED)"); + if cfg!(target_os = "linux") { + t(0x0137f, "stopped (not terminated) by signal: 19"); + t(0x0ffff, "continued (WIFCONTINUED)"); + } // Testing "unrecognised wait status" is hard because the wait.h macros typically // assume that the value came from wait and isn't mad. With the glibc I have here // this works: - #[cfg(all(target_os = "linux", target_env = "gnu"))] - t(0x000ff, "unrecognised wait status: 255 0xff"); + if cfg!(all(target_os = "linux", target_env = "gnu")) { + t(0x000ff, "unrecognised wait status: 255 0xff"); + } }