This code makes the compiler crash with a stack overflow (tested on the playground):
fn main() {
macro_rules! stack {
($overflow:expr) => {
println!(stack!($overflow));
};
}
stack!("overflow");
}
You can try this code on the playground.
If you replace the println! by a print!, the compiler will crash with a segmentation fault instead.
You can try this on the playground too.
The compiler doesn't detect the recursive macro. In fact, it only detect them if we remove the println!.
This code makes the compiler crash with a stack overflow (tested on the playground):
You can try this code on the playground.
If you replace the
println!by aprint!, the compiler will crash with a segmentation fault instead.You can try this on the playground too.
The compiler doesn't detect the recursive macro. In fact, it only detect them if we remove the
println!.