Skip to content
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

rustc infinite loop on recursive type (FingerTree, indirectly polymorphic/nonregular) #52852

Open
pnkfelix opened this issue Jul 30, 2018 · 2 comments
Assignees
Labels
I-hang Issue: The compiler never terminates, due to infinite loops, deadlock, livelock, etc. P-medium Medium priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@pnkfelix
Copy link
Member

Spawned off of #4363, specifically the example provided by @goffrie

This example code causes rustc to infinite loop (playground):

enum FingerTree<A> {
    Empty,
    Single(A),
    Deep(Node<A>)
}

struct Node<A> {
    count: i32,
    front: Digit<A>,
    inner: Box<FingerTree<(A,A)>>,
    back: Digit<A>
}

struct Digit<A> {
    count: i32,
    content: [Option<A>; 4]
}

fn FingerTree<A>() -> FingerTree<A> { FingerTree::Empty }

fn main() {
    let _ = FingerTree::Deep(Node { count: 0,
        front: Digit { count: 0, content: [None, None, None, None] },
        inner: Box::new(FingerTree::Single((1, 2))),
        back: Digit { count: 0, content: [None, None, None, None] }}
    );
}
@pnkfelix pnkfelix added P-medium Medium priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jul 30, 2018
@pnkfelix
Copy link
Member Author

pnkfelix commented Jul 30, 2018

I wonder if we should have a specific I-diverges, I-hang, or I-infinite-loop label.

Such cases often cause stack overflows (which then usually get categorized as an ICE), but this particular instance is not overflowing; its just infinite looping AFAICT, which is in some ways much worse than an ICE, since infinite loops are often much more annoying to deal with in various environments.

(I kind of like the I-hang label, since that would presumably also cover cases of deadlock or livelock in stdlib routines that should not be allowed to do so, and thus be a more generally useful label.)

@pnkfelix pnkfelix changed the title rustc infinite loop on recursive type (FingerTree) rustc infinite loop on (indirectly polymorphic/nonregular) recursive type (FingerTree) Jul 30, 2018
@pnkfelix pnkfelix changed the title rustc infinite loop on (indirectly polymorphic/nonregular) recursive type (FingerTree) rustc infinite loop on recursive type (FingerTree, indirectly polymorphic/nonregular) Jul 30, 2018
@nikomatsakis nikomatsakis self-assigned this Dec 20, 2018
@varkor varkor added the I-hang Issue: The compiler never terminates, due to infinite loops, deadlock, livelock, etc. label Dec 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-hang Issue: The compiler never terminates, due to infinite loops, deadlock, livelock, etc. P-medium Medium priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants
@nikomatsakis @pnkfelix @varkor and others