diff --git a/src/libcore/pipes.rs b/src/libcore/pipes.rs index 6de2059d2deae178bc87fbca52a6a9e61b626185..8ce67c8509fd5ed8eaca21baf275bd1e7c3fe4eb 100644 --- a/src/libcore/pipes.rs +++ b/src/libcore/pipes.rs @@ -97,6 +97,9 @@ export oneshot, chan_one, port_one; export recv_one, try_recv_one, send_one, try_send_one; +// Functions used by the protocol compiler +export rt; + #[doc(hidden)] const SPIN_COUNT: uint = 0; @@ -1194,6 +1197,13 @@ fn try_send_one(+chan: chan_one, +data: T) oneshot::client::try_send(chan, data).is_some() } +mod rt { + // These are used to hide the option constructors from the + // compiler because their names are changing + fn make_some(+val: T) -> option { some(val) } + fn make_none() -> option { none } +} + #[cfg(test)] mod test { #[test] diff --git a/src/libsyntax/ext/pipes/pipec.rs b/src/libsyntax/ext/pipes/pipec.rs index 5c5147741db814bacae83c06e4182c698173e0ac..8bd0d3313d59943551e13ad69eb28eb7bb7869cb 100644 --- a/src/libsyntax/ext/pipes/pipec.rs +++ b/src/libsyntax/ext/pipes/pipec.rs @@ -104,8 +104,8 @@ fn gen_send(cx: ext_ctxt, try: bool) -> @ast::item { } else { body += fmt!("if pipes::send(pipe, message) {\n \ - some(c) \ - } else { none } }"); + pipes::rt::make_some(c) \ + } else { pipes::rt::make_none() } }"); } let body = cx.parse_expr(body); @@ -163,8 +163,8 @@ fn gen_send(cx: ext_ctxt, try: bool) -> @ast::item { body += ~" }"; } else { body += fmt!("if pipes::send(pipe, message) { \ - some(()) \ - } else { none } }"); + pipes::rt::make_some(()) \ + } else { pipes::rt::make_none() } }"); } let body = cx.parse_expr(body);