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

Stack overflow with "recursive" associated type #21946

Closed
kyledewey opened this issue Feb 4, 2015 · 3 comments
Closed

Stack overflow with "recursive" associated type #21946

kyledewey opened this issue Feb 4, 2015 · 3 comments
Labels
A-associated-items Area: Associated items (types, constants & functions)

Comments

@kyledewey
Copy link

On 3/4/2015 on playpen, the following code:

trait Foo {
    type A;
}

struct FooStruct;

impl Foo for FooStruct {
    type A = <FooStruct as Foo>::A;
}

fn main() { }

...gives the following error:

thread 'rustc' has overflowed its stack
Illegal instruction (core dumped)
playpen: application terminated with error code 132

This may be considered a duplicate of issue #20551, which notes a similar problem with recursive trait bounds. I figured this may be unique given that this involves a recursive associated type on a trait, rather than a recursive trait itself.

@kyledewey
Copy link
Author

cc @nikomatsakis

@solson
Copy link
Member

solson commented Oct 17, 2015

This was just rediscovered in the #rust IRC. Playpen link

@dylanede
Copy link
Contributor

The code that that IRC example was simplified from was code that looked reasonably sane (and was quite far removed from simple recursion like this), so trying to come up with an error message instead of a crash would be quite handy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-associated-items Area: Associated items (types, constants & functions)
Projects
None yet
Development

No branches or pull requests

4 participants