[Pre-RFC] Proposal: bound Cargo's implicit upward discovery for config.toml files
I shouldn't skip talking about use cases first, though when I was stabilizing config-include I actually came up with a maybe-simpler implementation idea. Let me just dump it here.
We can add a top-level config-discovery=true|false key in Cargo configuration. As a native Cargo config field, it automatically supports TOML config, env CARGO_CONFIG_DISCOVERY, and CLI --config config-discovery. You can just run env CARGO_CONFIG_DISCOVERY=false cargo build to stop loading any config, as env wins over file discovery.
Also during the stabilization, we reserves the room for templating paths in include, so potentially we can implement things like
config-discovery = false
[[include]]
path = "{workspace-root}/.cargo/config.toml"
[[include]]
path = "{cargo-config-home}/config.toml"
to read only config from CARGO_HOME and your workspace root.
While search ceiling looks nice and convenience, I personally think whoever depended on a fragile auto-discovery was just because config-include wasn't stabilized. They should migrate to include if not yet.
Discussion in the ATmosphere