What do Rust tools need from the build system?

Not sure if/how relevant, but I package rust and cargo for a source-based Linux distribution, Gentoo Linux. For us, things like being able to extract a set of dependencies, in the sense of URLs to actual packages, as well as an easy way to propagate build-time flags and features. Maybe also a way to (make it easier to) externally generate and then use a Cargo.lock file. Another thing is that it would be nice if Rust’s LLVM build was more tightly scoped, for example IIRC it now always builds all backends, even when a rustbuild config only specifies one backend.

One shortcoming in cargo that I really dislike based on how we use feature flags in Gentoo is that there is no way to disable some feature without disabling all features. It seems to me that the crate author should specify default features, and the default mode for people to use that should be to add or subtract features against that baseline of the default feature set. I think it would be a bad experience if, for example, I want to switch off features a and b but keep feature c. Now, the author would maybe like to make feature d optional-but-on-by-default (for compatibility reasons), but I will never get d because I had to disable all default features in order to disable a and b.

It would also be good to have better support for code coverage. In particular, I have not found a good way to generate coverage data for derive-based procedural macros (because these get dynamically loaded as part of the compiler, I guess).

3 Likes