Don't tell users to use a nightly flag on the stable channel
Hint upgrading to a newer Rust version instead
This commit is contained in:
parent
481598b26d
commit
40af086ee4
1 changed files with 11 additions and 8 deletions
|
@ -18,7 +18,7 @@ use rustc_serialize::json;
|
||||||
|
|
||||||
use crate::parse::CrateConfig;
|
use crate::parse::CrateConfig;
|
||||||
use rustc_feature::UnstableFeatures;
|
use rustc_feature::UnstableFeatures;
|
||||||
use rustc_span::edition::{Edition, DEFAULT_EDITION, EDITION_NAME_LIST};
|
use rustc_span::edition::{Edition, DEFAULT_EDITION, EDITION_NAME_LIST, LATEST_STABLE_EDITION};
|
||||||
use rustc_span::source_map::{FileName, FilePathMapping};
|
use rustc_span::source_map::{FileName, FilePathMapping};
|
||||||
use rustc_span::symbol::{sym, Symbol};
|
use rustc_span::symbol::{sym, Symbol};
|
||||||
use rustc_span::SourceFileHashAlgorithm;
|
use rustc_span::SourceFileHashAlgorithm;
|
||||||
|
@ -1320,13 +1320,16 @@ pub fn parse_crate_edition(matches: &getopts::Matches) -> Edition {
|
||||||
};
|
};
|
||||||
|
|
||||||
if !edition.is_stable() && !nightly_options::is_unstable_enabled(matches) {
|
if !edition.is_stable() && !nightly_options::is_unstable_enabled(matches) {
|
||||||
early_error(
|
let is_nightly = nightly_options::match_is_nightly_build(matches);
|
||||||
ErrorOutputType::default(),
|
let msg = if !is_nightly {
|
||||||
&format!(
|
format!(
|
||||||
"edition {} is unstable and only available with -Z unstable-options.",
|
"the crate requires edition {}, but the latest edition supported by this Rust version is {}",
|
||||||
edition,
|
edition, LATEST_STABLE_EDITION
|
||||||
),
|
)
|
||||||
)
|
} else {
|
||||||
|
format!("edition {} is unstable and only available with -Z unstable-options", edition)
|
||||||
|
};
|
||||||
|
early_error(ErrorOutputType::default(), &msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
edition
|
edition
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue