Skip to content

Compiler stack overflow caused by specific generics syntax #22375

Closed
@mattias-p

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

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