From 5cda0a2f39930daaeb1e71e9027be0e28fe55cfd Mon Sep 17 00:00:00 2001 From: Matthew Esposito Date: Fri, 6 Jan 2023 14:07:12 -0500 Subject: [PATCH 1/2] Add default and latest stable edition to --edition in rustc --- compiler/rustc_session/src/config.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs index a87e820386e7c..233343febffda 100644 --- a/compiler/rustc_session/src/config.rs +++ b/compiler/rustc_session/src/config.rs @@ -35,6 +35,7 @@ use std::hash::Hash; use std::iter; use std::path::{Path, PathBuf}; use std::str::{self, FromStr}; +use std::sync::LazyLock; pub mod sigpipe; @@ -1322,7 +1323,12 @@ mod opt { unstable(longer(a, b), move |opts| opts.optmulti(a, b, c, d)) } } - +static EDITION_STRING: LazyLock = LazyLock::new(|| { + format!( + "Specify which edition of the compiler to use when compiling code.\ +The default is {DEFAULT_EDITION} and the latest stable edition is {LATEST_STABLE_EDITION}." + ) +}); /// Returns the "short" subset of the rustc command line options, /// including metadata for each option, such as whether the option is /// part of the stable long-term interface for rustc. @@ -1355,7 +1361,7 @@ pub fn rustc_short_optgroups() -> Vec { opt::opt_s( "", "edition", - "Specify which edition of the compiler to use when compiling code.", + &*EDITION_STRING, EDITION_NAME_LIST, ), opt::multi_s( From 893938f64f7a9ff531b3968c9a9e79e0524606bd Mon Sep 17 00:00:00 2001 From: Matthew E Date: Fri, 6 Jan 2023 14:36:52 -0500 Subject: [PATCH 2/2] Update compiler/rustc_session/src/config.rs Co-authored-by: bjorn3 <17426603+bjorn3@users.noreply.github.com> --- compiler/rustc_session/src/config.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs index 233343febffda..1ccfc59f7a9d6 100644 --- a/compiler/rustc_session/src/config.rs +++ b/compiler/rustc_session/src/config.rs @@ -1325,7 +1325,7 @@ mod opt { } static EDITION_STRING: LazyLock = LazyLock::new(|| { format!( - "Specify which edition of the compiler to use when compiling code.\ + "Specify which edition of the compiler to use when compiling code. \ The default is {DEFAULT_EDITION} and the latest stable edition is {LATEST_STABLE_EDITION}." ) });