@@ -233,10 +233,11 @@ impl<'a> CargoProcess<'a> {
233
233
// env vars set, but it doesn't hurt to have them.
234
234
. env ( "RUSTC" , & * FAKE_RUSTC )
235
235
. env ( "RUSTC_REAL" , & self . compiler . rustc )
236
- . env (
237
- "CARGO_INCREMENTAL" ,
238
- & format ! ( "{}" , self . incremental as usize ) ,
239
- )
236
+ // We separately pass -Cincremental to the leaf crate --
237
+ // CARGO_INCREMENTAL is cached separately for both the leaf crate
238
+ // and any in-tree dependencies, and we don't want that; it wastes
239
+ // time.
240
+ . env ( "CARGO_INCREMENTAL" , "0" )
240
241
. current_dir ( cwd)
241
242
. arg ( subcommand)
242
243
. arg ( "--manifest-path" )
@@ -346,6 +347,11 @@ impl<'a> CargoProcess<'a> {
346
347
}
347
348
}
348
349
350
+ if self . incremental {
351
+ cmd. arg ( "-Cincremental" ) ;
352
+ cmd. arg ( self . cwd . join ( "incremental-state" ) ) ;
353
+ }
354
+
349
355
log:: debug!( "{:?}" , cmd) ;
350
356
351
357
let output = command_output ( & mut cmd) ?;
@@ -969,14 +975,9 @@ impl Benchmark {
969
975
// Build everything, including all dependent crates, in a temp dir with
970
976
// the first build kind we're building for. The intent is to cache build
971
977
// dependencies at least between runs.
972
- //
973
- // Cache with both incremental and non-incremental.
974
978
let prep_dir = self . make_temp_dir ( & self . path ) ?;
975
979
self . mk_cargo_process ( compiler, prep_dir. path ( ) , build_kinds[ 0 ] )
976
980
. run_rustc ( ) ?;
977
- self . mk_cargo_process ( compiler, prep_dir. path ( ) , build_kinds[ 0 ] )
978
- . incremental ( true )
979
- . run_rustc ( ) ?;
980
981
981
982
for & build_kind in build_kinds {
982
983
eprintln ! ( "Running {}: {:?} + {:?}" , self . name, build_kind, run_kinds) ;
0 commit comments