Skip to content

error message does not include function it refers to, only says "this function" (E0061) #45633

Closed
@codyps

Description

@codyps
error[E0061]: this function takes 2 parameters but 1 parameter was supplied
  --> src/main.rs:63:13
   |
63 |             std::net::SocketAddr::new(ia, 0u16)
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected 2 parameters

error: aborting due to previous error

In this case, this function is tokio_core::net::UdpSocket::bind, but without looking at the code no hint is given:

        let sock = tokio_core::net::UdpSocket::bind(
            std::net::SocketAddr::new(ia, 0u16)
        ).unwrap();

Originally, this function call contained a match statement to calculate the value of ia, which caused the newline-following paren style to be used.

This appears to occur whenever both:

  • using a newline-following paren style (such that the function name does not get included in the context output)
  • calling a function from outside the current crate (so that it's definition is not printed)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.WG-diagnosticsWorking group: Diagnostics

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions