Skip to content

Check if we can get away with making fn() conflict with &T #54351

Open
@hanna-kruppe

Description

@hanna-kruppe

There's the idea that the fn(...) -> R types should be unsized types (like extern type) and function pointers should be proper pointers (e.g. &'a fn()). On its face this appears backwards incompatible in ways editions can't paper over, e.g. if we desugar fn() to &'static fn() in 2015 these two impls would suddenly start conflicting:

trait Foo {}
impl<'a, T: ?Sized> Foo for &'a T {}
impl Foo for fn() {}

@eddyb wants to try implementing it quickly and hackily it to see what breaks:

I think we can do this in type unification, and treat fn() like &SomeLibCoreLangItem there, without changing fn() itself

Metadata

Metadata

Assignees

No one assigned

    Labels

    T-langRelevant to the language team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions