diff options
| author | Jorge Aparicio <japaricious@gmail.com> | 2014-12-31 15:45:13 -0500 |
|---|---|---|
| committer | Jorge Aparicio <japaricious@gmail.com> | 2015-01-03 16:29:19 -0500 |
| commit | 99017f82b6e41ed283199b88ddfc0990bb95d696 (patch) | |
| tree | 66cd460eb70ab440425b66bb81651820c1d58469 /src/libsyntax | |
| parent | 7095dd00702373dd612d61e191eb57fadce00751 (diff) | |
| download | rust-99017f82b6e41ed283199b88ddfc0990bb95d696.tar.gz rust-99017f82b6e41ed283199b88ddfc0990bb95d696.zip | |
use assoc types in binop traits
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/codemap.rs | 16 | ||||
| -rw-r--r-- | src/libsyntax/ext/tt/transcribe.rs | 4 |
2 files changed, 15 insertions, 5 deletions
diff --git a/src/libsyntax/codemap.rs b/src/libsyntax/codemap.rs index 5eac6546c6b..eb011faa55d 100644 --- a/src/libsyntax/codemap.rs +++ b/src/libsyntax/codemap.rs @@ -53,13 +53,17 @@ impl Pos for BytePos { fn to_uint(&self) -> uint { let BytePos(n) = *self; n as uint } } -impl Add<BytePos, BytePos> for BytePos { +impl Add for BytePos { + type Output = BytePos; + fn add(self, rhs: BytePos) -> BytePos { BytePos((self.to_uint() + rhs.to_uint()) as u32) } } -impl Sub<BytePos, BytePos> for BytePos { +impl Sub for BytePos { + type Output = BytePos; + fn sub(self, rhs: BytePos) -> BytePos { BytePos((self.to_uint() - rhs.to_uint()) as u32) } @@ -70,13 +74,17 @@ impl Pos for CharPos { fn to_uint(&self) -> uint { let CharPos(n) = *self; n } } -impl Add<CharPos, CharPos> for CharPos { +impl Add for CharPos { + type Output = CharPos; + fn add(self, rhs: CharPos) -> CharPos { CharPos(self.to_uint() + rhs.to_uint()) } } -impl Sub<CharPos, CharPos> for CharPos { +impl Sub for CharPos { + type Output = CharPos; + fn sub(self, rhs: CharPos) -> CharPos { CharPos(self.to_uint() - rhs.to_uint()) } diff --git a/src/libsyntax/ext/tt/transcribe.rs b/src/libsyntax/ext/tt/transcribe.rs index deed0b78e87..8af5e952e9a 100644 --- a/src/libsyntax/ext/tt/transcribe.rs +++ b/src/libsyntax/ext/tt/transcribe.rs @@ -106,7 +106,9 @@ enum LockstepIterSize { LisContradiction(String), } -impl Add<LockstepIterSize, LockstepIterSize> for LockstepIterSize { +impl Add for LockstepIterSize { + type Output = LockstepIterSize; + fn add(self, other: LockstepIterSize) -> LockstepIterSize { match self { LisUnconstrained => other, |
