about summary refs log tree commit diff
path: root/compiler/rustc_data_structures/src
diff options
context:
space:
mode:
authorBen Kimock <kimockb@gmail.com>2023-04-30 14:28:30 -0400
committerBen Kimock <kimockb@gmail.com>2023-04-30 14:28:30 -0400
commit3c6d9ec77d00eeb7e20d5f28dff684a0cabe21eb (patch)
treeadbe1c4167a440be835df201c0897612bdc1321a /compiler/rustc_data_structures/src
parent43a78029b4f4d92978b8fde0a677ea300b113c41 (diff)
downloadrust-3c6d9ec77d00eeb7e20d5f28dff684a0cabe21eb.tar.gz
rust-3c6d9ec77d00eeb7e20d5f28dff684a0cabe21eb.zip
Use the full Fingerprint when stringifying Svh
Diffstat (limited to 'compiler/rustc_data_structures/src')
-rw-r--r--compiler/rustc_data_structures/src/fingerprint.rs5
-rw-r--r--compiler/rustc_data_structures/src/svh.rs10
2 files changed, 10 insertions, 5 deletions
diff --git a/compiler/rustc_data_structures/src/fingerprint.rs b/compiler/rustc_data_structures/src/fingerprint.rs
index 6fa76981408..9995c08345c 100644
--- a/compiler/rustc_data_structures/src/fingerprint.rs
+++ b/compiler/rustc_data_structures/src/fingerprint.rs
@@ -64,6 +64,11 @@ impl Fingerprint {
         )
     }
 
+    #[inline]
+    pub(crate) fn as_u128(self) -> u128 {
+        u128::from(self.1) << 64 | u128::from(self.0)
+    }
+
     // Combines two hashes in an order independent way. Make sure this is what
     // you want.
     #[inline]
diff --git a/compiler/rustc_data_structures/src/svh.rs b/compiler/rustc_data_structures/src/svh.rs
index a3d2724fcdb..71679086f16 100644
--- a/compiler/rustc_data_structures/src/svh.rs
+++ b/compiler/rustc_data_structures/src/svh.rs
@@ -23,18 +23,18 @@ impl Svh {
         Svh { hash }
     }
 
-    pub fn as_u64(&self) -> u64 {
-        self.hash.to_smaller_hash().as_u64()
+    pub fn as_u128(self) -> u128 {
+        self.hash.as_u128()
     }
 
-    pub fn to_string(&self) -> String {
-        format!("{:016x}", self.hash.to_smaller_hash())
+    pub fn to_hex(self) -> String {
+        format!("{:032x}", self.hash.as_u128())
     }
 }
 
 impl fmt::Display for Svh {
     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
-        f.pad(&self.to_string())
+        f.pad(&self.to_hex())
     }
 }