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

Brian Anderson banderson at mozilla.com
Sun Apr 15 17:38:33 PDT 2012


On 04/10/2012 05:53 AM, Henri Sivonen wrote:
> It appears that Rust does not to have labeled loops with break and
> continue by label the way Java has.  Also, it appears that alt does
> not have fall-through the way switch in C has.
>
> Are break and continue by label and/or fall-through in alt supported
> in some non-obvious and unadvertised way?  If not, are there plans to
> add to these features?  (While I understand that fall-through in
> switch is largely considered a misfeature, break and continue by label
> seem less controversial.)
>
> If there are no plans to add these features, what are the recommended
> ways to emulate these features in a way that compiles to efficient
> machine code?
>
> 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++.)
>

I spent some time piddling with Rust macros but came up empty handed. So 
I don't have a solution, but eliminating obstacles to generating an HTML 
parser strikes me as high priority. I opened an issue for it.

https://github.com/mozilla/rust/issues/2216


More information about the Rust-dev mailing list