Skip to content

Error[E0658] is broken #72611

Closed
Closed
@Ogromny

Description

@Ogromny
fn apply_to_3<F>(f: F) -> i32 where
    F: Fn<i32, Output=i32> {
    f(3)
}

doesn't compile, it's normal but, the error message isn't right:

error[E0658]: the precise format of `Fn`-family traits' type parameters is subject to change
  --> src/main.rs:12:8
   |
12 |     F: Fn<i32, Output=i32> {
   |        ^^ help: use parenthetical notation instead: `Fni32 -> i32`
   |
   = note: see issue #29625 <https://github.com/rust-lang/rust/issues/29625> for more information

Fni32 -> i32 is missing parentheses. And E0658 is not an error about Fn-family traits.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`C-bugCategory: This is a bug.D-invalid-suggestionDiagnostics: A structured suggestion resulting in incorrect code.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions