[rust-dev] Fall-through in alt, break&continue by label

Niko Matsakis niko at alum.mit.edu
Tue Apr 10 06:42:07 PDT 2012

On 4/10/12 5:53 AM, Henri Sivonen wrote:
> The use case I have is targeting Rust with the translator that
> currently targets C++ and generates the HTML parser in Gecko. (It uses
> goto hidden behind macros to emulate break and continue by label in
> C++.)

There is currently no way to do that kind of control flow beyond using 
flags with `if` checks or restructuring the code in some other way (tail 
calls, if they worked, seem like they would be useful).  I believe our 
`break` can only target loops in any case.

How hard would it be do you think to prototype a version that avoids 
these control-flow features?  Also, how important is fall-through for 
alt vs break to labeled blocks?

I think adding labeled blocks/loops and the ability to break/continue 
with a label is plausible, but a fair bit of work.  Fall-through in alt 
seems less likely.  Certainly it would be good to do some experiments 
and measurements, either of your parser or of micro-benchmarks.


More information about the Rust-dev mailing list