diff --git a/src/cargo/core/source_id.rs b/src/cargo/core/source_id.rs index 59f7683a3ec3..f7033e86aaf1 100644 --- a/src/cargo/core/source_id.rs +++ b/src/cargo/core/source_id.rs @@ -792,16 +792,6 @@ mod tests { // the prefix components (e.g. `C:`), there is not way to have a // cross-platform stable hash for absolute paths. #[test] - fn test_cratesio_hash() { - let gctx = GlobalContext::default().unwrap(); - let crates_io = SourceId::crates_io(&gctx).unwrap(); - assert_eq!(crate::util::hex::short_hash(&crates_io), "83d63c3e13aca8cc"); - } - - // See the comment in `test_cratesio_hash`. - // - // Only test on non-Windows as paths on Windows will get different hashes. - #[test] fn test_stable_hash() { use crate::util::StableHasher; use std::path::Path; @@ -817,6 +807,10 @@ mod tests { hasher.finish() }; + let source_id = SourceId::crates_io(&GlobalContext::default().unwrap()).unwrap(); + assert_eq!(gen_hash(source_id), 14747226178473219715); + assert_eq!(crate::util::hex::short_hash(&source_id), "83d63c3e13aca8cc"); + let url = "https://my-crates.io".into_url().unwrap(); let source_id = SourceId::for_registry(&url).unwrap(); assert_eq!(gen_hash(source_id), 2056262832525457700); diff --git a/src/cargo/sources/registry/mod.rs b/src/cargo/sources/registry/mod.rs index ff852b134fb8..d8cdbd6410be 100644 --- a/src/cargo/sources/registry/mod.rs +++ b/src/cargo/sources/registry/mod.rs @@ -456,7 +456,7 @@ fn short_name(id: SourceId, is_shallow: bool) -> String { // CAUTION: This should not change between versions. If you change how // this is computed, it will orphan previously cached data, forcing the // cache to be rebuilt and potentially wasting significant disk space. If - // you change it, be cautious of the impact. See `test_cratesio_hash` for + // you change it, be cautious of the impact. See `test_stable_hash` for // a similar discussion. let hash = hex::short_hash(&id); let ident = id.url().host_str().unwrap_or("").to_string();