Skip to content

Poor error for manual implementations of function traits #39259

Closed
@jdm

Description

@jdm
#![feature(fn_traits)]

struct S;

impl Fn(u32) -> u32 for S {
    fn call(&self) -> u32 {
        5
    }
}

fn main() {
}

This yields:

error[E0229]: associated type bindings are not allowed here
 --> foo2.rs:5:17
  |
5 | impl Fn(u32) -> u32 for S {
  |                 ^^^ associate type not allowed here

error: aborting due to previous error

Which is extremely confusing and non-actionable.

Metadata

Metadata

Assignees

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.D-confusingDiagnostics: Confusing error or lint that should be reworked.D-incorrectDiagnostics: A diagnostic that is giving misleading or incorrect information.D-terseDiagnostics: An error or lint that doesn't give enough information about the problem at hand.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions