From 96b446237db31e35aaa0470ce37231bd63bc9e19 Mon Sep 17 00:00:00 2001 From: di3go04 Date: Tue, 30 Jun 2026 06:20:24 -0500 Subject: [PATCH 1/6] fix(cli): clarify -Z help output and note rustc flags Updates the -Z help output per the design proposed in #17145: clarifies these are cargo flags, reformats the channel warning to rustc diagnostic style, and adds a note pointing to rustc -Zhelp for rustc flags. --- src/bin/cargo/cli.rs | 13 +++++++------ tests/testsuite/cargo/z_help/stdout.term.svg | 8 ++++++-- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/bin/cargo/cli.rs b/src/bin/cargo/cli.rs index 83eba6895a7..df26ac18785 100644 --- a/src/bin/cargo/cli.rs +++ b/src/bin/cargo/cli.rs @@ -125,7 +125,7 @@ fn print_zhelp(gctx: &GlobalContext) { drop_println!( gctx, "\ -{header}Available unstable (nightly-only) flags:{header:#} +{header}Available unstable (nightly-only) cargo flags:{header:#} {z_flags} @@ -134,17 +134,18 @@ Run with `{literal}cargo -Z{literal:#} {placeholder}[FLAG] [COMMAND]{placeholder if !gctx.nightly_features_allowed { drop_println!( gctx, - "\nUnstable flags are only available on the nightly channel \ - of Cargo, but this is the `{}` channel.\n\ - {}", + "\n{header}warn:{header:#} unstable flags are unavailable on the current (`{}`) channel,\n \ + {header}| help:{header:#} run on the nightly channel to use them\n \ + {header}| help:{header:#} see {channels} for more information about Rust release channels.", features::channel(), - features::SEE_CHANNELS + channels = features::SEE_CHANNELS, ); } drop_println!( gctx, "\nSee https://doc.rust-lang.org/nightly/cargo/reference/unstable.html \ - for more information about these flags." + for more information about these flags.\n\n\ + note: to see rustc unstable features, run `rustc -Zhelp`" ); } diff --git a/tests/testsuite/cargo/z_help/stdout.term.svg b/tests/testsuite/cargo/z_help/stdout.term.svg index c3feb8b2e72..75dba04db57 100644 --- a/tests/testsuite/cargo/z_help/stdout.term.svg +++ b/tests/testsuite/cargo/z_help/stdout.term.svg @@ -1,4 +1,4 @@ - +