From 365bb991c2e0f11c9a70cb134e55ee94408bd441 Mon Sep 17 00:00:00 2001 From: Matthew Esposito Date: Fri, 23 Dec 2022 14:29:43 -0500 Subject: [PATCH 1/2] Add default and latest stable edition to --edition in rustc --- compiler/rustc_session/src/config.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs index 3bafd3730bd79..85a291b1a49de 100644 --- a/compiler/rustc_session/src/config.rs +++ b/compiler/rustc_session/src/config.rs @@ -1339,7 +1339,8 @@ pub fn rustc_short_optgroups() -> Vec { opt::opt_s( "", "edition", - "Specify which edition of the compiler to use when compiling code.", + Box::leak(Box::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}."))), EDITION_NAME_LIST, ), opt::multi_s( From f931d2ded06ccf4bafa7f50d89b91036fb4dc313 Mon Sep 17 00:00:00 2001 From: Matthew Esposito Date: Sun, 25 Dec 2022 17:00:42 -0500 Subject: [PATCH 2/2] Remove extra allocation --- compiler/rustc_session/src/config.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs index 85a291b1a49de..04494e986f855 100644 --- a/compiler/rustc_session/src/config.rs +++ b/compiler/rustc_session/src/config.rs @@ -1339,8 +1339,8 @@ pub fn rustc_short_optgroups() -> Vec { opt::opt_s( "", "edition", - Box::leak(Box::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}."))), + Box::leak(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}.").into_boxed_str()), EDITION_NAME_LIST, ), opt::multi_s(