From 073d99b25d2e656ea053ab8dae03ea921508da76 Mon Sep 17 00:00:00 2001 From: Ben Kimock Date: Tue, 18 Apr 2023 14:13:19 -0400 Subject: [PATCH] Add #[inline] to some new functions Co-authored-by: Camille Gillot --- compiler/rustc_data_structures/src/fingerprint.rs | 2 ++ compiler/rustc_data_structures/src/hashes.rs | 1 + compiler/rustc_span/src/def_id.rs | 1 + 3 files changed, 4 insertions(+) diff --git a/compiler/rustc_data_structures/src/fingerprint.rs b/compiler/rustc_data_structures/src/fingerprint.rs index 1c929afb1cf3..6fa76981408c 100644 --- a/compiler/rustc_data_structures/src/fingerprint.rs +++ b/compiler/rustc_data_structures/src/fingerprint.rs @@ -14,12 +14,14 @@ pub trait FingerprintComponent { } impl FingerprintComponent for Hash64 { + #[inline] fn as_u64(&self) -> u64 { Hash64::as_u64(*self) } } impl FingerprintComponent for u64 { + #[inline] fn as_u64(&self) -> u64 { *self } diff --git a/compiler/rustc_data_structures/src/hashes.rs b/compiler/rustc_data_structures/src/hashes.rs index f32f69122676..ad068cdbc984 100644 --- a/compiler/rustc_data_structures/src/hashes.rs +++ b/compiler/rustc_data_structures/src/hashes.rs @@ -36,6 +36,7 @@ impl Hash64 { } impl BitXorAssign for Hash64 { + #[inline] fn bitxor_assign(&mut self, rhs: u64) { self.inner ^= rhs; } diff --git a/compiler/rustc_span/src/def_id.rs b/compiler/rustc_span/src/def_id.rs index f05328ac1b42..6004009c6ff1 100644 --- a/compiler/rustc_span/src/def_id.rs +++ b/compiler/rustc_span/src/def_id.rs @@ -186,6 +186,7 @@ impl StableCrateId { StableCrateId(hasher.finish()) } + #[inline] pub fn as_u64(self) -> u64 { self.0.as_u64() }