From b5590cad79d99ac5653751b4a6f902c45acf18ce Mon Sep 17 00:00:00 2001 From: Hans Kratz Date: Mon, 25 Oct 2021 16:31:05 +0200 Subject: [PATCH 1/3] Only run test on 64-bit little endian architectures. Hash value is different depenidng on bitness and endianess so we only run this test on 64-bit little endian platforms. --- src/cargo/core/source/source_id.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/cargo/core/source/source_id.rs b/src/cargo/core/source/source_id.rs index a1a7e3695d8..3f4a5fd9e37 100644 --- a/src/cargo/core/source/source_id.rs +++ b/src/cargo/core/source/source_id.rs @@ -617,7 +617,13 @@ impl Ord for SourceKind { // you're able to restore the hash to its original value, please do so! // Otherwise please just leave a comment in your PR as to why the hash value is // changing and why the old value can't be easily preserved. +// +// The hash value differs depending on endianess and bit-width since Rust 1.45 +// (see https://github.com/rust-lang/rust/issues/74215). We run this test only +// on 64-bit little-endian platforms which are most commonly used for +// development and tested in CI. #[test] +#[cfg(all(target_endian = "little", target_pointer_width = "64"))] fn test_cratesio_hash() { let config = Config::default().unwrap(); let crates_io = SourceId::crates_io(&config).unwrap(); From d4c524e461f374e0df0549a6da8b1c445eaf3bb2 Mon Sep 17 00:00:00 2001 From: Hans Kratz Date: Mon, 8 Nov 2021 12:11:13 +0100 Subject: [PATCH 2/3] Reword comment. --- src/cargo/core/source/source_id.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/cargo/core/source/source_id.rs b/src/cargo/core/source/source_id.rs index 3f4a5fd9e37..2d6e4e86250 100644 --- a/src/cargo/core/source/source_id.rs +++ b/src/cargo/core/source/source_id.rs @@ -618,10 +618,9 @@ impl Ord for SourceKind { // Otherwise please just leave a comment in your PR as to why the hash value is // changing and why the old value can't be easily preserved. // -// The hash value differs depending on endianess and bit-width since Rust 1.45 -// (see https://github.com/rust-lang/rust/issues/74215). We run this test only -// on 64-bit little-endian platforms which are most commonly used for -// development and tested in CI. +// The hash value depends on endianness and bit-width, so we only run this test on +// little-endian 64-bit CPUs (such as x86-64 and ARM64) where it matches the +// well-known value. #[test] #[cfg(all(target_endian = "little", target_pointer_width = "64"))] fn test_cratesio_hash() { From aa00def843c8b994ce6e0df71a7b5d4bd00b9612 Mon Sep 17 00:00:00 2001 From: Hans Kratz Date: Mon, 8 Nov 2021 13:08:32 +0100 Subject: [PATCH 3/3] fmt --- src/cargo/core/source/source_id.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cargo/core/source/source_id.rs b/src/cargo/core/source/source_id.rs index 2d6e4e86250..2f95e10e839 100644 --- a/src/cargo/core/source/source_id.rs +++ b/src/cargo/core/source/source_id.rs @@ -618,8 +618,8 @@ impl Ord for SourceKind { // Otherwise please just leave a comment in your PR as to why the hash value is // changing and why the old value can't be easily preserved. // -// The hash value depends on endianness and bit-width, so we only run this test on -// little-endian 64-bit CPUs (such as x86-64 and ARM64) where it matches the +// The hash value depends on endianness and bit-width, so we only run this test on +// little-endian 64-bit CPUs (such as x86-64 and ARM64) where it matches the // well-known value. #[test] #[cfg(all(target_endian = "little", target_pointer_width = "64"))]