Skip to content

Commit

Permalink
stabilize opt-level={s,z}
Browse files Browse the repository at this point in the history
closes #35784
  • Loading branch information
japaric committed Apr 27, 2018
1 parent 7f3444e commit 2b09d7c
Showing 1 changed file with 9 additions and 21 deletions.
30 changes: 9 additions & 21 deletions src/librustc/session/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1972,27 +1972,15 @@ pub fn build_session_options_and_crate_config(
}
OptLevel::Default
} else {
match (
cg.opt_level.as_ref().map(String::as_ref),
nightly_options::is_nightly_build(),
) {
(None, _) => OptLevel::No,
(Some("0"), _) => OptLevel::No,
(Some("1"), _) => OptLevel::Less,
(Some("2"), _) => OptLevel::Default,
(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), _) => {
match cg.opt_level.as_ref().map(String::as_ref) {
None => OptLevel::No,
Some("0") => OptLevel::No,
Some("1") => OptLevel::Less,
Some("2") => OptLevel::Default,
Some("3") => OptLevel::Aggressive,
Some("s") => OptLevel::Size,
Some("z") => OptLevel::SizeMin,
Some(arg) => {
early_error(
error_format,
&format!(
Expand Down

0 comments on commit 2b09d7c

Please sign in to comment.