Skip to content

Commit 8a4b6cb

Browse files
committed
ff/?: really bad way of preventing Cargo.toml to not cause recompiles
Causes false negatives when Cargo.toml changed, cache lookups will still succeed.
1 parent 7449840 commit 8a4b6cb

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/compiler/rust.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -231,16 +231,14 @@ where
231231
let pool = pool.clone();
232232
let cwd = cwd.to_owned();
233233
let crate_name = crate_name.to_owned();
234-
let cargo_toml = cwd.join("Cargo.toml");
235-
trace!("[{}]: add cargo_toml: {:?}", crate_name, cargo_toml.display());
236234

237235
Box::new(dep_info.and_then(move |_| -> SFuture<_> {
238236
let name2 = crate_name.clone();
239237
let parsed = pool.spawn_fn(move || {
240238
parse_dep_file(&dep_file, &cwd)
241239
.chain_err(|| format!("Failed to parse dep info for {}", name2))
242240
});
243-
Box::new(parsed.map(move |mut files| {
241+
Box::new(parsed.map(move |files| {
244242
trace!(
245243
"[{}]: got {} source files from dep-info in {}",
246244
crate_name,
@@ -249,7 +247,6 @@ where
249247
);
250248
// Just to make sure we capture temp_dir.
251249
drop(temp_dir);
252-
files.push(cargo_toml);
253250
files
254251
}))
255252
}))
@@ -1291,6 +1288,11 @@ where
12911288
hash_all(&source_files, &source_hashes_pool)
12921289
.map(|source_hashes| (source_files, source_hashes))
12931290
});
1291+
1292+
let crate_name = crate_name.to_owned();
1293+
let cargo_toml = cwd.join("Cargo.toml");
1294+
trace!("[{}]: add cargo_toml: {:?}", &crate_name, cargo_toml.display());
1295+
12941296
// Hash the contents of the externs listed on the commandline.
12951297
trace!("[{}]: hashing {} externs", crate_name, externs.len());
12961298
let abs_externs = externs.iter().map(|e| cwd.join(e)).collect::<Vec<_>>();
@@ -1463,6 +1465,7 @@ where
14631465
.into_iter()
14641466
.chain(abs_externs)
14651467
.chain(abs_staticlibs)
1468+
.chain(vec![cargo_toml])
14661469
.collect();
14671470

14681471
HashResult {
@@ -2981,8 +2984,6 @@ c:/foo/bar.rs:
29812984
m.update(empty_digest.as_bytes());
29822985
// libbaz.a (static library, from staticlibs)
29832986
m.update(empty_digest.as_bytes());
2984-
// Cargo.toml
2985-
m.update(empty_digest.as_bytes());
29862987
// Env vars
29872988
OsStr::new("CARGO_BLAH").hash(&mut HashToDigest { digest: &mut m });
29882989
m.update(b"=");

0 commit comments

Comments
 (0)