mirror of
https://github.com/rust-lang/cargo
synced 2024-10-13 19:22:33 +00:00
2035d0d1b9
fix(script): Process config relative to script, not CWD ### What does this PR try to resolve? This is part of the work for #12207. When you put in your path `foo.rs`: ```rust #!/usr/bin/env cargo fn main() {} ``` You expect it to build once and then repeatedly run the same version. However, `.cargo/config.toml` doesn't work like that (normally). It is an environment file, like `.env`, and is based on your current working directory. So if you run `foo.rs` from within a random project, it might rebuild due to RUSTFLAGS in `.cargo/config.toml`. I had some concern about whether this current behavior is right or not and [noted this in the Pre-RFC](https://github.com/epage/cargo-script-mvs/blob/main/0000-cargo-script.md#unresolved-questions). This came up again while we were [discussing editions on zulip](https://rust-lang.zulipchat.com/#narrow/stream/246057-t-cargo/topic/cargo.20script.20and.20edition). In looking further into this, it turns out we already have precedence for this with `cargo install --path <path>`. ### How should we test and review this PR? The second commit has the fix, the docs, and a change to a test (from the first commit) to show that the fix actually changed behavior. |
||
---|---|---|
.. | ||
build-std | ||
testsuite |