QuickRust works with Rust 1.100. Its compiler driver builds against rustc 1.100, and early
cut-off cuts off there again: rustc 1.100 computes a crate’s hash from all the metadata it
writes and every function body, so the driver has it take the interface hash instead, and
QuickRust reads that hash where 1.100’s metadata keeps it.
Run reports, the up-to-date check and qrust inventory read the layout Cargo 1.100 gives every
build directory, one directory per unit: a build script’s run and what it printed are found
there, and a binary is named by its unit’s hash, as with older Cargo.
A build whose local build script’s inputs cannot be found is never taken as up to date, nor is
an earlier build of the same command: the next build asks Cargo.
Older toolchains work as before.
Collections leave what is in use
A collection of QuickRust’s cache never removes a build directory a running process uses,
whatever its age: one a process runs a program from (a test harness’s binary, a server built
there), or one whose workspace’s checkout a process works in, from the top of the git working
tree up through every superproject it is a submodule of. A shell, an editor or an agent’s
session open in a checkout keeps that checkout’s builds.
QuickRust reads each process’s program and working directory: /proc on Linux, libproc on
macOS, the process list and each process’s parameters on Windows. It compares them with a build
directory by their real paths, so a symbolic link, a junction, a short (8.3) name or a subst
drive holds it all the same. A collection that cannot list the processes removes nothing and
fails.
When the cache is over its bounds, each build directory, artifact entry and program source is
weighed by its size times the time since it was last used, and the heaviest goes first: a large
directory unused for an hour goes before a small one unused for two, so the goal is met with the
fewest removals. Things of one size still go oldest first.
When a collection removes a workspace’s build directory, the workspace’s next command (a build,
any Cargo command, qrust path) says so once, in a NOTE with what went, when, why and how
much, instead of the workspace finding its programs gone.
A collection that ends short of its goal says what it kept and why: qrust gc prints a kept
line for each, naming the process that holds a build directory; qrust gc --format json and
gc-log.jsonl record them under left. qrust cache status says how many were in use when the
last collection fell short.
An artifact entry a collection cannot remove stops the collection with its error.
A build directory whose workspace is still there and that a command used within the last 8 hours
is the work in hand: a collection no longer removes it to bring the cache under
cache.max-size, so several workspaces building on one machine keep their build directories
between builds instead of each starting cold. It goes only when the disk is below
cache.min-free or qrust gc --to asks for the room, after everything else. qrust gc names
each such directory it kept, and a cache the work in hand keeps above its size is collected for
the size again only once it has grown by a tenth more or that work has left the window.
cache.working-window sets the window (24h, 90m; off for none).
A command that cannot lock its build directory against collections stops with an error naming
the lock, rather than build in a directory a collection could remove.
Builds that leave nothing behind
QRUST_CACHE_GC=off, or gc = "off" under [cache] in ~/.qrust/config.toml, keeps a
command from starting a collection in the background, so it leaves no process running behind
it: useful to a test harness that checks its tests left none. A collection that was due stays
due, and the next command that allows one starts it. A disk nearly full is still collected
before a command, inside it.
With QRUST_TOOLCHAIN_AUTO_UPDATE=off and QRUST_SELF_UPDATE_CHECK=off as well, a build
leaves no process running behind it.
The compiler driver is built by the build that needs it
A build that compiles with early cut-off and finds QuickRust’s compiler driver missing for its
toolchain builds it first, says so (OK Compiler driver for Rust 1.100.0 ready), and compiles
with it, so its own work is cached as later builds look for it. It takes seconds once the
toolchain has its rustc-dev component. No driver build is started in the background any more,
after a build or by the daily toolchain update, so a build that ends leaves none running.
A driver that cannot be built is said in that build’s output, in a WARN naming the Rust
release, the toolchain and the error (the first compiler error and how many more), with where
the whole report is kept (~/.qrust/cache/drivers/could-not-build/). Builds no longer go on
without it in silence.
A driver that could not be built is not tried again for the same compiler, toolchain and
QuickRust version, even after the QuickRust home moves (a cache carried between machines): each
later build says in a NOTE that it has no early cut-off. Another Rust release or another
QuickRust tries again, and so does qrust driver build; qrust driver status says why it could
not be built.
Ending a collection part way
A collection ended at any point, by a signal, by closing its terminal or by ending its process
tree, leaves the cache sound. A compiler driver it removes is renamed away first, as build
directories already were, so none is left half deleted; what was left in the cache’s tmp/
goes at a later collection.
Cargo’s clean of its downloads deletes them file by file, and Cargo takes a source whose marker
survived for whole. That clean now holds QuickRust’s lock until it ends, even when the
collection that started it ended first, and only that clean holds it, so commands that would
run Cargo wait for it and nothing else. A clean that did not end whole is finished before
anything runs Cargo, by removing every download it may have begun on; Cargo fetches again what a
build needs.
cargo fmt runs again
cargo fmt, qrust fmt and qrust upstream fmt format the project again. They stopped with
“refusing to run Cargo: the toolchain’s cargo is QuickRust itself” when rustfmt’s cargo-fmt
asked Cargo for the workspace’s metadata. Any subcommand that calls cargo back while Cargo runs
it in QuickRust’s place was refused the same way, such as one cargo help <subcommand> runs, or
one run under qrust upstream that calls cargo by name; they run now too.
A linked toolchain whose cargo is a copy of QuickRust is refused for queries such as
cargo metadata and under qrust upstream as it is for builds, and on Windows as on Linux and
macOS, instead of QuickRust starting itself again without end.
Windows
A build directory a collection removes no longer leaves its lock file behind.