mozilla/rust — Issue #1885: Infinite compiler hang
Author: Wensleydale
Created: 2012-02-22 19:47:17+00:00
State: open

In the course of answering [this StackOverflow question](http://stackoverflow.com/questions/9271924/how-do-i-emulate-lisp-apply-or-curry-in-rust) I was puzzling out how to enclose the body of a macro definition when I struck upon the idea of using a self-executing anonymous closure. This worked! (Although there was some weirdness with rustc throwing errors due to being unable to infer the type of the macro invocations, forcing me to include an explicit return statement. But that's beside the point.)

Afterward while looking through Rust's test suite I checked out the macro-by-example tests and saw that the bodies of macros could simply be enclosed in braces (seen [here](https://github.com/mozilla/rust/blob/master/src/test/run-pass/macro-by-example-2.rs), in the definition for `#lambda`). Converting my code from the anonymous self-executing closure to use the braces syntax causes rustc to hang indefinitely, consuming 100% CPU.

I've included both files here: https://gist.github.com/1886511

Tested on Debian 6.0.3, i686.