diff options
| -rw-r--r-- | src/libcore/pipes.rs | 10 | ||||
| -rw-r--r-- | src/libsyntax/ext/pipes/pipec.rs | 8 |
2 files changed, 14 insertions, 4 deletions
diff --git a/src/libcore/pipes.rs b/src/libcore/pipes.rs index 6de2059d2de..8ce67c8509f 100644 --- a/src/libcore/pipes.rs +++ b/src/libcore/pipes.rs @@ -97,6 +97,9 @@ export stream, port, chan, shared_chan, port_set, channel; 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<T: send>(+chan: chan_one<T>, +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<T>(+val: T) -> option<T> { some(val) } + fn make_none<T>() -> option<T> { none } +} + #[cfg(test)] mod test { #[test] diff --git a/src/libsyntax/ext/pipes/pipec.rs b/src/libsyntax/ext/pipes/pipec.rs index 5c5147741db..8bd0d3313d5 100644 --- a/src/libsyntax/ext/pipes/pipec.rs +++ b/src/libsyntax/ext/pipes/pipec.rs @@ -104,8 +104,8 @@ impl message: gen_send { } 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 @@ impl message: gen_send { 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); |
