about summary refs log tree commit diff
path: root/compiler/rustc_data_structures/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-05-04 13:44:38 +0000
committerbors <bors@rust-lang.org>2023-05-04 13:44:38 +0000
commiteac35583d2ffb5ed9e564dee0822c9a244058ee0 (patch)
tree1b4e010fb54cdbf7796655e36da371d6f378bb20 /compiler/rustc_data_structures/src
parent6f8c0557e0b73c73a8a7163a15f4a5a3feca7d5c (diff)
parentb4d992fec740dc9a6ff42a0500026fe5b25db74a (diff)
downloadrust-eac35583d2ffb5ed9e564dee0822c9a244058ee0.tar.gz
rust-eac35583d2ffb5ed9e564dee0822c9a244058ee0.zip
Auto merge of #111174 - matthiaskrgr:rollup-ncnqivh, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #110859 (Explicitly reject negative and reservation drop impls)
 - #111020 (Validate resolution for SelfCtor too.)
 - #111024 (Use the full Fingerprint when stringifying Svh)
 - #111027 (Remove `allow(rustc::potential_query_instability)` for `builtin_macros`)
 - #111039 (Encode def span for foreign return-position `impl Trait` in trait)
 - #111070 (Don't suffix `RibKind` variants)
 - #111094 (Add needs-unwind annotations to tests that need stack unwinding)
 - #111103 (correctly recurse when expanding anon consts)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
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())
     }
 }