librustc: Fix merge fallout.

This commit is contained in:
Patrick Walton
2013-05-07 11:38:08 -07:00
parent 278b487cab
commit 99daec602f
5 changed files with 29 additions and 17 deletions

View File

@@ -1528,14 +1528,17 @@ pub struct BytesWriter {
impl Writer for BytesWriter { impl Writer for BytesWriter {
fn write(&self, v: &[u8]) { fn write(&self, v: &[u8]) {
let v_len = v.len(); let v_len = v.len();
let bytes_len = vec::uniq_len(&const *self.bytes);
let count = uint::max(bytes_len, *self.pos + v_len); let bytes = &mut *self.bytes;
vec::reserve(&mut *self.bytes, count); let count = uint::max(bytes.len(), *self.pos + v_len);
vec::reserve(bytes, count);
unsafe { unsafe {
vec::raw::set_len(&mut *self.bytes, count); // Silly stage0 borrow check workaround...
let view = vec::mut_slice(*self.bytes, *self.pos, count); 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); vec::bytes::copy_memory(view, v, v_len);
} }

View File

@@ -457,7 +457,7 @@ impl TyVisitor for ReprVisitor {
let disr = unsafe { let disr = unsafe {
get_disr(transmute(*self.ptr)) get_disr(transmute(*self.ptr))
}; };
self.var_stk.push(SearchingFor(disr)); var_stk.push(SearchingFor(disr));
true true
} }
@@ -494,7 +494,7 @@ impl TyVisitor for ReprVisitor {
_offset: uint, _offset: uint,
inner: *TyDesc) inner: *TyDesc)
-> bool { -> 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 => { Matched => {
if i != 0 { if i != 0 {
self.writer.write_str(", "); self.writer.write_str(", ");
@@ -530,7 +530,7 @@ impl TyVisitor for ReprVisitor {
_align: uint) _align: uint)
-> bool { -> bool {
let var_stk: &mut ~[VariantState] = self.var_stk; let var_stk: &mut ~[VariantState] = self.var_stk;
match self.var_stk.pop() { match var_stk.pop() {
SearchingFor(*) => fail!(~"enum value matched no variant"), SearchingFor(*) => fail!(~"enum value matched no variant"),
_ => true _ => true
} }

View File

@@ -4718,7 +4718,7 @@ pub impl Resolver {
for vec::each(class_def.fields) |field| { for vec::each(class_def.fields) |field| {
match field.node.kind { match field.node.kind {
unnamed_field => {}, unnamed_field => {},
named_field(ident, _, _) => { named_field(ident, _) => {
if str::eq_slice(*this.session.str_of(ident), if str::eq_slice(*this.session.str_of(ident),
name) { name) {
return true return true

View File

@@ -28,6 +28,13 @@ use core::pipes::recv;
use core::task; use core::task;
#[doc = "The future type"] #[doc = "The future type"]
#[cfg(stage0)]
pub struct Future<A> {
priv mut state: FutureState<A>,
}
#[doc = "The future type"]
#[cfg(not(stage0))]
pub struct Future<A> { pub struct Future<A> {
priv state: FutureState<A>, priv state: FutureState<A>,
} }

View File

@@ -902,8 +902,10 @@ impl io::Reader for TcpSocketBuf {
// need to read in data from the socket. Note that the internal // need to read in data from the socket. Note that the internal
// buffer is of no use anymore as we read all bytes from it, // buffer is of no use anymore as we read all bytes from it,
// so we can throw it away. // so we can throw it away.
let data = &*self.data; let read_result = {
let read_result = read(&data.sock, 0u); let data = &*self.data;
read(&data.sock, 0)
};
if read_result.is_err() { if read_result.is_err() {
let err_data = read_result.get_err(); let err_data = read_result.get_err();
@@ -918,8 +920,7 @@ impl io::Reader for TcpSocketBuf {
// should show up in a later call to read(). // should show up in a later call to read().
break; break;
} }
} } else {
else {
self.data.buf = result::unwrap(read_result); self.data.buf = result::unwrap(read_result);
self.data.buf_off = 0; self.data.buf_off = 0;
} }
@@ -935,8 +936,10 @@ impl io::Reader for TcpSocketBuf {
return c as int return c as int
} }
let data = &*self.data; let read_result = {
let read_result = read(&data.sock, 0u); let data = &*self.data;
read(&data.sock, 0)
};
if read_result.is_err() { if read_result.is_err() {
let err_data = read_result.get_err(); let err_data = read_result.get_err();
@@ -948,8 +951,7 @@ impl io::Reader for TcpSocketBuf {
err_data.err_name, err_data.err_msg); err_data.err_name, err_data.err_msg);
fail!() fail!()
} }
} } else {
else {
self.data.buf = result::unwrap(read_result); self.data.buf = result::unwrap(read_result);
self.data.buf_off = 0; self.data.buf_off = 0;
} }