Skip to content

Stack overflow with "recursive" associated type #21946

Closed
@kyledewey

Description

@kyledewey

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-associated-itemsArea: Associated items (types, constants & functions)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions