Skip to content

Commit d4904c6

Browse files
committed
---
yaml --- r: 60108 b: refs/heads/master c: 92d2ec4 h: refs/heads/master v: v3
1 parent af29883 commit d4904c6

File tree

3 files changed

+16
-14
lines changed

3 files changed

+16
-14
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: da2ac908126ec52e60e621416ce84284e7b77e51
2+
refs/heads/master: 92d2ec4d32c7f7722569b1463cba31c6402f7513
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 2d28d645422c1617be58c8ca7ad9a457264ca850
55
refs/heads/try: c50a9d5b664478e533ba1d1d353213d70c8ad589

trunk/src/libstd/flatpipes.rs

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -558,9 +558,11 @@ pub mod bytepipes {
558558
}
559559
}
560560
561+
// XXX: Remove `@mut` when this module is ported to the new I/O traits,
562+
// which use `&mut self` properly.
561563
pub struct PipeBytePort {
562564
port: comm::Port<~[u8]>,
563-
mut buf: ~[u8]
565+
buf: @mut ~[u8]
564566
}
565567
566568
pub struct PipeByteChan {
@@ -569,13 +571,13 @@ pub mod bytepipes {
569571
570572
impl BytePort for PipeBytePort {
571573
fn try_recv(&self, count: uint) -> Option<~[u8]> {
572-
if vec::uniq_len(&const self.buf) >= count {
573-
let mut bytes = ::core::util::replace(&mut self.buf, ~[]);
574-
self.buf = bytes.slice(count, bytes.len()).to_owned();
574+
if vec::uniq_len(&const *self.buf) >= count {
575+
let mut bytes = ::core::util::replace(&mut *self.buf, ~[]);
576+
*self.buf = bytes.slice(count, bytes.len()).to_owned();
575577
bytes.truncate(count);
576578
return Some(bytes);
577-
} else if vec::uniq_len(&const self.buf) > 0 {
578-
let mut bytes = ::core::util::replace(&mut self.buf, ~[]);
579+
} else if vec::uniq_len(&const *self.buf) > 0 {
580+
let mut bytes = ::core::util::replace(&mut *self.buf, ~[]);
579581
assert!(count > bytes.len());
580582
match self.try_recv(count - bytes.len()) {
581583
Some(rest) => {
@@ -584,11 +586,11 @@ pub mod bytepipes {
584586
}
585587
None => return None
586588
}
587-
} else if vec::uniq_len(&const self.buf) == 0 {
589+
} else if vec::uniq_len(&const *self.buf) == 0 {
588590
match self.port.try_recv() {
589591
Some(buf) => {
590592
assert!(!buf.is_empty());
591-
self.buf = buf;
593+
*self.buf = buf;
592594
return self.try_recv(count);
593595
}
594596
None => return None
@@ -609,7 +611,7 @@ pub mod bytepipes {
609611
fn new(p: Port<~[u8]>) -> PipeBytePort {
610612
PipeBytePort {
611613
port: p,
612-
buf: ~[]
614+
buf: @mut ~[]
613615
}
614616
}
615617
}

trunk/src/libstd/io_util.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ use core::io;
1313

1414
pub struct BufReader {
1515
buf: ~[u8],
16-
mut pos: uint
16+
pos: @mut uint
1717
}
1818

1919
pub impl BufReader {
2020
pub fn new(v: ~[u8]) -> BufReader {
2121
BufReader {
2222
buf: v,
23-
pos: 0
23+
pos: @mut 0
2424
}
2525
}
2626

@@ -29,13 +29,13 @@ pub impl BufReader {
2929
// I can't get the borrowing to work correctly
3030
let bytes_reader = BytesReader {
3131
bytes: ::core::util::id::<&[u8]>(self.buf),
32-
pos: self.pos
32+
pos: *self.pos
3333
};
3434

3535
let res = f(&bytes_reader);
3636

3737
// FIXME #4429: This isn't correct if f fails
38-
self.pos = bytes_reader.pos;
38+
*self.pos = bytes_reader.pos;
3939

4040
return res;
4141
}

0 commit comments

Comments
 (0)