Skip to content

Commit 5cda0a2

Browse files
committed
Add default and latest stable edition to --edition in rustc
1 parent afe8c45 commit 5cda0a2

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

compiler/rustc_session/src/config.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ use std::hash::Hash;
3535
use std::iter;
3636
use std::path::{Path, PathBuf};
3737
use std::str::{self, FromStr};
38+
use std::sync::LazyLock;
3839

3940
pub mod sigpipe;
4041

@@ -1322,7 +1323,12 @@ mod opt {
13221323
unstable(longer(a, b), move |opts| opts.optmulti(a, b, c, d))
13231324
}
13241325
}
1325-
1326+
static EDITION_STRING: LazyLock<String> = LazyLock::new(|| {
1327+
format!(
1328+
"Specify which edition of the compiler to use when compiling code.\
1329+
The default is {DEFAULT_EDITION} and the latest stable edition is {LATEST_STABLE_EDITION}."
1330+
)
1331+
});
13261332
/// Returns the "short" subset of the rustc command line options,
13271333
/// including metadata for each option, such as whether the option is
13281334
/// part of the stable long-term interface for rustc.
@@ -1355,7 +1361,7 @@ pub fn rustc_short_optgroups() -> Vec<RustcOptGroup> {
13551361
opt::opt_s(
13561362
"",
13571363
"edition",
1358-
"Specify which edition of the compiler to use when compiling code.",
1364+
&*EDITION_STRING,
13591365
EDITION_NAME_LIST,
13601366
),
13611367
opt::multi_s(

0 commit comments

Comments
 (0)