Skip to content

Instantly share code, notes, and snippets.

@catamorphism
Created September 17, 2012 21:12
Show Gist options
  • Select an option

  • Save catamorphism/3739841 to your computer and use it in GitHub Desktop.

Select an option

Save catamorphism/3739841 to your computer and use it in GitHub Desktop.
diff --git a/src/test/run-pass/select-macro.rs b/src/test/run-pass/select-macro.rs
index 15dd56e..82c1c5c 100644
--- a/src/test/run-pass/select-macro.rs
+++ b/src/test/run-pass/select-macro.rs
@@ -17,19 +17,19 @@ macro_rules! select_if (
$count:expr,
$port:path => [
$(type_this $message:path$(($(x $x: ident),+))dont_type_this*
- -> $next:ident => { $e:expr }),+
+ -> $next:ident => { move $e:expr }),+
]
$(, $ports:path => [
$(type_this $messages:path$(($(x $xs: ident),+))dont_type_this*
- -> $nexts:ident => { $es:expr }),+
+ -> $nexts:ident => { move $es:expr }),+
] )*
} => {
if $index == $count {
match move pipes::try_recv($port) {
$(Some($message($($(ref $x,)+)* ref next)) => {
// FIXME (#2329) we really want move out of enum here.
- let $next = unsafe { let x <- *ptr::addr_of(*next); x };
- $e
+ let $next = unsafe { let x <- *ptr::addr_of(*next); move x };
+ move $e
})+
_ => fail
}
@@ -55,7 +55,7 @@ macro_rules! select (
} => {
let index = pipes::selecti([$(($port).header()),+]/_);
select_if!(index, 0 $(, $port => [
- $(type_this $message$(($(x $x),+))dont_type_this* -> $next => { $e }),+
+ $(type_this $message$(($(x $x),+))dont_type_this* -> $next => { move $e }),+
])+)
}
)
@catamorphism

Copy link
Copy Markdown
Author

diff --git a/src/test/run-pass/select-macro.rs b/src/test/run-pass/select-macro.rs
index 15dd56e..82c1c5c 100644
--- a/src/test/run-pass/select-macro.rs
+++ b/src/test/run-pass/select-macro.rs
@@ -17,19 +17,19 @@ macro_rules! select_if (
$count:expr,
$port:path => [
$(type_this $message:path$(($(x $x: ident),+))dont_type_this*

  •          -> $next:ident => { $e:expr }),+
    
  •          -> $next:ident => { move $e:expr }),+
     ]
     $(, $ports:path => [
         $(type_this $messages:path$(($(x $xs: ident),+))dont_type_this*
    
  •          -> $nexts:ident => { $es:expr }),+
    
  •          -> $nexts:ident => { move $es:expr }),+
     ] )*
    
    } => {
    if $index == $count {
    match move pipes::try_recv($port) {
    $(Some($message($($(ref $x,)+)* ref next)) => {
    // FIXME (#2329) we really want move out of enum here.
  •            let $next = unsafe { let x <- _ptr::addr_of(_next); x };
    
  •            $e
    
  •            let $next = unsafe { let x <- _ptr::addr_of(_next); move x };
    
  •            move $e
           })+
           _ => fail
         }
    
    @@ -55,7 +55,7 @@ macro_rules! select (
    } => {
    let index = pipes::selecti([$(($port).header()),+]/_);
    select_if!(index, 0 $(, $port => [
  •        $(type_this $message$(($(x $x),+))dont_type_this\* -> $next => { $e }),+
    
  •        $(type_this $message$(($(x $x),+))dont_type_this\* -> $next => { move $e }),+
     ])+)
    
    }
    )

@catamorphism

Copy link
Copy Markdown
Author

Oops, ignore the first comment. The error:

Command: x86_64-apple-darwin/stage2/bin/rustc /Users/tchevalier/rust/src/test/run-pass/pipe-select-macro.rs -o x86_64-apple-darwin/test/run-pass/pipe-select-macro.stage2-x86_64-apple-darwin -L x86_64-apple-darwin/test/run-pass -L x86_64-apple-darwin/test/run-pass/pipe-select-macro.libaux -Z time-passes --target=x86_64-apple-darwin

stdout:

time: 0.002 s parsing
time: 0.000 s configuration
time: 0.000 s maybe building test harness


stderr:

/Users/tchevalier/rust/src/test/run-pass/select-macro.rs:42:38: 42:40 error: No rules expected the token: an interpolated expression
/Users/tchevalier/rust/src/test/run-pass/select-macro.rs:42 -> $nexts => { $es }),+

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment