These are chat archives for rust-lang/rust

27th
Jul 2017
Ashley Davis
@dualmoon
Jul 27 2017 02:16
macro_rules! die_count {
        ( $number:expr, $sides:expr ) => {
            {
                let roll = roll_die($number, $sides);
                let count = roll.iter().filter(|x|*x==&$sides).count();
                (roll, count)
            }
        }
}
ok so this works fine, i just wonder why we need two sets of curly braces here
Joonas Koivunen
@koivunej
Jul 27 2017 08:49
@dualmoon first set after => is required by the macro_rules! syntax (it might be possible to use () instead, not sure) but I am not sure why the inner block is needed... what was the error without it being a block?
Tim Siwula
@tcsiwula
Jul 27 2017 09:55
Hey has anyone built parity on nightly in the last week?
Ashley Davis
@dualmoon
Jul 27 2017 22:52
@koivunej i'd have to check in a bit to verify, but i believe it said that the leg expected an expression instead of a statement, or visa versa