Skip to content

rustc does not detect some recursive struct definitions #17431

@pythonesque

Description

@pythonesque

I think the impl is just necessary to get Rust to try to instantiate it (otherwise it assumes it's unused). This may be a duplicate of issue #4363.

use std::sync::Mutex;

struct Foo {
    foo: Mutex<Option<Foo>>,
}

impl Foo {
    fn bar(self) {}
}

fn main() {}

task 'rustc' has overflowed its stack

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions