oops, cubic macro

30 points by polywolf


matklad

Another fun example:

macro_rules! m { ($($tt:tt)*) => { m!($($tt)*, $($tt)*); }; }
m!();

This hangs rustc (eats infinite RAM without tripping recursion depth check), but rust-analyzer has to deal with it, as these kinds of pathologies happen all the time for code that is being written.

It seems like it's easy enough to deal with stuff like that by adding "fuel", but the problem is then that the amount of "fuel" left makes incremental compilation ineffective! I think, for macro expansion, we ended up with limiting both depth and width of macros?