Skip to content

Allow break and others inside do blocks (or stack closures in general) #3818

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mitsuhiko opened this issue Oct 20, 2012 · 1 comment
Closed

Comments

@mitsuhiko
Copy link
Contributor

Right now you can't break from a loop inside a stack closure. That's counter intuitive. Intended example usage:

    loop {
        do sdl::poll_events |event| {
            match event {
                sdl::QuitEvent => { break; }
                _ => {}
            }
        }
    }

Compiler error currently:

test.rs:11:36: 11:42 error: `break` outside of loop
test.rs:11                 sdl::QuitEvent => { break; }
                                               ^~~~~~
@bblum
Copy link
Contributor

bblum commented Oct 20, 2012

dup of #3064.

@bblum bblum closed this as completed Oct 20, 2012
RalfJung pushed a commit to RalfJung/rust that referenced this issue Aug 18, 2024
epoll: iterate through output buffer then fetch an event from ready list

Fixes rust-lang#3812
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants