We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d65e721 commit e6da57fCopy full SHA for e6da57f
src/librustc/session/config.rs
@@ -2181,10 +2181,15 @@ pub fn build_session_options_and_crate_config(
2181
TargetTriple::from_triple(host_triple())
2182
};
2183
let opt_level = {
2184
- if matches.opt_present("O") {
2185
- if cg.opt_level.is_some() {
2186
- early_error(error_format, "-O and -C opt-level both provided");
+ let max_o = matches.opt_positions("O").into_iter().max();
+ let max_c = matches.opt_strs_pos("C").into_iter().flat_map(|(i, s)| {
+ if let Some("opt-level") = s.splitn(2, '=').next() {
2187
+ Some(i)
2188
+ } else {
2189
+ None
2190
}
2191
+ }).max();
2192
+ if max_o > max_c {
2193
OptLevel::Default
2194
} else {
2195
match cg.opt_level.as_ref().map(String::as_ref) {
0 commit comments