Skip to content

Missing PartialEq for function pointers containing &mut #74776

@kstrafe

Description

@kstrafe

I tried this code:

fn main() {
    fn f(_: &mut ()) {}
    let x: fn(&mut ()) = f;
    let y: fn(&mut ()) = f;
    y == x;
}

I expected to see this happen: Successful compile.

Instead, this happened:

error[E0369]: binary operation `==` cannot be applied to type `for<'r> fn(&'r mut ())`
  --> src/main.rs:94:7
   |
94 |     y == x;
   |     - ^^ - for<'r> fn(&'r mut ())
   |     |
   |     for<'r> fn(&'r mut ())

error: aborting due to previous error

For more information about this error, try `rustc --explain E0369`.
error: could not compile `executor`.

To learn more, run the command again with --verbose.

Meta

rustc --version --verbose:

rustc 1.46.0-nightly (6bb3dbfc6 2020-06-22)

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions