I’d rather not wrap cargo builds with an additional layer of Makefiles or other scripts, because that’s exactly what this will turn into.
Take my dirs crate for instance: The original home_dir function in the standard library supported every platform Rust supports.
The replacement only supports Linux, macOS (only tested on CI), Windows (only tested on CI) and Redox (not regularly tested at all).
I’d love if people with obscure platforms were able to just drop in their own implementations for platforms I can’t support/test. This is a no-brainer if the source code is properly decoupled from the organization that provides the implementation.
My proposal does that, so having one Cargo.toml should suffice even if different platforms depend on “different” dirs crates for different platforms.
Your suggestion would make it necessary to rewrite source files during the build and probably adjust the Cargo.toml file as necessary, too. (You could do both with Makefiles for example, or whatever scripting language you fancy.)
I’d rather not go the Cargo.toml + Makefiles way, if a task can be solved with Cargo.toml alone. Popular languages picking a design is a rather good indication to avoid that design in general, if there aren’t any convincing reasons to reconsider (explanation below).