Skip to content

Commit a8527e2

Browse files
committed
auto merge of #5456 : graydon/rust/fixups, r=pcwalton
Stage markers for stage3 and a trivial prelude fix.
2 parents b12714e + 9350d14 commit a8527e2

File tree

7 files changed

+39
-28
lines changed

7 files changed

+39
-28
lines changed

src/libcore/comm.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ pub fn stream<T:Owned>() -> (Port<T>, Chan<T>) {
110110
// required.
111111
#[cfg(stage1)]
112112
#[cfg(stage2)]
113+
#[cfg(stage3)]
113114
pub impl<T: Owned> Chan<T> {
114115
fn send(&self, x: T) { chan_send(self, x) }
115116
fn try_send(&self, x: T) -> bool { chan_try_send(self, x) }
@@ -149,6 +150,7 @@ fn chan_try_send<T:Owned>(self: &Chan<T>, x: T) -> bool {
149150
// Use an inherent impl so that imports are not required:
150151
#[cfg(stage1)]
151152
#[cfg(stage2)]
153+
#[cfg(stage3)]
152154
pub impl<T: Owned> Port<T> {
153155
fn recv(&self) -> T { port_recv(self) }
154156
fn try_recv(&self) -> Option<T> { port_try_recv(self) }
@@ -226,6 +228,7 @@ pub fn PortSet<T: Owned>() -> PortSet<T>{
226228
// Use an inherent impl so that imports are not required:
227229
#[cfg(stage1)]
228230
#[cfg(stage2)]
231+
#[cfg(stage3)]
229232
pub impl<T:Owned> PortSet<T> {
230233
fn recv(&self) -> T { port_set_recv(self) }
231234
fn try_recv(&self) -> Option<T> { port_set_try_recv(self) }
@@ -301,6 +304,7 @@ pub type SharedChan<T> = unstable::Exclusive<Chan<T>>;
301304
302305
#[cfg(stage1)]
303306
#[cfg(stage2)]
307+
#[cfg(stage3)]
304308
pub impl<T: Owned> SharedChan<T> {
305309
fn send(&self, x: T) { shared_chan_send(self, x) }
306310
fn try_send(&self, x: T) -> bool { shared_chan_try_send(self, x) }

src/libcore/io.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ use libc;
2121
use libc::{c_int, c_long, c_uint, c_void, size_t, ssize_t};
2222
use libc::consts::os::posix88::*;
2323
use os;
24-
use prelude::*;
24+
use cast;
25+
use path::Path;
26+
use ops::Drop;
2527
use ptr;
2628
use result;
2729
use str;
@@ -75,6 +77,7 @@ pub trait Reader {
7577

7678
#[cfg(stage1)]
7779
#[cfg(stage2)]
80+
#[cfg(stage3)]
7881
impl Reader for @Reader {
7982
fn read(&self, bytes: &mut [u8], len: uint) -> uint {
8083
self.read(bytes, len)
@@ -657,6 +660,7 @@ pub trait Writer {
657660
658661
#[cfg(stage1)]
659662
#[cfg(stage2)]
663+
#[cfg(stage3)]
660664
impl Writer for @Writer {
661665
fn write(&self, v: &[const u8]) { self.write(v) }
662666
fn seek(&self, a: int, b: SeekStyle) { self.seek(a, b) }

src/libcore/prelude.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ pub use tuple::{CopyableTuple, ImmutableTuple, ExtendedTupleOps};
4343
pub use vec::{CopyableVector, ImmutableVector};
4444
pub use vec::{ImmutableEqVector, ImmutableCopyableVector};
4545
pub use vec::{OwnedVector, OwnedCopyableVector};
46+
pub use io::{Reader, ReaderUtil, Writer, WriterUtil};
4647

4748
/* Reexported runtime types */
4849
pub use comm::{stream, Port, Chan, GenericChan, GenericSmartChan, GenericPort, Peekable};

src/librustc/front/test.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,7 @@ fn mk_tests(cx: &TestCtxt) -> @ast::item {
369369

370370
#[cfg(stage1)]
371371
#[cfg(stage2)]
372+
#[cfg(stage3)]
372373
fn mk_tests(cx: &TestCtxt) -> @ast::item {
373374

374375
let ext_cx = cx.ext_cx;

src/librustdoc/markdown_pass.rs

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ fn write_page(ctxt: &Ctxt, page: &doc::Page) {
127127
write_item_no_header(ctxt, doc);
128128
}
129129
}
130-
ctxt.w.write_done();
130+
ctxt.w.put_done();
131131
}
132132

133133
#[test]
@@ -146,8 +146,8 @@ fn should_request_new_writer_for_each_page() {
146146
}
147147

148148
fn write_title(ctxt: &Ctxt, page: doc::Page) {
149-
ctxt.w.write_line(fmt!("%% %s", make_title(page)));
150-
ctxt.w.write_line(~"");
149+
ctxt.w.put_line(fmt!("%% %s", make_title(page)));
150+
ctxt.w.put_line(~"");
151151
}
152152

153153
fn make_title(page: doc::Page) -> ~str {
@@ -198,8 +198,8 @@ fn write_header(ctxt: &Ctxt, lvl: Hlvl, doc: doc::ItemTag) {
198198
199199
fn write_header_(ctxt: &Ctxt, lvl: Hlvl, title: ~str) {
200200
let hashes = str::from_chars(vec::from_elem(lvl as uint, '#'));
201-
ctxt.w.write_line(fmt!("%s %s", hashes, title));
202-
ctxt.w.write_line(~"");
201+
ctxt.w.put_line(fmt!("%s %s", hashes, title));
202+
ctxt.w.put_line(~"");
203203
}
204204
205205
pub fn header_kind(doc: doc::ItemTag) -> ~str {
@@ -332,8 +332,8 @@ fn write_desc(
332332
) {
333333
match desc {
334334
Some(desc) => {
335-
ctxt.w.write_line(desc);
336-
ctxt.w.write_line(~"");
335+
ctxt.w.put_line(desc);
336+
ctxt.w.put_line(~"");
337337
}
338338
None => ()
339339
}
@@ -347,8 +347,8 @@ fn write_sections(ctxt: &Ctxt, sections: &[doc::Section]) {
347347

348348
fn write_section(ctxt: &Ctxt, section: doc::Section) {
349349
write_header_(ctxt, H4, copy section.header);
350-
ctxt.w.write_line(copy section.body);
351-
ctxt.w.write_line(~"");
350+
ctxt.w.put_line(copy section.body);
351+
ctxt.w.put_line(~"");
352352
}
353353

354354
#[test]
@@ -398,7 +398,7 @@ fn write_item_(ctxt: &Ctxt, doc: doc::ItemTag, write_header: bool) {
398398
doc::TraitTag(TraitDoc) => write_trait(ctxt, TraitDoc),
399399
doc::ImplTag(ImplDoc) => write_impl(ctxt, ImplDoc),
400400
doc::TyTag(TyDoc) => write_type(ctxt, TyDoc),
401-
doc::StructTag(StructDoc) => write_struct(ctxt, StructDoc),
401+
doc::StructTag(StructDoc) => put_struct(ctxt, StructDoc),
402402
}
403403
}
404404

@@ -428,13 +428,13 @@ fn write_index(ctxt: &Ctxt, index: doc::Index) {
428428
let header = header_text_(entry.kind, entry.name);
429429
let id = copy entry.link;
430430
if entry.brief.is_some() {
431-
ctxt.w.write_line(fmt!("* [%s](%s) - %s",
431+
ctxt.w.put_line(fmt!("* [%s](%s) - %s",
432432
header, id, (&entry.brief).get()));
433433
} else {
434-
ctxt.w.write_line(fmt!("* [%s](%s)", header, id));
434+
ctxt.w.put_line(fmt!("* [%s](%s)", header, id));
435435
}
436436
}
437-
ctxt.w.write_line(~"");
437+
ctxt.w.put_line(~"");
438438
}
439439
440440
#[test]
@@ -526,8 +526,8 @@ fn write_fnlike(
526526
fn write_sig(ctxt: &Ctxt, sig: Option<~str>) {
527527
match sig {
528528
Some(sig) => {
529-
ctxt.w.write_line(code_block_indent(sig));
530-
ctxt.w.write_line(~"");
529+
ctxt.w.put_line(code_block_indent(sig));
530+
ctxt.w.put_line(~"");
531531
}
532532
None => fail!(~"unimplemented")
533533
}
@@ -641,18 +641,18 @@ fn write_variants(
641641
write_variant(ctxt, copy *variant);
642642
}
643643
644-
ctxt.w.write_line(~"");
644+
ctxt.w.put_line(~"");
645645
}
646646
647647
fn write_variant(ctxt: &Ctxt, doc: doc::VariantDoc) {
648648
fail_unless!(doc.sig.is_some());
649649
let sig = (&doc.sig).get();
650650
match copy doc.desc {
651651
Some(desc) => {
652-
ctxt.w.write_line(fmt!("* `%s` - %s", sig, desc));
652+
ctxt.w.put_line(fmt!("* `%s` - %s", sig, desc));
653653
}
654654
None => {
655-
ctxt.w.write_line(fmt!("* `%s`", sig));
655+
ctxt.w.put_line(fmt!("* `%s`", sig));
656656
}
657657
}
658658
}
@@ -804,7 +804,7 @@ fn should_write_type_signature() {
804804
fail_unless!(str::contains(markdown, ~"\n\n type t = int\n\n"));
805805
}
806806

807-
fn write_struct(
807+
fn put_struct(
808808
ctxt: &Ctxt,
809809
doc: doc::StructDoc
810810
) {
@@ -813,7 +813,7 @@ fn write_struct(
813813
}
814814

815815
#[test]
816-
fn should_write_struct_header() {
816+
fn should_put_struct_header() {
817817
let markdown = test::render(~"struct S { field: () }");
818818
fail_unless!(str::contains(markdown, ~"## Struct `S`\n\n"));
819819
}

src/librustdoc/markdown_writer.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,21 +34,21 @@ pub type Writer = ~fn(v: WriteInstr);
3434
pub type WriterFactory = ~fn(page: doc::Page) -> Writer;
3535

3636
pub trait WriterUtils {
37-
fn write_str(&self, +str: ~str);
38-
fn write_line(&self, +str: ~str);
39-
fn write_done(&self);
37+
fn put_str(&self, +str: ~str);
38+
fn put_line(&self, +str: ~str);
39+
fn put_done(&self);
4040
}
4141

4242
impl WriterUtils for Writer {
43-
fn write_str(&self, str: ~str) {
43+
fn put_str(&self, str: ~str) {
4444
(*self)(Write(str));
4545
}
4646

47-
fn write_line(&self, str: ~str) {
48-
self.write_str(str + ~"\n");
47+
fn put_line(&self, str: ~str) {
48+
self.put_str(str + ~"\n");
4949
}
5050

51-
fn write_done(&self) {
51+
fn put_done(&self) {
5252
(*self)(Done)
5353
}
5454
}

src/libstd/comm.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ pub struct DuplexStream<T, U> {
2828
// Allow these methods to be used without import:
2929
#[cfg(stage1)]
3030
#[cfg(stage2)]
31+
#[cfg(stage3)]
3132
pub impl<T:Owned,U:Owned> DuplexStream<T, U> {
3233
fn send(&self, x: T) {
3334
self.chan.send(x)

0 commit comments

Comments
 (0)