Error: macro expansion ignores token `match`

I am getting the compiler error: Error: macro expansion ignores token match. I can't seem to find it documented anywhere, but do macros not support "match"?

Thanks very much!

Here is the code:

macro_rules! increment8 {

    ($reg: ident) => {
        cpu.$reg = cpu.$reg.wrapping_add(1);

        match cpu.$reg {
            0 => setFlag(Zero, &mut cpu.F),
            _ => clearFlag(Zero, &mut cpu.F) 
        };

        clearFlag(Neg, &mut cpu.F);

        match cpu.$reg & 0xF {
            0 => setFlag(Half, &mut cpu.F),
            _ => clearFlag(Half, &mut cpu.F)
        };
        (cpu.PC + 1, 4)
    }

}

Macros can have some really obscure errors. This one, I trying to say that it will only return one statement, expression or item. You have to wrap everything in a block.

2 Likes

Wrapping the curly braces in parentheses worked. Thanks very much!