Skip to content

Stack overflow with recursive types #1

@peterjoel

Description

@peterjoel

Any recursive type will cause a stack overflow.

e.g.

#[derive(TypeHash)]
struct Recursive {
    foo: Option<Box<Recursive>>,
}

Produces:

thread 'recursive_generic_type_terminates' has overflowed its stack
fatal runtime error: stack overflow

That simple example could be detected in the macro, but it can't in the general case. e.g. mutually recursive types:

#[derive(TypeHash)]
struct A {
    foo: Option<Box<B>>,
}

#[derive(TypeHash)]
struct B {
    foo: Option<Box<A>>,
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions