diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2013-05-07 11:38:08 -0700 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2013-05-08 17:04:00 -0700 |
| commit | 99daec602fc8fa4612320c7c1babe6ae8717759c (patch) | |
| tree | 472ee0fe27d7d50f48d58b2e60339180c07848df /src/libcore | |
| parent | 278b487cabcbe52b301a8023cd1362045b1a7132 (diff) | |
librustc: Fix merge fallout.
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/io.rs | 13 | ||||
| -rw-r--r-- | src/libcore/repr.rs | 6 |
2 files changed, 11 insertions, 8 deletions
diff --git a/src/libcore/io.rs b/src/libcore/io.rs index 63335f7e952..a00de5ff311 100644 --- a/src/libcore/io.rs +++ b/src/libcore/io.rs @@ -1528,14 +1528,17 @@ pub struct BytesWriter { impl Writer for BytesWriter { fn write(&self, v: &[u8]) { let v_len = v.len(); - let bytes_len = vec::uniq_len(&const *self.bytes); - let count = uint::max(bytes_len, *self.pos + v_len); - vec::reserve(&mut *self.bytes, count); + let bytes = &mut *self.bytes; + let count = uint::max(bytes.len(), *self.pos + v_len); + vec::reserve(bytes, count); unsafe { - vec::raw::set_len(&mut *self.bytes, count); - let view = vec::mut_slice(*self.bytes, *self.pos, count); + // Silly stage0 borrow check workaround... + let casted: &mut ~[u8] = cast::transmute_copy(&bytes); + vec::raw::set_len(casted, count); + + let view = vec::mut_slice(*bytes, *self.pos, count); vec::bytes::copy_memory(view, v, v_len); } diff --git a/src/libcore/repr.rs b/src/libcore/repr.rs index c7e20d2b21f..a645a7e8680 100644 --- a/src/libcore/repr.rs +++ b/src/libcore/repr.rs @@ -457,7 +457,7 @@ impl TyVisitor for ReprVisitor { let disr = unsafe { get_disr(transmute(*self.ptr)) }; - self.var_stk.push(SearchingFor(disr)); + var_stk.push(SearchingFor(disr)); true } @@ -494,7 +494,7 @@ impl TyVisitor for ReprVisitor { _offset: uint, inner: *TyDesc) -> bool { - match self.var_stk[vec::uniq_len(&const self.var_stk) - 1] { + match self.var_stk[vec::uniq_len(&const *self.var_stk) - 1] { Matched => { if i != 0 { self.writer.write_str(", "); @@ -530,7 +530,7 @@ impl TyVisitor for ReprVisitor { _align: uint) -> bool { let var_stk: &mut ~[VariantState] = self.var_stk; - match self.var_stk.pop() { + match var_stk.pop() { SearchingFor(*) => fail!(~"enum value matched no variant"), _ => true } |
