From 3d9d0e9d3edd6ef767817e5432b6869929ab0058 Mon Sep 17 00:00:00 2001 From: Mara Bos Date: Thu, 24 Dec 2020 16:48:41 +0100 Subject: [PATCH] Require `-Z unstable-options` for unstable editions. --- compiler/rustc_session/src/config.rs | 5 ++--- src/test/ui/hello2021.rs | 1 + 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs index c9ddcbdb5f5..62859f4bef4 100644 --- a/compiler/rustc_session/src/config.rs +++ b/compiler/rustc_session/src/config.rs @@ -1308,12 +1308,11 @@ fn parse_crate_edition(matches: &getopts::Matches) -> Edition { None => DEFAULT_EDITION, }; - if !edition.is_stable() && !nightly_options::match_is_nightly_build(matches) { + if !edition.is_stable() && !nightly_options::is_unstable_enabled(matches) { early_error( ErrorOutputType::default(), &format!( - "edition {} is unstable and only \ - available for nightly builds of rustc.", + "edition {} is unstable and only available with -Z unstable-options.", edition, ), ) diff --git a/src/test/ui/hello2021.rs b/src/test/ui/hello2021.rs index 134d8af5bfb..738f151b0f6 100644 --- a/src/test/ui/hello2021.rs +++ b/src/test/ui/hello2021.rs @@ -1,5 +1,6 @@ // run-pass // edition:2021 +// compile-flags: -Zunstable-options fn main() { println!("hello, 2021");