Skip to content

Commit ed549d8

Browse files
committed
Auto merge of #10755 - jonhoo:stabilize-config-cli, r=ehuss
Stabilize config-cli This stabilizes the `--config` CLI argument as per [this FCP](#7722 (comment)). It also makes the adjustment [suggested by `@ehuss](https://github.com/rust-lang/cargo/issues/7722#issuecomment-1098612205)` to allow stabilizing `--config path` without _also_ stabilizing [`config-include`](https://doc.rust-lang.org/cargo/reference/unstable.html#config-include). I took a guess that this would land in 1.63 and put that in the tombstone entry in the unstable docs, but let me know if that's likely to be wrong. Closes #7722. Also, I think this should probably be tagged `relnotes`.
2 parents c9d8c28 + 7eefb42 commit ed549d8

File tree

101 files changed

+455
-102
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

101 files changed

+455
-102
lines changed

src/bin/cargo/cli.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -476,14 +476,7 @@ See 'cargo help <command>' for more information on a specific command.\n",
476476
.arg(flag("frozen", "Require Cargo.lock and cache are up to date").global(true))
477477
.arg(flag("locked", "Require Cargo.lock is up to date").global(true))
478478
.arg(flag("offline", "Run without accessing the network").global(true))
479-
.arg(
480-
multi_opt(
481-
"config",
482-
"KEY=VALUE",
483-
"Override a configuration value (unstable)",
484-
)
485-
.global(true),
486-
)
479+
.arg(multi_opt("config", "KEY=VALUE", "Override a configuration value").global(true))
487480
.arg(
488481
Arg::new("unstable-features")
489482
.help("Unstable (nightly-only) flags to Cargo, see 'cargo -Z help' for details")

src/cargo/util/config/mod.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -892,7 +892,6 @@ impl Config {
892892
self.unstable_flags_cli = Some(unstable_flags.to_vec());
893893
}
894894
if !cli_config.is_empty() {
895-
self.unstable_flags.fail_if_stable_opt("--config", 6699)?;
896895
self.cli_config = Some(cli_config.iter().map(|s| s.to_string()).collect());
897896
self.merge_cli_args()?;
898897
}
@@ -1165,6 +1164,7 @@ impl Config {
11651164
Some(cli_args) => cli_args,
11661165
None => return Ok(loaded_args),
11671166
};
1167+
let mut seen = HashSet::new();
11681168
for arg in cli_args {
11691169
let arg_as_path = self.cwd.join(arg);
11701170
let tmp_table = if !arg.is_empty() && arg_as_path.exists() {
@@ -1175,9 +1175,8 @@ impl Config {
11751175
anyhow::format_err!("config path {:?} is not utf-8", arg_as_path)
11761176
})?
11771177
.to_string();
1178-
let value = CV::String(str_path, Definition::Cli);
1179-
let map = HashMap::from([("include".to_string(), value)]);
1180-
CV::Table(map, Definition::Cli)
1178+
self._load_file(&self.cwd().join(&str_path), &mut seen, true)
1179+
.with_context(|| format!("failed to load config from `{}`", str_path))?
11811180
} else {
11821181
// We only want to allow "dotted key" (see https://toml.io/en/v1.0.0#keys)
11831182
// expressions followed by a value that's not an "inline table"

src/doc/man/generated_txt/cargo-add.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,9 @@ OPTIONS
141141
<https://rust-lang.github.io/rustup/overrides.html> for more
142142
information about how toolchain overrides work.
143143

144+
--config KEY=VALUE
145+
Overrides a Cargo configuration value.
146+
144147
-h, --help
145148
Prints help information.
146149

src/doc/man/generated_txt/cargo-bench.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,9 @@ OPTIONS
353353
<https://rust-lang.github.io/rustup/overrides.html> for more
354354
information about how toolchain overrides work.
355355

356+
--config KEY=VALUE
357+
Overrides a Cargo configuration value.
358+
356359
-h, --help
357360
Prints help information.
358361

src/doc/man/generated_txt/cargo-build.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,9 @@ OPTIONS
302302
<https://rust-lang.github.io/rustup/overrides.html> for more
303303
information about how toolchain overrides work.
304304

305+
--config KEY=VALUE
306+
Overrides a Cargo configuration value.
307+
305308
-h, --help
306309
Prints help information.
307310

src/doc/man/generated_txt/cargo-check.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,9 @@ OPTIONS
287287
<https://rust-lang.github.io/rustup/overrides.html> for more
288288
information about how toolchain overrides work.
289289

290+
--config KEY=VALUE
291+
Overrides a Cargo configuration value.
292+
290293
-h, --help
291294
Prints help information.
292295

src/doc/man/generated_txt/cargo-clean.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,9 @@ OPTIONS
118118
<https://rust-lang.github.io/rustup/overrides.html> for more
119119
information about how toolchain overrides work.
120120

121+
--config KEY=VALUE
122+
Overrides a Cargo configuration value.
123+
121124
-h, --help
122125
Prints help information.
123126

src/doc/man/generated_txt/cargo-doc.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,9 @@ OPTIONS
258258
<https://rust-lang.github.io/rustup/overrides.html> for more
259259
information about how toolchain overrides work.
260260

261+
--config KEY=VALUE
262+
Overrides a Cargo configuration value.
263+
261264
-h, --help
262265
Prints help information.
263266

src/doc/man/generated_txt/cargo-fetch.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@ OPTIONS
103103
<https://rust-lang.github.io/rustup/overrides.html> for more
104104
information about how toolchain overrides work.
105105

106+
--config KEY=VALUE
107+
Overrides a Cargo configuration value.
108+
106109
-h, --help
107110
Prints help information.
108111

src/doc/man/generated_txt/cargo-fix.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,9 @@ OPTIONS
360360
<https://rust-lang.github.io/rustup/overrides.html> for more
361361
information about how toolchain overrides work.
362362

363+
--config KEY=VALUE
364+
Overrides a Cargo configuration value.
365+
363366
-h, --help
364367
Prints help information.
365368

0 commit comments

Comments
 (0)