Skip to content

"Fatal error: exception Assert_failure("boot/me/trans.ml", 2912, 6)" with return from for-each block #100

@jorendorff

Description

@jorendorff
Contributor
// Fatal error: exception Assert_failure("boot/me/trans.ml", 2912, 6)
iter x() -> int { 
}
fn f() -> bool {
    for each (int i in x()) {
        ret true;
    }
    ret false;
}
fn main(vec[str] args) -> () {
}

But if you change the return type to (), different error:

// E:Assembly error: unrecognized quad 41: jmp <none>
iter x() -> int { 
}
fn f() -> () {
    for each (int i in x()) {
        ret;
    }
}
fn main(vec[str] args) -> () {
}

Activity

graydon

graydon commented on Jul 12, 2010

@graydon
Contributor

There's no support for breaking out of a foreach loop yet. The call protocol associated with put statements needs to understand that the inner block can return with different status indicators (returning from controlling frame, breaking loop, continuing loop) and propagate these outwards as needed. It's a bit of a task, but you're welcome to take it!

graydon

graydon commented on Jul 22, 2010

@graydon
Contributor

Filed feature-request as #119. This one remains about an un-trapped unimpl case.

graydon

graydon commented on Jul 22, 2010

@graydon
Contributor

Add XFAIL'ed test for return-in-iter, call unimpl when we find it. Closed by eaa3561.

added a commit that references this issue on Oct 17, 2011
eaa3561
added a commit that references this issue on Jul 19, 2017
added a commit that references this issue on Jun 30, 2020
74f08e0
added a commit that references this issue on Oct 1, 2021
a9a1c9d
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

        Participants

        @graydon@jorendorff

        Issue actions

          "Fatal error: exception Assert_failure("boot/me/trans.ml", 2912, 6)" with return from for-each block · Issue #100 · rust-lang/rust