]> git.proxmox.com Git - cargo.git/commitdiff
Only compile user-modifiable projects incrementally.
authorMichael Woerister <michaelwoerister@posteo.net>
Wed, 17 May 2017 12:14:41 +0000 (14:14 +0200)
committerMichael Woerister <michaelwoerister@posteo.net>
Wed, 17 May 2017 12:14:41 +0000 (14:14 +0200)
src/cargo/ops/cargo_rustc/context.rs

index e17a0823b6c0e220098bab5b6eecccfa48970dd9..33f9947e6cc675b3ad893b21e8932c61d5fb670b 100644 (file)
@@ -904,7 +904,11 @@ impl<'a, 'cfg> Context<'a, 'cfg> {
     }
 
     pub fn incremental_args(&self, unit: &Unit) -> CargoResult<Vec<String>> {
-        if self.incremental_enabled {
+        // Only enable incremental compilation for sources the user can modify.
+        // For things that change infrequently, non-incremental builds yield
+        // better performance.
+        // (see also https://github.com/rust-lang/cargo/issues/3972)
+        if self.incremental_enabled && unit.pkg.package_id().source_id().is_path() {
             Ok(vec![format!("-Zincremental={}", self.layout(unit.kind).incremental().display())])
         } else {
             Ok(vec![])