about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2025-01-07 21:39:42 +0100
committerGitHub <noreply@github.com>2025-01-07 21:39:42 +0100
commit5dd21df7c137d76913dba7b1866a4c41c6e99a4a (patch)
treec2327fc3c58066e6a66ac6752cbd70711e23ec3c /src
parent0e48e96e656b056dbb55cf241472ee130ff21ff4 (diff)
parentb77eb96baad4ad5c90cce09e4d649e8974d445c8 (diff)
Rollup merge of #135200 - jieyouxu:stabilize-style-edition, r=ytmimi,compiler-errors
rustfmt: drop nightly-gating of the `--style-edition` flag registration

Follow-up to [Stabilize `style_edition = "2024"` in-tree #134929](https://github.com/rust-lang/rust/pull/134929).

#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 https://github.com/rust-lang/rust/pull/135197.

r? rustfmt
Diffstat (limited to 'src')
-rw-r--r--src/tools/rustfmt/src/bin/main.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/tools/rustfmt/src/bin/main.rs b/src/tools/rustfmt/src/bin/main.rs
index 4078484ff10..34984798ae6 100644
--- a/src/tools/rustfmt/src/bin/main.rs
+++ b/src/tools/rustfmt/src/bin/main.rs
@@ -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(
@@ -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");