Unknown properties in Cargo.toml
are ignored with a warning, except when they're nightly features. This creates an unfortunate "discontinuity" in crate compatibility for crates that adopt new Cargo features:
- Very old cargo: ignores the new feature, and likely works fine without it.
- Slightly old cargo: complains that it's a nightly-only feature, refuses to work.
- Latest cargo: works fine.
For example default-run
is harmless for most Cargo versions, except the couple recent ones where it totally breaks everything. I've also found there's a number of crates with edition = "2018"
that are compatible with Rust 1.24, because the old Rust was too old to know it was not supposed to work
Effectively, Cargo has a policy of gracefully ignoring far-future nightly features, and hard-rejecting only near-future nightly features.
To make the behavior consistent, I suggest ignoring nightly features in stable Cargo, the same as if they were any unknown property. Instead of showing an error, show a warning, and act as if the nightly property didn't exist.