Document that cargo --config <filename> has unintuitive behavior for config-relative paths #10991
Labels
A-config-cli
Area: --config CLI option
A-documenting-cargo-itself
Area: Cargo's documentation
C-bug
Category: bug
Problem
Hi there!
I'm currently looking at configs defined by filenames, and it looks like
cargo --config <filename>
defines config-relative paths at one level above the config.toml file, rather than at the same level as the config.toml file.Steps
For example, if
foo.toml
is created at the root of the workspace:then when you run
cargo build --config foo.toml
, then "from-foo-toml" is created one level aboveWhile this behavior makes sense for files in
.cargo
, this is extremely surprising behavior for files defined over the command-line. I actually think it is OK to do this, but I didn't see any documentation regarding this on https://doc.rust-lang.org/cargo/reference/config.html.Possible Solution(s)
Document this on https://doc.rust-lang.org/cargo/reference/config.html and recommend that Cargo config files be created in a directory like
.cargo/foo.toml
, notfoo.toml
. (A change to this behavior would be a breaking change, so I don't think that's what should happen.)Notes
No response
Version
The text was updated successfully, but these errors were encountered: