Skip to content

Commit 49ef165

Browse files
committed
librustc: Fix merge fallout.
1 parent ebb28c2 commit 49ef165

File tree

5 files changed

+29
-17
lines changed

5 files changed

+29
-17
lines changed

src/libcore/io.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1528,14 +1528,17 @@ pub struct BytesWriter {
15281528
impl Writer for BytesWriter {
15291529
fn write(&self, v: &[u8]) {
15301530
let v_len = v.len();
1531-
let bytes_len = vec::uniq_len(&const *self.bytes);
15321531
1533-
let count = uint::max(bytes_len, *self.pos + v_len);
1534-
vec::reserve(&mut *self.bytes, count);
1532+
let bytes = &mut *self.bytes;
1533+
let count = uint::max(bytes.len(), *self.pos + v_len);
1534+
vec::reserve(bytes, count);
15351535
15361536
unsafe {
1537-
vec::raw::set_len(&mut *self.bytes, count);
1538-
let view = vec::mut_slice(*self.bytes, *self.pos, count);
1537+
// Silly stage0 borrow check workaround...
1538+
let casted: &mut ~[u8] = cast::transmute_copy(&bytes);
1539+
vec::raw::set_len(casted, count);
1540+
1541+
let view = vec::mut_slice(*bytes, *self.pos, count);
15391542
vec::bytes::copy_memory(view, v, v_len);
15401543
}
15411544

src/libcore/repr.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ impl TyVisitor for ReprVisitor {
457457
let disr = unsafe {
458458
get_disr(transmute(*self.ptr))
459459
};
460-
self.var_stk.push(SearchingFor(disr));
460+
var_stk.push(SearchingFor(disr));
461461
true
462462
}
463463

@@ -494,7 +494,7 @@ impl TyVisitor for ReprVisitor {
494494
_offset: uint,
495495
inner: *TyDesc)
496496
-> bool {
497-
match self.var_stk[vec::uniq_len(&const self.var_stk) - 1] {
497+
match self.var_stk[vec::uniq_len(&const *self.var_stk) - 1] {
498498
Matched => {
499499
if i != 0 {
500500
self.writer.write_str(", ");
@@ -530,7 +530,7 @@ impl TyVisitor for ReprVisitor {
530530
_align: uint)
531531
-> bool {
532532
let var_stk: &mut ~[VariantState] = self.var_stk;
533-
match self.var_stk.pop() {
533+
match var_stk.pop() {
534534
SearchingFor(*) => fail!(~"enum value matched no variant"),
535535
_ => true
536536
}

src/librustc/middle/resolve_stage0.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4718,7 +4718,7 @@ pub impl Resolver {
47184718
for vec::each(class_def.fields) |field| {
47194719
match field.node.kind {
47204720
unnamed_field => {},
4721-
named_field(ident, _, _) => {
4721+
named_field(ident, _) => {
47224722
if str::eq_slice(*this.session.str_of(ident),
47234723
name) {
47244724
return true

src/libstd/future.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,13 @@ use core::pipes::recv;
2828
use core::task;
2929

3030
#[doc = "The future type"]
31+
#[cfg(stage0)]
32+
pub struct Future<A> {
33+
priv mut state: FutureState<A>,
34+
}
35+
36+
#[doc = "The future type"]
37+
#[cfg(not(stage0))]
3138
pub struct Future<A> {
3239
priv state: FutureState<A>,
3340
}

src/libstd/net_tcp.rs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -902,8 +902,10 @@ impl io::Reader for TcpSocketBuf {
902902
// need to read in data from the socket. Note that the internal
903903
// buffer is of no use anymore as we read all bytes from it,
904904
// so we can throw it away.
905-
let data = &*self.data;
906-
let read_result = read(&data.sock, 0u);
905+
let read_result = {
906+
let data = &*self.data;
907+
read(&data.sock, 0)
908+
};
907909
if read_result.is_err() {
908910
let err_data = read_result.get_err();
909911

@@ -918,8 +920,7 @@ impl io::Reader for TcpSocketBuf {
918920
// should show up in a later call to read().
919921
break;
920922
}
921-
}
922-
else {
923+
} else {
923924
self.data.buf = result::unwrap(read_result);
924925
self.data.buf_off = 0;
925926
}
@@ -935,8 +936,10 @@ impl io::Reader for TcpSocketBuf {
935936
return c as int
936937
}
937938

938-
let data = &*self.data;
939-
let read_result = read(&data.sock, 0u);
939+
let read_result = {
940+
let data = &*self.data;
941+
read(&data.sock, 0)
942+
};
940943
if read_result.is_err() {
941944
let err_data = read_result.get_err();
942945

@@ -948,8 +951,7 @@ impl io::Reader for TcpSocketBuf {
948951
err_data.err_name, err_data.err_msg);
949952
fail!()
950953
}
951-
}
952-
else {
954+
} else {
953955
self.data.buf = result::unwrap(read_result);
954956
self.data.buf_off = 0;
955957
}

0 commit comments

Comments
 (0)