Fix argument alias handling for -g and -C debuginfo

This commit is contained in:
varkor 2019-04-30 21:52:05 +01:00
parent e6da57f3e7
commit e8e43c9e16
1 changed files with 8 additions and 3 deletions

View File

@ -2214,10 +2214,15 @@ pub fn build_session_options_and_crate_config(
}
};
let debug_assertions = cg.debug_assertions.unwrap_or(opt_level == OptLevel::No);
let debuginfo = if matches.opt_present("g") {
if cg.debuginfo.is_some() {
early_error(error_format, "-g and -C debuginfo both provided");
let max_g = matches.opt_positions("g").into_iter().max();
let max_c = matches.opt_strs_pos("C").into_iter().flat_map(|(i, s)| {
if let Some("debuginfo") = s.splitn(2, '=').next() {
Some(i)
} else {
None
}
}).max();
let debuginfo = if max_g > max_c {
DebugInfo::Full
} else {
match cg.debuginfo {