diff options
| author | Brian Anderson <banderson@mozilla.com> | 2013-11-01 18:06:31 -0700 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2014-01-04 14:44:12 -0800 |
| commit | 3b1862a82f04f8f5bcb197715d2ff506c6cdecc3 (patch) | |
| tree | 0057a02e6d56e9bea0357d649a420b6e66b5be71 /src/libsyntax | |
| parent | 18cef3fad47f90c6c5ec1f2ad4dbc12b86b7ee7e (diff) | |
| download | rust-3b1862a82f04f8f5bcb197715d2ff506c6cdecc3.tar.gz rust-3b1862a82f04f8f5bcb197715d2ff506c6cdecc3.zip | |
Don't allow newtype structs to be dereferenced. #6246
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/codemap.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/libsyntax/codemap.rs b/src/libsyntax/codemap.rs index c0aee7fc634..8f5c4904c78 100644 --- a/src/libsyntax/codemap.rs +++ b/src/libsyntax/codemap.rs @@ -46,35 +46,35 @@ pub struct CharPos(uint); impl Pos for BytePos { fn from_uint(n: uint) -> BytePos { BytePos(n as u32) } - fn to_uint(&self) -> uint { **self as uint } + fn to_uint(&self) -> uint { let BytePos(n) = *self; n as uint } } impl Add<BytePos, BytePos> for BytePos { fn add(&self, rhs: &BytePos) -> BytePos { - BytePos(**self + **rhs) + BytePos((self.to_uint() + rhs.to_uint()) as u32) } } impl Sub<BytePos, BytePos> for BytePos { fn sub(&self, rhs: &BytePos) -> BytePos { - BytePos(**self - **rhs) + BytePos((self.to_uint() - rhs.to_uint()) as u32) } } impl Pos for CharPos { fn from_uint(n: uint) -> CharPos { CharPos(n) } - fn to_uint(&self) -> uint { **self } + fn to_uint(&self) -> uint { let CharPos(n) = *self; n } } impl Add<CharPos,CharPos> for CharPos { fn add(&self, rhs: &CharPos) -> CharPos { - CharPos(**self + **rhs) + CharPos(self.to_uint() + rhs.to_uint()) } } impl Sub<CharPos,CharPos> for CharPos { fn sub(&self, rhs: &CharPos) -> CharPos { - CharPos(**self - **rhs) + CharPos(self.to_uint() - rhs.to_uint()) } } |
