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 ef9a876 commit 544d8e9Copy full SHA for 544d8e9
src/librustc/session/config.rs
@@ -2184,10 +2184,15 @@ pub fn build_session_options_and_crate_config(
2184
TargetTriple::from_triple(host_triple())
2185
};
2186
let opt_level = {
2187
- if matches.opt_present("O") {
2188
- if cg.opt_level.is_some() {
2189
- 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() {
2190
+ Some(i)
2191
+ } else {
2192
+ None
2193
}
2194
+ }).max();
2195
+ if max_o > max_c {
2196
OptLevel::Default
2197
} else {
2198
match cg.opt_level.as_ref().map(String::as_ref) {
0 commit comments