rust-lang / miri

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

per-toolchain cache of std #2733

Open matthiaskrgr opened 1 year ago

matthiaskrgr commented 1 year ago

would be nice if miri was able to have separate caches for its std build for cargo +master miri... and cargo +nightly miri... for example, to avoid frequent rebuilds when experimenting with different toolchains at the same time.

RalfJung commented 1 year ago

That should be fairly easy, the main problem being that we'd never clean up when a toolchain gets uninstalled.

The folder logic is here:

https://github.com/rust-lang/miri/blob/e9e11de5c1c8eb384cfc72ddb6a25b896baea3c6/cargo-miri/src/setup.rs#L65-L66

AFAIK rustup sets an env var with the active toolchain, that we could simply take into account here.

oli-obk commented 1 year ago

the main problem being that we'd never clean up when a toolchain gets uninstalled.

Could we pick a miri folder inside the toolchain? Won't work for distro based miri, but once that's a thing we'll figure sth out.

bjorn3 commented 1 year ago

Or maybe ship the miri sysroot as part of the miri component?

oli-obk commented 1 year ago

Or maybe ship the miri sysroot as part of the miri component?

That's not possible as we'd have to ship a miri sysroot per target

RalfJung commented 1 year ago

Not sure if messing with rustup's toolchain folder is a good idea. Also that won't work on nix (where the toolchain folder is read-only).