Skip to content

Compiler panics on missing 'fn'. #41389

@ghost

Description

Lets say you want to write this:

struct A {
    n: i32,
}

impl A {
    fn n(&self) -> i32 {
        self.n
    }
}

but you forget the fn

struct A {
    n: i32,
}

impl A {
    n(&self) -> i32 {
        self.n
    }
}

then the compiler responds with "note: the compiler unexpectedly panicked. this is a bug." I don't know if its possible but a "missing fn" message would be ideal or at least a "expected one of ! or ::, found ("

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