-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Description
Some projects (my context is Firefox, but I can imagine others) may want to manage multiple in-tree Rust libraries (one Rust staticlib per shared library the project generates, some libraries for inclusion in shared libaries and some for inclusion in binaries, etc. etc.). You can do this today with multiple Cargo.toml
files and tying them together with workspaces.
There are some things about this which are not ideal. Consider:
- Dependencies have to be re-specified in every sub-
Cargo.toml
. I think if you're going to trouble yourself to use workspaces, it's reasonable that you can list all the dependencies that you need in the rootCargo.toml
file and go from there. This issue is particularly acute for codebases (such as Firefox) where all the Rust code must live in-tree, aspath
specifications are needed for every dependency in every sub-library. It would be much simpler to specify everything once in the rootCargo.toml
. I can certainly imagine issues where a particular sub-library might want to use a different version, though... - Likewise, profile settings have to be re-specified for every library.
It would be super-helpful if settings such as the above (and probably others that I'm not thinking of because they haven't come up in my context) could somehow be shared between library-generating crates.
What would solve the problems above for me would be permitting multiple [lib]
sections in a Cargo.toml
; I wouldn't need to use workspaces at all if multiple libraries could be specified in the root Cargo.toml
! I can understand that it might not be practical to change that at this point, despite the consistency benefits it would bring...