diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2013-03-26 15:04:30 -0400 |
|---|---|---|
| committer | Niko Matsakis <niko@alum.mit.edu> | 2013-03-27 13:04:03 -0400 |
| commit | 069529bc5cc14f63035609cdfae5b21ca7999d4b (patch) | |
| tree | b3050a72dd53e3f5cd950cbd37dff6ee25b1ec0b /src/libstd | |
| parent | 2c17ff7dbc667a7d579b02b86d4c08a1093683fd (diff) | |
| download | rust-069529bc5cc14f63035609cdfae5b21ca7999d4b.tar.gz rust-069529bc5cc14f63035609cdfae5b21ca7999d4b.zip | |
Autoref the argument to the index operator (#4920)
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/bitv.rs | 10 | ||||
| -rw-r--r-- | src/libstd/ebml.rs | 8 |
2 files changed, 9 insertions, 9 deletions
diff --git a/src/libstd/bitv.rs b/src/libstd/bitv.rs index 3acc95a3aad..8bac0fed3c9 100644 --- a/src/libstd/bitv.rs +++ b/src/libstd/bitv.rs @@ -437,7 +437,8 @@ pub impl Bitv { if offset >= bitv.nbits { 0 } else { - bitv[offset] as u8 << (7 - bit) + // NOTE cannot use bitv[offset] until snapshot + bitv.index(&offset) as u8 << (7 - bit) } } @@ -459,7 +460,8 @@ pub impl Bitv { * Transform self into a [bool] by turning each bit into a bool */ fn to_bools(&self) -> ~[bool] { - vec::from_fn(self.nbits, |i| self[i]) + // NOTE cannot use self[i] until snapshot + vec::from_fn(self.nbits, |i| self.index(&i)) } /** @@ -555,8 +557,8 @@ pub fn from_fn(len: uint, f: &fn(index: uint) -> bool) -> Bitv { } impl ops::Index<uint,bool> for Bitv { - fn index(&self, i: uint) -> bool { - self.get(i) + fn index(&self, i: &uint) -> bool { + self.get(*i) } } diff --git a/src/libstd/ebml.rs b/src/libstd/ebml.rs index 92898af2993..b82616d386a 100644 --- a/src/libstd/ebml.rs +++ b/src/libstd/ebml.rs @@ -68,11 +68,9 @@ pub mod reader { // ebml reading - impl ops::Index<uint,Doc> for Doc { - fn index(&self, tag: uint) -> Doc { - unsafe { - get_doc(*self, tag) - } + pub impl Doc { + fn get(&self, tag: uint) -> Doc { + get_doc(*self, tag) } } |
