diff --git a/src/cargo/core/source_id.rs b/src/cargo/core/source_id.rs index a4b7e5e76505..ca022c936590 100644 --- a/src/cargo/core/source_id.rs +++ b/src/cargo/core/source_id.rs @@ -789,16 +789,6 @@ mod tests { // The hash value should be stable across platforms, and doesn't depend on // endianness and bit-width. #[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; @@ -809,6 +799,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();