Skip to content

"Found value name used as type" #7607

Closed
@bytwise

Description

@bytwise

Trying to compile:

struct Foo {
    x: int
}

impl Fo {
    fn foo() {}
}

fn main() {}

gives the unhelpful error:

main.rs:5:5: 5:7 error: found value name used as a type: def_mod({crate: 0, node: 13})
main:rs:5 impl Fo {
               ^~

A better error message would be:

error: use of undeclared type name `Fo`

Even better would be, if it could recognize the typo:

error: use of undeclared type name `Fo`. Did you mean `Foo`?

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lints

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions