From adf7c0117884c136fdbbcf85a368242724eaca3b Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 28 Mar 2024 16:38:12 -0400 Subject: [PATCH] Fixed Windows compile error for ExitCode equivalence function --- tests/report.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/report.rs b/tests/report.rs index 866c3b7..761a48c 100644 --- a/tests/report.rs +++ b/tests/report.rs @@ -200,8 +200,13 @@ fn termination_returns_failure_code() { fn nasty_hack_exit_code_eq(left: ExitCode, right: ExitCode) -> bool { use std::mem; - let (left, right): (u8, u8) = unsafe { - assert_eq!(mem::size_of::(), mem::size_of::()); + #[cfg(target_os = "windows")] + type ExitCodeSize = u32; + #[cfg(not(target_os = "windows"))] + type ExitCodeSize = u8; + + let (left, right): (ExitCodeSize, ExitCodeSize) = unsafe { + assert_eq!(mem::size_of::(), mem::size_of::()); (mem::transmute(left), mem::transmute(right)) };