Skip to content

Least-Upper-Bound coercions don't document special behaviour of coercing to fnptrs #2094

@BoxyUwU

Description

@BoxyUwU
fn foo() {}
fn bar() {}

let a = match true {
    true => foo,
    false => bar,
};

Here we wind up with a LUB coercion between two different function item types. This succeeds by coercing both types to function pointers.

The current documentation for type coercions defines LUB coercions as simply trying one-to-one coercion both ways and then trying to compute a mutual supertype if that fails. It should also document that when we have a LUB coercion between function item types and closures we'll coerce to a function pointer if there's no mutual supertype.

Metadata

Metadata

Assignees

No one assigned

    Labels

    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