Description
After installing the rustc-src
component, trying to run cargo metadata
on them will fail if the sources are installed in a read-only location (such as on Nix, or when cargo metadata
is run in a sandbox). This could be avoided by either fixing cargo (rust-lang/cargo#10096), or by adjusting the rustc-src component to work around this behavior of cargo, by shipping an up-to-date lockfile.
Part of the problem seems to be that the cargo crates are not in a workspace any more when they are inside rustc-src. However, sadly, even if one puts a Cargo.toml
(with all references to library/
and src/tools/
removed) into the right place, Cargo is still not happy with the lockfile -- it insists on removing everything unnecessary from this lockfile. So producing a lockfile that cargo is happy with could be rather tricky.