Skip to content

Commit 8610973

Browse files
committed
Auto merge of #6514 - ehuss:beta-fingerprint-patch, r=alexcrichton
[BETA] Fix fingerprint calculation for patched deps. Backport of #6493. Also includes the following to pass CI: - #6417 - Bump min version in CI for `trim_end`.
2 parents 1b6702f + 0b55e9e commit 8610973

File tree

5 files changed

+63
-10
lines changed

5 files changed

+63
-10
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ matrix:
3636
# increased every 6 weeks or so when the first PR to use a new feature.
3737
- env: TARGET=x86_64-unknown-linux-gnu
3838
ALT=i686-unknown-linux-gnu
39-
rust: 1.28.0
39+
rust: 1.31.0
4040
script:
4141
- rustup toolchain install nightly
4242
- cargo +nightly generate-lockfile -Z minimal-versions

appveyor.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ install:
1111
- appveyor-retry appveyor DownloadFile https://win.rustup.rs/ -FileName rustup-init.exe
1212
- rustup-init.exe -y --default-host x86_64-pc-windows-msvc --default-toolchain nightly
1313
- set PATH=%PATH%;C:\Users\appveyor\.cargo\bin
14-
- if defined MINIMAL_VERSIONS rustup toolchain install 1.28.0
14+
- if defined MINIMAL_VERSIONS rustup toolchain install 1.31.0
1515
- if defined OTHER_TARGET rustup target add %OTHER_TARGET%
1616
- rustc -V
1717
- cargo -V
@@ -25,5 +25,5 @@ test_script:
2525
# we don't have ci time to run the full `cargo test` with `minimal-versions` like
2626
# - if defined MINIMAL_VERSIONS cargo +nightly generate-lockfile -Z minimal-versions && cargo +stable test
2727
# so we just run `cargo check --tests` like
28-
- if defined MINIMAL_VERSIONS cargo +nightly generate-lockfile -Z minimal-versions && cargo +1.28.0 check --tests
28+
- if defined MINIMAL_VERSIONS cargo +nightly generate-lockfile -Z minimal-versions && cargo +1.31.0 check --tests
2929
- if NOT defined MINIMAL_VERSIONS cargo test

src/cargo/core/compiler/custom_build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ impl BuildOutput {
466466
let key = iter.next();
467467
let value = iter.next();
468468
let (key, value) = match (key, value) {
469-
(Some(a), Some(b)) => (a, b.trim_right()),
469+
(Some(a), Some(b)) => (a, b.trim_end()),
470470
// line started with `cargo:` but didn't match `key=value`
471471
_ => bail!("Wrong output in {}: `{}`", whence, line),
472472
};

src/cargo/core/compiler/fingerprint.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,6 @@ struct MtimeSlot(Mutex<Option<FileTime>>);
228228

229229
impl Fingerprint {
230230
fn update_local(&self, root: &Path) -> CargoResult<()> {
231-
let mut hash_busted = false;
232231
for local in self.local.iter() {
233232
match *local {
234233
LocalFingerprint::MtimeBased(ref slot, ref path) => {
@@ -238,12 +237,9 @@ impl Fingerprint {
238237
}
239238
LocalFingerprint::EnvBased(..) | LocalFingerprint::Precalculated(..) => continue,
240239
}
241-
hash_busted = true;
242240
}
243241

244-
if hash_busted {
245-
*self.memoized_hash.lock().unwrap() = None;
246-
}
242+
*self.memoized_hash.lock().unwrap() = None;
247243
Ok(())
248244
}
249245

tests/testsuite/freshness.rs

Lines changed: 58 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use std::io::prelude::*;
44
use support::paths::CargoPathExt;
55
use support::registry::Package;
66
use support::sleep_ms;
7-
use support::{basic_manifest, project};
7+
use support::{basic_manifest, is_coarse_mtime, project};
88

99
#[test]
1010
fn modifying_and_moving() {
@@ -1177,3 +1177,60 @@ fn reuse_panic_pm() {
11771177
)
11781178
.run();
11791179
}
1180+
1181+
#[test]
1182+
fn bust_patched_dep() {
1183+
Package::new("registry1", "0.1.0").publish();
1184+
Package::new("registry2", "0.1.0")
1185+
.dep("registry1", "0.1.0")
1186+
.publish();
1187+
1188+
let p = project()
1189+
.file(
1190+
"Cargo.toml",
1191+
r#"
1192+
[package]
1193+
name = "foo"
1194+
version = "0.0.1"
1195+
1196+
[dependencies]
1197+
registry2 = "0.1.0"
1198+
1199+
[patch.crates-io]
1200+
registry1 = { path = "reg1new" }
1201+
"#,
1202+
)
1203+
.file("src/lib.rs", "")
1204+
.file("reg1new/Cargo.toml", &basic_manifest("registry1", "0.1.0"))
1205+
.file("reg1new/src/lib.rs", "")
1206+
.build();
1207+
1208+
p.cargo("build").run();
1209+
1210+
File::create(&p.root().join("reg1new/src/lib.rs")).unwrap();
1211+
if is_coarse_mtime() {
1212+
sleep_ms(1000);
1213+
}
1214+
1215+
p.cargo("build")
1216+
.with_stderr(
1217+
"\
1218+
[COMPILING] registry1 v0.1.0 ([..])
1219+
[COMPILING] registry2 v0.1.0
1220+
[COMPILING] foo v0.0.1 ([..])
1221+
[FINISHED] [..]
1222+
",
1223+
)
1224+
.run();
1225+
1226+
p.cargo("build -v")
1227+
.with_stderr(
1228+
"\
1229+
[FRESH] registry1 v0.1.0 ([..])
1230+
[FRESH] registry2 v0.1.0
1231+
[FRESH] foo v0.0.1 ([..])
1232+
[FINISHED] [..]
1233+
",
1234+
)
1235+
.run();
1236+
}

0 commit comments

Comments
 (0)