Skip to content

Infinite recursion with associated type bounded by its trait #23122

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

Closed
laijs opened this issue Mar 6, 2015 · 1 comment
Closed

Infinite recursion with associated type bounded by its trait #23122

laijs opened this issue Mar 6, 2015 · 1 comment
Labels
A-associated-items Area: Associated items (types, constants & functions) A-type-system Area: Type system E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added.

Comments

@laijs
Copy link

laijs commented Mar 6, 2015

trait Next {
    type Next: Next;
}

struct GetNext<T: Next> { t: T}

impl<T: Next> Next for GetNext<T> {
    // type Next = <GetNext<T> as Next>::Next; // thread 'rustc' has overflowed its stack and core dump
    type Next = <GetNext<T::Next> as Next>::Next; // the rustc runs forever
}

fn main() {}
@kmcallister kmcallister changed the title rustc doesn't handle well with recursive in traits Infinite recursion with associated type bounded by its trait Mar 7, 2015
@kmcallister kmcallister added A-amusing A-associated-items Area: Associated items (types, constants & functions) A-type-system Area: Type system labels Mar 7, 2015
@mattico
Copy link
Contributor

mattico commented Apr 9, 2016

This now properly gives E0275.

http://is.gd/KDW7SG

@arielb1 arielb1 added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label Apr 22, 2016
dsprenkels added a commit to dsprenkels/rust that referenced this issue Jun 16, 2016
bors added a commit that referenced this issue Jun 16, 2016
Add regression tests for #23122

This PR adds two regression tests for #23122.

Closes #23122.
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) A-type-system Area: Type system E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added.
Projects
None yet
Development

No branches or pull requests

4 participants