Description
Sub-bug of #5677
We want to support multiple overlaid stores of libraries and workspaces. Rustpkg should follow a similar strategy to Go here, wherein there's an environment variable -- say $RUST_PATH
-- that is a colon (or semi on windows) separated list of "directories in which to resolve pkgids", and the first existing entry in the search path is the directory in which new packages are fetched and installed by default. Target libs need to be put in an arch-specific subdir.
At the end of the $RUST_PATH
search (and therefore also the default if users don't define a $RUST_PATH
) we should also include some implicit search entries:
- Any existing dir named
.rust
in$CWD
and every parent of$CWD
up to the filesystem root - A dir named
.rust
in the user's homedir, if it exists
The rustc driver should also understand how to search these paths for libraries.
Note that while it is desirable for rustpkg to be "purely functional" and thereby automatically segregate separate builds of the same artifact by storing built artifacts under different version-prefixed or input-hash-prefixed directories, in practice there will always be cases of missing or uncaptured dependencies (environment-sensitivity is very hard to rule out) and providing "different builds in different locations under the user's control" is a necessary mechanism for working around these cases.