diff --git a/src/cargo/ops/cargo_rustc/fingerprint.rs b/src/cargo/ops/cargo_rustc/fingerprint.rs index f1840da877d..c93a233640f 100644 --- a/src/cargo/ops/cargo_rustc/fingerprint.rs +++ b/src/cargo/ops/cargo_rustc/fingerprint.rs @@ -240,8 +240,18 @@ fn calculate_target_fresh(pkg: &Package, dep_info: &Path) -> CargoResult { })); let deps = line.slice_from(pos + 2); - for file in deps.split(' ').map(|s| s.trim()).filter(|s| !s.is_empty()) { - match fs::stat(&pkg.get_root().join(file)) { + let mut deps = deps.split(' ').map(|s| s.trim()).filter(|s| !s.is_empty()); + loop { + let mut file = match deps.next() { + Some(s) => s.to_string(), + None => break, + }; + while file.as_slice().ends_with("\\") { + file.pop(); + file.push(' '); + file.push_str(deps.next().unwrap()) + } + match fs::stat(&pkg.get_root().join(file.as_slice())) { Ok(stat) if stat.modified <= mtime => {} Ok(stat) => { debug!("stale: {} -- {} vs {}", file, stat.modified, mtime); diff --git a/tests/test_cargo_compile.rs b/tests/test_cargo_compile.rs index 764e7524cd8..b0ff9d7165d 100644 --- a/tests/test_cargo_compile.rs +++ b/tests/test_cargo_compile.rs @@ -1643,3 +1643,22 @@ test!(dep_no_libs { .with_stderr("\ Package `bar v0.0.0 ([..])` has no library targets")); }) + +test!(recompile_space_in_name { + let foo = project("foo") + .file("Cargo.toml", r#" + [package] + name = "foo" + version = "0.0.0" + authors = [] + + [lib] + name = "foo" + path = "src/my lib.rs" + "#) + .file("src/my lib.rs", ""); + assert_that(foo.cargo_process("build"), execs().with_status(0)); + foo.root().move_into_the_past().assert(); + assert_that(foo.process(cargo_dir().join("cargo")).arg("build"), + execs().with_status(0).with_stdout("")); +})