about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNicholas Nethercote <nnethercote@mozilla.com>2018-05-09 15:25:44 +1000
committerNicholas Nethercote <nnethercote@mozilla.com>2018-05-09 20:14:03 +1000
commit77c40f8c6f8cc472f6438f7724d60bf3b7718a0c (patch)
tree0f50dfa2ae0cf6a9c30ec207cfe7cace9b16a536
parentf9bfe840f41d00e9712f13fbc635ec3fbe95e8c4 (diff)
downloadrust-77c40f8c6f8cc472f6438f7724d60bf3b7718a0c.tar.gz
rust-77c40f8c6f8cc472f6438f7724d60bf3b7718a0c.zip
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%.
-rw-r--r--src/libsyntax_pos/span_encoding.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/libsyntax_pos/span_encoding.rs b/src/libsyntax_pos/span_encoding.rs
index b55fe4bcb26..601a0273ae9 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<H: Hasher>(&self, state: &mut H) {
         let a = self.0;
         a.hash(state)