Skip to content

"Expected fn, found something" should say "Expected fn or type, found something" #21153

Closed
@wackywendell

Description

@wackywendell

If you are trying to write a new trait that should look like this:

trait MyTrait<T> : Iterator {
    type Item = T
    ...
}

And you leave out the word type, like in this example, you get the error message

error: expected `fn`, found `Item`

Even though the missing word is type, not fn.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsA-parserArea: The lexing & parsing of Rust source code to an AST

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions