Skip to content

Instantly share code, notes, and snippets.

fn recv() -> T {
match move self.try_recv() {
some(x) { move x }
none { fail ~"port_set: endpoints closed" }
}
}
Manually expanded:
rust: ~"(resolving item in lexical scope) resolving `next` in namespace 2 in `<opaque>`"
rust: ~"(resolving name in module) resolving `next` in `???`"
rust: ~"(resolving name in module) failed to resolve next"
rust: ~"(resolving item in lexical scope) unresolved module"
rust: ~"(resolving pattern) binding `next`"
rust: ~"(recording def) recording def_binding(92, 1) for 92"
select! {
foo => {
do_foo -> _next {
}
}
bar => {
do_bar(x) -> _next {
debug!(x)
}
// Protocols
proto! foo {
foo:recv {
do_foo -> foo
}
}
proto! bar {
bar:recv {
do_bar(int) -> barbar,
[host-7-102:build eholk]$ ./x86_64-apple-darwin/stage1/bin/rustc -o test ../src/test/run-pass/pipe-select-macro.rs
~(~[(match_seq(~[(match_nonterminal(@~"lhs", @~"matchers", 0), (0, 0, none)), (match_tok(FAT_ARROW), (0, 0, none)), (match_nonterminal(@~"rhs", @~"tt", 1), (0, 0, none))], some(SEMI), 0, 0, 2), (0, 0, none)), (match_seq(~[(match_tok(SEMI), (0, 0, none))], none, 1, 2, 2), (0, 0, none))], none, 0, matcher_pos_up(none), ~[dvec_((~[])), dvec_((~[]))], 0, 2, 327)
~(~[(match_nonterminal(@~"lhs", @~"matchers", 0), (0, 0, none)), (match_tok(FAT_ARROW), (0, 0, none)), (match_nonterminal(@~"rhs", @~"tt", 1), (0, 0, none))], some(SEMI), 0, matcher_pos_up(some(~(~[(match_seq(~[(match_nonterminal(@~"lhs", @~"matchers", 0), (0, 0, none)), (match_tok(FAT_ARROW), (0, 0, none)), (match_nonterminal(@~"rhs", @~"tt", 1), (0, 0, none))], some(SEMI), 0, 0, 2), (0, 0, none)), (match_seq(~[(match_tok(SEMI), (0, 0, none))], none, 1, 2, 2), (0, 0, none))], none, 0, matcher_pos_up(none), ~[dvec_((~[])), dvec_((~[]))], 0, 2
fn draw_frame(+channel: double_buffer::client::acquire) {
let channel = request(channel);
select! {
channel => {
give_buffer(buffer) -> channel {
render(&buffer);
release(channel, move buffer)
}
}
};
macro_rules! select_if {
{
$index:expr,
$count:expr,
$port:path => [
$($message:path$(($($x: ident),+))dont_type_this*
-> $next:ident $e:expr),+
],
$( $ports:path => [
$($messages:path$(($($xs: ident),+))dont_type_this*
macro_rules! html {
{ $($body:tt)* } => {
let builder = HTMLBuilder();
build_html!{builder := $($body)*};
builder.getDoc()
}
}
macro_rules! build_html {
{ $builder:expr := </$tag:ident> $($rest:tt)* } => {
macro_rules! html {
{ $($body:tt)* } => (
parse_node!( []; []; $($body)* )
)
}
macro_rules! parse_node {
{
[:$head:ident ($(:$head_nodes:expr),*)
$(:$tags:ident ($(:$tag_nodes:expr),*))*];
((lambda (_.0)
(list
(_.0 (list))
(list 'lambda '(_.1) (list 'quote (_.0 (list))))))
(lambda (_.1)
'(lambda (_.0)
(list
(_.0 (list))
(list 'lambda '(_.1) (list 'quote (_.0 (list))))))))