Skip to content

Labelled break outside of for loop doesn't work #7299

Closed

Description

@hoelzro

(using Rust compiled from commit dc4560d)

The following code fails to compile:

fn main() {
    'outer: loop {
        match () {
            () => {
                for std::uint::iterate(0, 8) |_| {
                    loop {
                        break 'outer;
                    }
                }
            },
        }
    }
}

with the following error:

/tmp/test.rs:7:24: 7:37 error: internal compiler error: Break to unknown label   
/tmp/test.rs:7                         break 'outer;
                                             ^~~~~~~~~~~~~

If you comment out the for loop, it compiles fine.

Activity

  1. catamorphism commented on Jun 23, 2013

    @catamorphism
    Contributor

    This is a known bug - #4131 . I'm closing this as a duplicate, but keep the bug reports coming! It's always better to have a duplicate than to miss out on hearing about an unreported bug.

  2. added 2 commits that reference this issue on Jul 1, 2021
  3. added a commit that references this issue on Aug 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions