Skip to content

monomorphization recursion limit error should be caught earlier #18874

Description

@jonasp

This little program gives a "reached the recursion limit during monomorphization" error.

fn main() {
    go(range(0, 5u));
}

fn go<T>(it: T) where T: Iterator<uint> {
    let mut p = it;
    match p.next() {
        Some(_) => {
            go(p.by_ref());
        }
        None => {}
    }
}

http://is.gd/3iN5Kf

The recursion limit is reached due to wrapping the iterator into ByRefs for every recursion step. IRC suggested that this could be a bug as this should be caught before monomorphization.

Activity

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

    A-type-systemArea: Type systemC-enhancementCategory: An issue proposing an enhancement or a PR with one.I-monomorphizationIssue: An error at monomorphization time.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.T-typesRelevant to the types team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions