diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2017-03-10 16:51:32 -0600 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2017-03-10 16:18:28 -0800 |
| commit | 2b1d1bbf2abf2aac43f1eaa426f5597ea6a8bc4d (patch) | |
| tree | e0ca5366022947af0a0b6a266c76bd2b67921e17 /src | |
| parent | c1c3b09f286b06ec9a0ee328461330ef37f44548 (diff) | |
| parent | 5c8aa74d26ba1dd4439d6d273ea32daa11f28851 (diff) | |
| download | rust-2b1d1bbf2abf2aac43f1eaa426f5597ea6a8bc4d.tar.gz rust-2b1d1bbf2abf2aac43f1eaa426f5597ea6a8bc4d.zip | |
Rollup merge of #40336 - alexcrichton:fast-dep-info, r=nrc
rustc: Exit quickly on only `--emit dep-info` This commit alters the compiler to exit quickly if the only output being emitted is `dep-info`, which doesn't need a lot of other information to generate. Closes #40328
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc_driver/driver.rs | 4 | ||||
| -rw-r--r-- | src/test/run-make/dep-info-doesnt-run-much/Makefile | 4 | ||||
| -rw-r--r-- | src/test/run-make/dep-info-doesnt-run-much/foo.rs | 15 |
3 files changed, 23 insertions, 0 deletions
diff --git a/src/librustc_driver/driver.rs b/src/librustc_driver/driver.rs index dda118fb440..2d08817e2a0 100644 --- a/src/librustc_driver/driver.rs +++ b/src/librustc_driver/driver.rs @@ -125,6 +125,10 @@ pub fn compile_input(sess: &Session, }; write_out_deps(sess, &outputs, &crate_name); + if sess.opts.output_types.contains_key(&OutputType::DepInfo) && + sess.opts.output_types.keys().count() == 1 { + return Ok(()) + } let arena = DroplessArena::new(); let arenas = GlobalArenas::new(); diff --git a/src/test/run-make/dep-info-doesnt-run-much/Makefile b/src/test/run-make/dep-info-doesnt-run-much/Makefile new file mode 100644 index 00000000000..2fd84639f21 --- /dev/null +++ b/src/test/run-make/dep-info-doesnt-run-much/Makefile @@ -0,0 +1,4 @@ +-include ../tools.mk + +all: + $(RUSTC) foo.rs --emit dep-info diff --git a/src/test/run-make/dep-info-doesnt-run-much/foo.rs b/src/test/run-make/dep-info-doesnt-run-much/foo.rs new file mode 100644 index 00000000000..35911821044 --- /dev/null +++ b/src/test/run-make/dep-info-doesnt-run-much/foo.rs @@ -0,0 +1,15 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// We're only emitting dep info, so we shouldn't be running static analysis to +// figure out that this program is erroneous. +fn main() { + let a: u8 = "a"; +} |
