Skip to content

Commit f495483

Browse files
authored
Auto merge of #35159 - michaelwoerister:incr-comp-implies-orbit, r=nikomatsakis
Automatically enable -Zorbit if -Zincremental is specified. Fixes #34973 r? @nikomatsakis
2 parents 379bfd0 + 44dbc49 commit f495483

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

src/librustc/session/config.rs

+9-1
Original file line numberDiff line numberDiff line change
@@ -1168,7 +1168,15 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
11681168
})
11691169
});
11701170

1171-
let debugging_opts = build_debugging_options(matches, error_format);
1171+
let mut debugging_opts = build_debugging_options(matches, error_format);
1172+
1173+
// Incremental compilation only works reliably when translation is done via
1174+
// MIR, so let's enable -Z orbit if necessary (see #34973).
1175+
if debugging_opts.incremental.is_some() && !debugging_opts.orbit {
1176+
early_warn(error_format, "Automatically enabling `-Z orbit` because \
1177+
`-Z incremental` was specified");
1178+
debugging_opts.orbit = true;
1179+
}
11721180

11731181
let parse_only = debugging_opts.parse_only;
11741182
let no_trans = debugging_opts.no_trans;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// ignore-pretty
12+
// compile-flags:-Zincremental=tmp/cfail-tests/enable-orbit-for-incr-comp -Zorbit=off
13+
// error-pattern:Automatically enabling `-Z orbit` because `-Z incremental` was specified
14+
15+
#![deny(warnings)]
16+
17+
fn main() {
18+
FAIL! // We just need some compilation error. What we really care about is
19+
// that the error pattern above is checked.
20+
}

0 commit comments

Comments
 (0)