libcore: Remove more mutable fields from comm

This commit is contained in:
Patrick Walton
2013-05-03 17:37:08 -07:00
parent 8919f32f83
commit d12d25534b
4 changed files with 114 additions and 73 deletions

View File

@@ -29,13 +29,13 @@ pub impl BufReader {
// I can't get the borrowing to work correctly
let bytes_reader = BytesReader {
bytes: ::core::util::id::<&[u8]>(self.buf),
pos: *self.pos
pos: @mut *self.pos
};
let res = f(&bytes_reader);
// FIXME #4429: This isn't correct if f fails
*self.pos = bytes_reader.pos;
*self.pos = *bytes_reader.pos;
return res;
}