When I compile some Rust binary or dependency on Linux and see crates such a winapi downloaded and compiled I always feel that in addition to overlook by crate’s authors this is also a flaw in cargo’s design. As we have a set of crates which are not fully cross-platform or even target some specialized architecture or environment I think it makes sense to add this information to Cargo.toml.

Probably the easiest approach will be addition of package level target_* properties which follow currently existing configuration for conditional compilation. In addition to simply informing crate users this can be used to validate dependent crates. So if some crate (e.g. winapi ) adds target_family="windows" to the Cargo.toml it will be required for dependent crate to use target.'cfg(windows)'.dependencies on this dependency. In addition to clearer dependency tree and better developer notifications (e.g. we can add related icons to crates.io) it could potentially prevent some bugs. Also it could be used to promote no_std crates, as for now there is no way of knowing which crates can be used for bare-metal development and which are not.

Of course there will be a more complex cases and we should discuss various corner cases and details of dependency validation algorithm. But before opening issue and starting RFC I would like to hear your comments and ideas on this.