Skip to content

Commit

Permalink
Rollup merge of rust-lang#135200 - jieyouxu:stabilize-style-edition, …
Browse files Browse the repository at this point in the history
…r=ytmimi,compiler-errors

rustfmt: drop nightly-gating of the `--style-edition` flag registration

Follow-up to [Stabilize `style_edition = "2024"` in-tree rust-lang#134929](rust-lang#134929).

rust-lang#134929 un-nightly-gated the *read* of `--style-edition`, but didn't also un-nightly-gate the *registration*/*declaration* of the `--style-edition` flag itself. Reading `--style-edition` on a non-nightly channel (e.g. beta) will thus panic because `--style-edition` is never declared.

This PR also un-nightly-gates the registration. Not sure how to write a regression test for this, because this *requires* the non-nightly / beta channel. Though existing tests do fail (albeit indirectly).

Checking if this fixes the panic against beta in rust-lang#135197.

r? rustfmt
  • Loading branch information
matthiaskrgr authored Jan 7, 2025
2 parents 0e48e96 + b77eb96 commit 5dd21df
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/tools/rustfmt/src/bin/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,12 @@ fn make_opts() -> Options {
"Set options from command line. These settings take priority over .rustfmt.toml",
"[key1=val1,key2=val2...]",
);
opts.optopt(
"",
"style-edition",
"The edition of the Style Guide.",
"[2015|2018|2021|2024]",
);

if is_nightly {
opts.optflag(
Expand All @@ -186,12 +192,6 @@ fn make_opts() -> Options {
"skip-children",
"Don't reformat child modules (unstable).",
);
opts.optopt(
"",
"style-edition",
"The edition of the Style Guide (unstable).",
"[2015|2018|2021|2024]",
);
}

opts.optflag("v", "verbose", "Print verbose output");
Expand Down

0 comments on commit 5dd21df

Please sign in to comment.