Closed
Description
I'm very much a beginner with Rust. I was trying to learn how to write macros when I encountered an ICE. I don't know what caused the error, but here's the simple code to reproduce it. It occurred after I added the return statements to the macro.
macro_rules! get_ms_bit_index {
($a: ident, $b: ident) => {
if $a > $b { return $a } else { return $b }
}
}
pub mod bitfield {
pub const BIT_INDEX_0: u32 = 8;
pub const BIT_INDEX_1: u32 = 0;
pub const WORD_MS_BIT_INDEX: u32 = get_ms_bit_index!(BIT_INDEX_0, BIT_INDEX_1);
}
fn main() { }
playpen link: https://is.gd/6tcbBT