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

Tricky type definition can cause inhabitedness check to go into an infinite loop. #39489

Closed
canndrew opened this issue Feb 3, 2017 · 1 comment

Comments

@canndrew
Copy link
Contributor

canndrew commented Feb 3, 2017

This code:

struct Foo<'a, T: 'a> {
    ph: std::marker::PhantomData<T>,
    foo: &'a Foo<'a, (T, T)>,
}

fn wub(f: Foo<!>) {
    match f {}
}

Causes rustc to stack overflow. This should be pretty easy to "fix" by just putting a recursion limit in is_uninhabited_from and returning false when it gets hit. What's a suitable limit here? Presumably there are other limits like this in other places in the compiler.

canndrew added a commit to canndrew/rust that referenced this issue Feb 9, 2017
@canndrew
Copy link
Contributor Author

canndrew commented Feb 9, 2017

This is fixed in #39680

bors added a commit that referenced this issue Feb 12, 2017
…elb1

Add recursion limit to inhabitedness check

Fixes #39489.
Add test aswell.
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

1 participant