Skip to content

Commit

Permalink
Fixed Windows compile error for ExitCode equivalence function
Browse files Browse the repository at this point in the history
  • Loading branch information
zardini123 authored and shepmaster committed Apr 3, 2024
1 parent 953bd56 commit adf7c01
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions tests/report.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<u8>(), mem::size_of::<ExitCode>());
#[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::<ExitCodeSize>(), mem::size_of::<ExitCode>());
(mem::transmute(left), mem::transmute(right))
};

Expand Down

0 comments on commit adf7c01

Please sign in to comment.