fix conditional compilation condition for os_str <-> bytes conversion
Turns out that condition was wrong and these functions never got compiled... Cc @christianpoveda
give some context in error messages
### Some examples for how different errors look now
Unsupported operation:
```
error: unsupported operation: Miri does not support threading
--> /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/libstd/sys/unix/thread.rs:68:19
|
68 | let ret = libc::pthread_create(&mut native, &attr, thread_start, &*p as *const _ as *mut _);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Miri does not support threading
|
= help: this is likely not a bug in the program; it indicates that the program performed an operation that the interpreter does not support
```
Unsupported operation that works without isolation:
```
error: unsupported operation: `clock_gettime` not available when isolation is enabled
--> /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/libstd/sys/unix/time.rs:349:22
|
349 | cvt(unsafe { libc::clock_gettime(clock, &mut t.t) }).unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `clock_gettime` not available when isolation is enabled
|
= help: pass the flag `-Zmiri-disable-isolation` to disable isolation
```
Program abort:
```
error: program stopped: the evaluated program aborted execution
--> /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/libstd/panicking.rs:530:18
|
530 | unsafe { intrinsics::abort() }
| ^^^^^^^^^^^^^^^^^^^ the evaluated program aborted execution
|
```
UB:
```
error: Undefined Behavior: type validation failed: encountered 2, but expected a boolean
--> tests/compile-fail/validity/invalid_bool.rs:2:23
|
2 | let _b = unsafe { std::mem::transmute::<u8, bool>(2) }; //~ ERROR encountered 2, but expected a boolean
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 2, but expected a boolean
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
```
Experimental UB:
```
error: Undefined Behavior: not granting access to tag <1562> because incompatible item is protected: [Unique for <1567> (call 1189)]
--> tests/compile-fail/stacked_borrows/aliasing_mut1.rs:3:1
|
3 | pub fn safe(_x: &mut i32, _y: &mut i32) {} //~ ERROR protect
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not granting access to tag <1562> because incompatible item is protected: [Unique for <1567> (call 1189)]
|
= help: this indicates a potential bug in the program: it performed an invalid operation, but the rules it violated are still experimental
```
Fixes https://github.com/rust-lang/miri/issues/417
implement Instant::now
For now, this is Linux-only.
Unlike `SystemTime`, we cannot convert `Instant` to something absolute via an epoch. But that's okay, that clock is relative anyway, so we just make up our own time anchor when interpretation starts.
Fixes https://github.com/rust-lang/miri/issues/1242
Abort instead of panic on asserting intrinsics
This fixes#1222
replacing the panic with an abort and a corresponding message.
the stack trace is already printed, this just adds an optional message the caller can pass, and I just pass the same message we passed to the panic but now to the abort instead.
r? @RalfJung
move repeated run of test suite (without and with MIR optimizations) out of compiletest
Just like we already pass the target architecture to our compiletest wrapper via `MIRI_TEST_TARGET` (and then have CI run compiletest with different values for that env var), we now do the same for running the tests with and without MIR optimizations.
This has the advantage of speeding up local `./miri test`, where in the vast majority of cases running tests both with and without optimizations is just a waste of time.