CodeSandwich / Mocktopus

Mocking framework for Rust
MIT License
233 stars 20 forks source link

cargo test --release SIGILL with newest toolchain. #49

Closed artemii235 closed 5 years ago

artemii235 commented 5 years ago

Toolchain info

nightly-x86_64-unknown-linux-gnu (default)
rustc 1.40.0-nightly (421bd77f4 2019-10-06)

How to reproduce a bug

Run cargo test --release.

Expected result

all tests pass

Actual result:

running 67 tests
test injecting_fn_with_arg_requiring_drop::when_not_mocked_then_runs_normally ... ok
test injecting_fn_with_arg_requiring_drop::when_mocked_then_returns_mock ... ok
test injecting_fn_with_generic_return_type::when_return_type_has_destructor::and_mocked_then_returns_mock ... ok
test injecting_fn_with_generic_return_type::when_return_type_has_destructor::and_not_mocked_then_runs_normally ... error: process didn't exit successfully: `/home/artem/dev/mock/Mocktopus/target/release/deps/injecting-6b1dde59d7e99d97` (signal: 4, SIGILL: illegal instruction)

The SIGILL here is caused by mem::zeroed usage which is UB when used with references:

let _x: &i32 = unsafe { mem::zeroed() }; // Undefined behavior!