rust-lang / miri

An interpreter for Rust's mid-level intermediate representation
Apache License 2.0
4.13k stars 318 forks source link

mention MIRIFLAGS in unsupported operation error and --help #3677

Closed lolbinarycat closed 1 week ago

lolbinarycat commented 1 week ago

I'm using proptest, which accesses the current directory, unsupported with miri isolation enabled.

test tests::always_has_matches ... error: unsupported operation: `getcwd` not available when isolation is enabled
   --> /home/binarycat/.rustup/toolchains/nightly-2024-05-30-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/pal/unix/os.rs:152:17
    |
152 |             if !libc::getcwd(ptr, buf.capacity()).is_null() {
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `getcwd` not available when isolation is enabled
    |
    = help: pass the flag `-Zmiri-disable-isolation` to disable isolation;

I tried cargo miri test -Zmiri-disable-isolation, cargo miri test -- -Zmiri-disable-isolation, cargo miri -Zmiri-disable-isolation test, and RUSTFLAGS="-Zmiri-disable-isolation" cargo miri test, all to no avail.

I then checked the helptext of cargo miri and of the generated test runner, but found nothing. only after looking through the README of this repo did i find out about the existance of MIRIFLAGS.

RalfJung commented 1 week ago

Thanks for the report! That's a good point, we should be more explicit here.

We also may want to make cargo miri test -Zmiri-disable-isolation just work, that's tracked in https://github.com/rust-lang/miri/issues/2051.