Emit warning to user when attempting to use optimize for size on non-nightly builds.

This commit is contained in:
Brandon Edens 2016-04-29 22:45:24 -07:00
parent 49d28258a7
commit 16eaecbe43

View file

@ -1136,6 +1136,10 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
(Some("3"), _) => OptLevel::Aggressive,
(Some("s"), true) => OptLevel::Size,
(Some("z"), true) => OptLevel::SizeMin,
(Some("s"), false) | (Some("z"), false) => {
early_error(error_format, &format!("the optimizations s or z are only \
accepted on the nightly compiler"));
},
(Some(arg), _) => {
early_error(error_format, &format!("optimization level needs to be \
between 0-3 (instead was `{}`)",