Skip to content

A couple pre-release fixes #5456

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 21, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/libcore/comm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ pub fn stream<T:Owned>() -> (Port<T>, Chan<T>) {
// required.
#[cfg(stage1)]
#[cfg(stage2)]
#[cfg(stage3)]
pub impl<T: Owned> Chan<T> {
fn send(&self, x: T) { chan_send(self, x) }
fn try_send(&self, x: T) -> bool { chan_try_send(self, x) }
Expand Down Expand Up @@ -149,6 +150,7 @@ fn chan_try_send<T:Owned>(self: &Chan<T>, x: T) -> bool {
// Use an inherent impl so that imports are not required:
#[cfg(stage1)]
#[cfg(stage2)]
#[cfg(stage3)]
pub impl<T: Owned> Port<T> {
fn recv(&self) -> T { port_recv(self) }
fn try_recv(&self) -> Option<T> { port_try_recv(self) }
Expand Down Expand Up @@ -226,6 +228,7 @@ pub fn PortSet<T: Owned>() -> PortSet<T>{
// Use an inherent impl so that imports are not required:
#[cfg(stage1)]
#[cfg(stage2)]
#[cfg(stage3)]
pub impl<T:Owned> PortSet<T> {
fn recv(&self) -> T { port_set_recv(self) }
fn try_recv(&self) -> Option<T> { port_set_try_recv(self) }
Expand Down Expand Up @@ -301,6 +304,7 @@ pub type SharedChan<T> = unstable::Exclusive<Chan<T>>;

#[cfg(stage1)]
#[cfg(stage2)]
#[cfg(stage3)]
pub impl<T: Owned> SharedChan<T> {
fn send(&self, x: T) { shared_chan_send(self, x) }
fn try_send(&self, x: T) -> bool { shared_chan_try_send(self, x) }
Expand Down
6 changes: 5 additions & 1 deletion src/libcore/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ use libc;
use libc::{c_int, c_long, c_uint, c_void, size_t, ssize_t};
use libc::consts::os::posix88::*;
use os;
use prelude::*;
use cast;
use path::Path;
use ops::Drop;
use ptr;
use result;
use str;
Expand Down Expand Up @@ -75,6 +77,7 @@ pub trait Reader {

#[cfg(stage1)]
#[cfg(stage2)]
#[cfg(stage3)]
impl Reader for @Reader {
fn read(&self, bytes: &mut [u8], len: uint) -> uint {
self.read(bytes, len)
Expand Down Expand Up @@ -657,6 +660,7 @@ pub trait Writer {

#[cfg(stage1)]
#[cfg(stage2)]
#[cfg(stage3)]
impl Writer for @Writer {
fn write(&self, v: &[const u8]) { self.write(v) }
fn seek(&self, a: int, b: SeekStyle) { self.seek(a, b) }
Expand Down
1 change: 1 addition & 0 deletions src/libcore/prelude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ pub use tuple::{CopyableTuple, ImmutableTuple, ExtendedTupleOps};
pub use vec::{CopyableVector, ImmutableVector};
pub use vec::{ImmutableEqVector, ImmutableCopyableVector};
pub use vec::{OwnedVector, OwnedCopyableVector};
pub use io::{Reader, ReaderUtil, Writer, WriterUtil};

/* Reexported runtime types */
pub use comm::{stream, Port, Chan, GenericChan, GenericSmartChan, GenericPort, Peekable};
Expand Down
1 change: 1 addition & 0 deletions src/librustc/front/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,7 @@ fn mk_tests(cx: &TestCtxt) -> @ast::item {

#[cfg(stage1)]
#[cfg(stage2)]
#[cfg(stage3)]
fn mk_tests(cx: &TestCtxt) -> @ast::item {

let ext_cx = cx.ext_cx;
Expand Down
40 changes: 20 additions & 20 deletions src/librustdoc/markdown_pass.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ fn write_page(ctxt: &Ctxt, page: &doc::Page) {
write_item_no_header(ctxt, doc);
}
}
ctxt.w.write_done();
ctxt.w.put_done();
}

#[test]
Expand All @@ -146,8 +146,8 @@ fn should_request_new_writer_for_each_page() {
}

fn write_title(ctxt: &Ctxt, page: doc::Page) {
ctxt.w.write_line(fmt!("%% %s", make_title(page)));
ctxt.w.write_line(~"");
ctxt.w.put_line(fmt!("%% %s", make_title(page)));
ctxt.w.put_line(~"");
}

fn make_title(page: doc::Page) -> ~str {
Expand Down Expand Up @@ -198,8 +198,8 @@ fn write_header(ctxt: &Ctxt, lvl: Hlvl, doc: doc::ItemTag) {

fn write_header_(ctxt: &Ctxt, lvl: Hlvl, title: ~str) {
let hashes = str::from_chars(vec::from_elem(lvl as uint, '#'));
ctxt.w.write_line(fmt!("%s %s", hashes, title));
ctxt.w.write_line(~"");
ctxt.w.put_line(fmt!("%s %s", hashes, title));
ctxt.w.put_line(~"");
}

pub fn header_kind(doc: doc::ItemTag) -> ~str {
Expand Down Expand Up @@ -332,8 +332,8 @@ fn write_desc(
) {
match desc {
Some(desc) => {
ctxt.w.write_line(desc);
ctxt.w.write_line(~"");
ctxt.w.put_line(desc);
ctxt.w.put_line(~"");
}
None => ()
}
Expand All @@ -347,8 +347,8 @@ fn write_sections(ctxt: &Ctxt, sections: &[doc::Section]) {

fn write_section(ctxt: &Ctxt, section: doc::Section) {
write_header_(ctxt, H4, copy section.header);
ctxt.w.write_line(copy section.body);
ctxt.w.write_line(~"");
ctxt.w.put_line(copy section.body);
ctxt.w.put_line(~"");
}

#[test]
Expand Down Expand Up @@ -398,7 +398,7 @@ fn write_item_(ctxt: &Ctxt, doc: doc::ItemTag, write_header: bool) {
doc::TraitTag(TraitDoc) => write_trait(ctxt, TraitDoc),
doc::ImplTag(ImplDoc) => write_impl(ctxt, ImplDoc),
doc::TyTag(TyDoc) => write_type(ctxt, TyDoc),
doc::StructTag(StructDoc) => write_struct(ctxt, StructDoc),
doc::StructTag(StructDoc) => put_struct(ctxt, StructDoc),
}
}

Expand Down Expand Up @@ -428,13 +428,13 @@ fn write_index(ctxt: &Ctxt, index: doc::Index) {
let header = header_text_(entry.kind, entry.name);
let id = copy entry.link;
if entry.brief.is_some() {
ctxt.w.write_line(fmt!("* [%s](%s) - %s",
ctxt.w.put_line(fmt!("* [%s](%s) - %s",
header, id, (&entry.brief).get()));
} else {
ctxt.w.write_line(fmt!("* [%s](%s)", header, id));
ctxt.w.put_line(fmt!("* [%s](%s)", header, id));
}
}
ctxt.w.write_line(~"");
ctxt.w.put_line(~"");
}

#[test]
Expand Down Expand Up @@ -526,8 +526,8 @@ fn write_fnlike(
fn write_sig(ctxt: &Ctxt, sig: Option<~str>) {
match sig {
Some(sig) => {
ctxt.w.write_line(code_block_indent(sig));
ctxt.w.write_line(~"");
ctxt.w.put_line(code_block_indent(sig));
ctxt.w.put_line(~"");
}
None => fail!(~"unimplemented")
}
Expand Down Expand Up @@ -641,18 +641,18 @@ fn write_variants(
write_variant(ctxt, copy *variant);
}

ctxt.w.write_line(~"");
ctxt.w.put_line(~"");
}

fn write_variant(ctxt: &Ctxt, doc: doc::VariantDoc) {
fail_unless!(doc.sig.is_some());
let sig = (&doc.sig).get();
match copy doc.desc {
Some(desc) => {
ctxt.w.write_line(fmt!("* `%s` - %s", sig, desc));
ctxt.w.put_line(fmt!("* `%s` - %s", sig, desc));
}
None => {
ctxt.w.write_line(fmt!("* `%s`", sig));
ctxt.w.put_line(fmt!("* `%s`", sig));
}
}
}
Expand Down Expand Up @@ -804,7 +804,7 @@ fn should_write_type_signature() {
fail_unless!(str::contains(markdown, ~"\n\n type t = int\n\n"));
}

fn write_struct(
fn put_struct(
ctxt: &Ctxt,
doc: doc::StructDoc
) {
Expand All @@ -813,7 +813,7 @@ fn write_struct(
}

#[test]
fn should_write_struct_header() {
fn should_put_struct_header() {
let markdown = test::render(~"struct S { field: () }");
fail_unless!(str::contains(markdown, ~"## Struct `S`\n\n"));
}
Expand Down
14 changes: 7 additions & 7 deletions src/librustdoc/markdown_writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,21 @@ pub type Writer = ~fn(v: WriteInstr);
pub type WriterFactory = ~fn(page: doc::Page) -> Writer;

pub trait WriterUtils {
fn write_str(&self, +str: ~str);
fn write_line(&self, +str: ~str);
fn write_done(&self);
fn put_str(&self, +str: ~str);
fn put_line(&self, +str: ~str);
fn put_done(&self);
}

impl WriterUtils for Writer {
fn write_str(&self, str: ~str) {
fn put_str(&self, str: ~str) {
(*self)(Write(str));
}

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

fn write_done(&self) {
fn put_done(&self) {
(*self)(Done)
}
}
Expand Down
1 change: 1 addition & 0 deletions src/libstd/comm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ pub struct DuplexStream<T, U> {
// Allow these methods to be used without import:
#[cfg(stage1)]
#[cfg(stage2)]
#[cfg(stage3)]
pub impl<T:Owned,U:Owned> DuplexStream<T, U> {
fn send(&self, x: T) {
self.chan.send(x)
Expand Down