diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2012-09-19 18:00:26 -0700 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2012-09-20 09:48:05 -0700 |
| commit | 9117dcb968f96d0e9391dfac50348d4c031d89b3 (patch) | |
| tree | a571f0c2ef1f91370cae51527f0e0761212a82e7 /src/libsyntax/codemap.rs | |
| parent | 6b670c306b8de545afcbcea81bcd592c644409d7 (diff) | |
| download | rust-9117dcb968f96d0e9391dfac50348d4c031d89b3.tar.gz rust-9117dcb968f96d0e9391dfac50348d4c031d89b3.zip | |
rustc: De-mode all overloaded operators
Diffstat (limited to 'src/libsyntax/codemap.rs')
| -rw-r--r-- | src/libsyntax/codemap.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/libsyntax/codemap.rs b/src/libsyntax/codemap.rs index ab34ed8368c..6340e10429d 100644 --- a/src/libsyntax/codemap.rs +++ b/src/libsyntax/codemap.rs @@ -32,12 +32,21 @@ type filename = ~str; type file_pos = {ch: uint, byte: uint}; +#[cfg(stage0)] impl file_pos: cmp::Eq { pure fn eq(&&other: file_pos) -> bool { self.ch == other.ch && self.byte == other.byte } pure fn ne(&&other: file_pos) -> bool { !self.eq(other) } } +#[cfg(stage1)] +#[cfg(stage2)] +impl file_pos : cmp::Eq { + pure fn eq(other: &file_pos) -> bool { + self.ch == (*other).ch && self.byte == (*other).byte + } + pure fn ne(other: &file_pos) -> bool { !self.eq(other) } +} /* A codemap is a thing that maps uints to file/line/column positions * in a crate. This to make it possible to represent the positions @@ -171,12 +180,21 @@ type expn_info = Option<@expn_info_>; type span = {lo: uint, hi: uint, expn_info: expn_info}; +#[cfg(stage0)] impl span : cmp::Eq { pure fn eq(&&other: span) -> bool { return self.lo == other.lo && self.hi == other.hi; } pure fn ne(&&other: span) -> bool { !self.eq(other) } } +#[cfg(stage1)] +#[cfg(stage2)] +impl span : cmp::Eq { + pure fn eq(other: &span) -> bool { + return self.lo == (*other).lo && self.hi == (*other).hi; + } + pure fn ne(other: &span) -> bool { !self.eq(other) } +} fn span_to_str_no_adj(sp: span, cm: codemap) -> ~str { let lo = lookup_char_pos(cm, sp.lo); |
