From 77c40f8c6f8cc472f6438f7724d60bf3b7718a0c Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Wed, 9 May 2018 15:25:44 +1000 Subject: [PATCH] Inline `Span` methods. Because they are simple and hot. This change speeds up some incremental runs of a few rustc-perf benchmarks, the best by 3%. --- src/libsyntax_pos/span_encoding.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/libsyntax_pos/span_encoding.rs b/src/libsyntax_pos/span_encoding.rs index b55fe4bcb2672..601a0273ae911 100644 --- a/src/libsyntax_pos/span_encoding.rs +++ b/src/libsyntax_pos/span_encoding.rs @@ -31,11 +31,13 @@ pub struct Span(u32); impl Copy for Span {} impl Clone for Span { + #[inline] fn clone(&self) -> Span { *self } } impl PartialEq for Span { + #[inline] fn eq(&self, other: &Span) -> bool { let a = self.0; let b = other.0; @@ -44,6 +46,7 @@ impl PartialEq for Span { } impl Eq for Span {} impl Hash for Span { + #[inline] fn hash(&self, state: &mut H) { let a = self.0; a.hash(state)