Skip to content

when calling a trait method expecting one unit type argument, hint for E0061 puts the unit type in the wrong position #45056

Closed
@tinaun

Description

@tinaun
#![feature(fn_traits)]

fn main() {
    let closure = || { 3 };
    
    closure.call_once();
}

becomes:

   Compiling playground v0.0.1 (file:///playground)
error[E0061]: this function takes 1 parameter but 0 parameters were supplied
  --> src/main.rs:18:13
   |
18 |     closure.call_once();
   |             ^^^^^^^^^
   |
help: expected the unit value `()`. You can create one with a pair of parenthesis
   |
18 |     closure.call_onc()e();
   |         

playground link: https://play.rust-lang.org/?gist=c18a4d629e72869e75a7a3b747b8de83&version=nightly

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsC-bugCategory: This is a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions