Skip to content

Using Self::EnumVariant fails #53414

Closed
Closed
@varkor

Description

@varkor
enum Enum {
    Variant,
}

impl Enum {
    fn choose() -> Self {
        Self::Variant //~ ERROR no variant named `Variant` found for type `Enum` in the current scope
    }
}

I'm not sure if this is supposed to be allowed or not, but the error message is incorrect. Is there an up-to-date document describing all the places Self is allowed instead of a type name?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions