Skip to content

miri test is painful to use with CARGO_TARGET_DIR set #1311

@jonhoo

Description

@jonhoo

I have CARGO_TARGET_DIR set on my machine to shared the target directories of the many rust projects on my computer. This generally works very well, and reduces build times (often by a lot!) by re-using build artifacts across crates I'm working on. Unfortunately, miri test also shares that build directory, and when it re-compiles crates with a modified std, it causes non-miri builds to fail with errors like:

error[E0460]: found possibly newer version of crate `core` which `lazy_static` depends on

This is solved easily enough by remembering to always run miri test with:

$ env -u CARGO_TARGET_DIR cargo miri test

But, well, I often forget, and then have to wipe my whole shared target directory, which leads to very long compile times the next time I work on a large project.

I wonder if it might be possible to have miri use it's own "build profile". rls already does this (its artifacts ends up with target/rls), and if miri also did that (target/miri), all of these issues would simply go away! I don't know what mechanisms would be involved, but it would save me (and probably others) a lot of headache by eliminating the error above :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-cargoArea: affects the cargo wrapper (cargo miri)C-enhancementCategory: a PR with an enhancement or an issue tracking an accepted enhancement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions