shepmaster / snafu

Easily assign underlying errors into domain-specific errors while adding context
https://docs.rs/snafu/
Apache License 2.0
1.39k stars 60 forks source link

Fixed Windows compile errors #447

Closed zardini123 closed 5 months ago

zardini123 commented 5 months ago

Currently when compiling on Windows (toolchain stable-x86_64-pc-windows-msvc), there is two compile errors. Both compile errors are due to men::transmute calls in nasty_hack_exit_code_eq, which fail to compile due to transmuting a ExitCode of 32 bits into a 8 bit u8. The error is:

error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
   --> tests\report.rs:210:10
    |
210 |         (mem::transmute(left), mem::transmute(right))
    |          ^^^^^^^^^^^^^^
    |
    = note: source type: `ExitCode` (32 bits)
    = note: target type: `u8` (8 bits)

This PR solves this problem by changing the transmute type to a u32 on Windows using conditional compilation. The result is the project compiles and tests successfully on Windows.

netlify[bot] commented 5 months ago

Deploy Preview for shepmaster-snafu ready!

Name Link
Latest commit adf7c0117884c136fdbbcf85a368242724eaca3b
Latest deploy log https://app.netlify.com/sites/shepmaster-snafu/deploys/660d8e817f0be90008b73f78
Deploy Preview https://deploy-preview-447--shepmaster-snafu.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.