Earlier quoted context omitted.
> that misbehavior has nothing to do with the semantics of Rust as a language. Macros are part of the language; they aren’t an external code generation tool. > The same would happen if you wrote (or generated) 100,000 lines of C in one function body Absolutely, but neither C nor C++ makes it easy to generate such code. Technically doable with C preprocessor, but it’s not easy. C++ templates don’t normally expand into…
People write code generators that emit C/C++ code all the time, and 10KLOC functions coming from such a generator isn't unheard of. The x86 instruction selector LLVM generates from tablegen is over 240KLOC, although that's emitted effectively as an interpreted table, so the actual code size of the function is much, much smaller.
However, it doesn’t happen with idiomatic C or C++ code. C macros are too hard to use for that. C++ templates are designed to expand into many small functions, as opposed to a single huge one.
It was Rust complexity leaking over into the LLVM IR.