Skip to content

FP expected fn foo(), found unsafe fn bar(): match arms that returns different kinds of functions #22990

Description

@matthiaskrgr
const fn foo() {}
unsafe fn bar() {}
fn baz() {}

fn main() {
 let x = match 2 {
  2 => foo,
  3 => bar,
  _ => baz
 };
}

this compiles with rustc but shows error in ra diag:

at crate ra, file /tmp/ra/src/main.rs: Error RustcHardError("E0308") from LineCol { line: 7, col: 7 } to LineCol { line: 7, col: 10 }: expected fn foo(), found unsafe fn bar()

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-tytype system / type inference / traits / method resolutionC-bugCategory: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions