Skip to content

Commit 6e9a833

Browse files
committed
Auto merge of #11961 - ehuss:chdir-beta, r=weihanglo
[beta 1.69] Change -C to be unstable Beta backport of #11960. This also includes some other changes to get CI passing: #11916 — Disable test_profile test on windows-gnu Ignored some tests due to a change in clap output
2 parents 713164a + 9474349 commit 6e9a833

File tree

104 files changed

+540
-35
lines changed

Some content is hidden

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

104 files changed

+540
-35
lines changed

src/bin/cargo/cli.rs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,23 @@ pub fn main(config: &mut LazyConfig) -> CliResult {
3131
// This must be completed before config is initialized
3232
assert_eq!(config.is_init(), false);
3333
if let Some(new_cwd) = args.get_one::<std::path::PathBuf>("directory") {
34+
// This is a temporary hack. This cannot access `Config`, so this is a bit messy.
35+
// This does not properly parse `-Z` flags that appear after the subcommand.
36+
// The error message is not as helpful as the standard one.
37+
let nightly_features_allowed = matches!(&*features::channel(), "nightly" | "dev");
38+
if !nightly_features_allowed
39+
|| (nightly_features_allowed
40+
&& !args
41+
.get_many("unstable-features")
42+
.map(|mut z| z.any(|value: &String| value == "unstable-options"))
43+
.unwrap_or(false))
44+
{
45+
return Err(anyhow::format_err!(
46+
"the `-C` flag is unstable, \
47+
pass `-Z unstable-options` on the nightly channel to enable it"
48+
)
49+
.into());
50+
}
3451
std::env::set_current_dir(&new_cwd).context("could not change to requested directory")?;
3552
}
3653

@@ -476,7 +493,7 @@ See 'cargo help <command>' for more information on a specific command.\n",
476493
)
477494
.arg(
478495
Arg::new("directory")
479-
.help("Change to DIRECTORY before doing anything")
496+
.help("Change to DIRECTORY before doing anything (nightly-only)")
480497
.short('C')
481498
.value_name("DIRECTORY")
482499
.value_hint(clap::ValueHint::DirPath)

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,11 @@ OPTIONS
192192
for the project manifest (Cargo.toml), as well as the directories
193193
searched for discovering .cargo/config.toml, for example.
194194

195+
This option is only available on the nightly channel
196+
<https://doc.rust-lang.org/book/appendix-07-nightly-rust.html> and
197+
requires the -Z unstable-options flag to enable (see #10098
198+
<https://github.com/rust-lang/cargo/issues/10098>).
199+
195200
-h, --help
196201
Prints help information.
197202

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,11 @@ OPTIONS
371371
for the project manifest (Cargo.toml), as well as the directories
372372
searched for discovering .cargo/config.toml, for example.
373373

374+
This option is only available on the nightly channel
375+
<https://doc.rust-lang.org/book/appendix-07-nightly-rust.html> and
376+
requires the -Z unstable-options flag to enable (see #10098
377+
<https://github.com/rust-lang/cargo/issues/10098>).
378+
374379
-h, --help
375380
Prints help information.
376381

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,11 @@ OPTIONS
320320
for the project manifest (Cargo.toml), as well as the directories
321321
searched for discovering .cargo/config.toml, for example.
322322

323+
This option is only available on the nightly channel
324+
<https://doc.rust-lang.org/book/appendix-07-nightly-rust.html> and
325+
requires the -Z unstable-options flag to enable (see #10098
326+
<https://github.com/rust-lang/cargo/issues/10098>).
327+
323328
-h, --help
324329
Prints help information.
325330

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,11 @@ OPTIONS
305305
for the project manifest (Cargo.toml), as well as the directories
306306
searched for discovering .cargo/config.toml, for example.
307307

308+
This option is only available on the nightly channel
309+
<https://doc.rust-lang.org/book/appendix-07-nightly-rust.html> and
310+
requires the -Z unstable-options flag to enable (see #10098
311+
<https://github.com/rust-lang/cargo/issues/10098>).
312+
308313
-h, --help
309314
Prints help information.
310315

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,11 @@ OPTIONS
134134
for the project manifest (Cargo.toml), as well as the directories
135135
searched for discovering .cargo/config.toml, for example.
136136

137+
This option is only available on the nightly channel
138+
<https://doc.rust-lang.org/book/appendix-07-nightly-rust.html> and
139+
requires the -Z unstable-options flag to enable (see #10098
140+
<https://github.com/rust-lang/cargo/issues/10098>).
141+
137142
-h, --help
138143
Prints help information.
139144

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,11 @@ OPTIONS
276276
for the project manifest (Cargo.toml), as well as the directories
277277
searched for discovering .cargo/config.toml, for example.
278278

279+
This option is only available on the nightly channel
280+
<https://doc.rust-lang.org/book/appendix-07-nightly-rust.html> and
281+
requires the -Z unstable-options flag to enable (see #10098
282+
<https://github.com/rust-lang/cargo/issues/10098>).
283+
279284
-h, --help
280285
Prints help information.
281286

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,11 @@ OPTIONS
119119
for the project manifest (Cargo.toml), as well as the directories
120120
searched for discovering .cargo/config.toml, for example.
121121

122+
This option is only available on the nightly channel
123+
<https://doc.rust-lang.org/book/appendix-07-nightly-rust.html> and
124+
requires the -Z unstable-options flag to enable (see #10098
125+
<https://github.com/rust-lang/cargo/issues/10098>).
126+
122127
-h, --help
123128
Prints help information.
124129

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,11 @@ OPTIONS
378378
for the project manifest (Cargo.toml), as well as the directories
379379
searched for discovering .cargo/config.toml, for example.
380380

381+
This option is only available on the nightly channel
382+
<https://doc.rust-lang.org/book/appendix-07-nightly-rust.html> and
383+
requires the -Z unstable-options flag to enable (see #10098
384+
<https://github.com/rust-lang/cargo/issues/10098>).
385+
381386
-h, --help
382387
Prints help information.
383388

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,11 @@ OPTIONS
9494
for the project manifest (Cargo.toml), as well as the directories
9595
searched for discovering .cargo/config.toml, for example.
9696

97+
This option is only available on the nightly channel
98+
<https://doc.rust-lang.org/book/appendix-07-nightly-rust.html> and
99+
requires the -Z unstable-options flag to enable (see #10098
100+
<https://github.com/rust-lang/cargo/issues/10098>).
101+
97102
-h, --help
98103
Prints help information.
99104

0 commit comments

Comments
 (0)