Skip to content

Confusing error messages with ||-closures vs binary "||" #2783

Description

@bblum
fn foo(f: fn()) { f() }
fn main() {
    foo || {}; 
}

produces:

shit.rs:4:4: 4:13 error: binary operation || cannot be applied to type `extern fn(fn())

It'd be nice if it checked if the thing on the left had type "fn(fn * -> *) -> *", and said "Did you mean do foo || ... ?"

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-frontendArea: Compiler frontend (errors, parsing and HIR)E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions