Skip to content

Compiler stack overflow caused by specific generics syntax #22375

Closed

Description

@mattias-p

I tried pulling the old Java enum generics cleverness on rustc, and depending on the syntax used it either works as expected or plainly crashes.

This works just fine:

trait A<T> where T: A<T> {}

However this really upsets the compiler:

trait A<T: A<T>> {}
$ RUST_BACKTRACE=1 rustc src/lib.rs --crate-type lib

thread 'rustc' has overflowed its stack
Illegal instruction 
$ rustc --version --verbose
rustc 1.0.0-nightly (b63cee4a1 2015-02-14 17:01:11 +0000)
binary: rustc
commit-hash: b63cee4a11fcfecf20ed8419bc3bd6859e6496bc
commit-date: 2015-02-14 17:01:11 +0000
host: x86_64-unknown-linux-gnu
release: 1.0.0-nightly
$ uname -a
Linux rust-m2 3.13.0-45-generic #74+7.0trisquel2 SMP Sat Jan 31 14:07:55 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

Activity

  1. steveklabnik commented on Feb 15, 2015

    @steveklabnik
    Contributor

    Is this a dup of #12644 ?

  2. nham commented on Jun 24, 2015

    @nham
    Contributor

    The code currently compiles, so I believe this issue can be closed.

  3. added
    E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.
    on Jun 24, 2015
  4. frewsxcv commented on Jun 24, 2015

    @frewsxcv
    Contributor

    I'll add a regression test

  5. added a commit that references this issue on Jun 24, 2015
    e2c273f
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 systemE-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions