Skip to content

Commit 44dbc49

Browse files
Automatically enable -Zorbit if -Zincremental is specified.
1 parent 535cea0 commit 44dbc49

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

src/librustc/session/config.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1143,7 +1143,15 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
11431143
})
11441144
});
11451145

1146-
let debugging_opts = build_debugging_options(matches, error_format);
1146+
let mut debugging_opts = build_debugging_options(matches, error_format);
1147+
1148+
// Incremental compilation only works reliably when translation is done via
1149+
// MIR, so let's enable -Z orbit if necessary (see #34973).
1150+
if debugging_opts.incremental.is_some() && !debugging_opts.orbit {
1151+
early_warn(error_format, "Automatically enabling `-Z orbit` because \
1152+
`-Z incremental` was specified");
1153+
debugging_opts.orbit = true;
1154+
}
11471155

11481156
let parse_only = debugging_opts.parse_only;
11491157
let no_trans = debugging_opts.no_trans;
Lines changed: 20 additions & 0 deletions
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)