Skip to content

Commit

Permalink
Inline Span methods.
Browse files Browse the repository at this point in the history
Because they are simple and hot.

This change speeds up some incremental runs of a few rustc-perf
benchmarks, the best by 3%.
  • Loading branch information
nnethercote committed May 9, 2018
1 parent f9bfe84 commit 77c40f8
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/libsyntax_pos/span_encoding.rs
Expand Up @@ -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;
Expand All @@ -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)
Expand Down

0 comments on commit 77c40f8

Please sign in to comment.