Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
hanna-kruppe opened this issue Sep 19, 2018 · 3 comments
Open

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

hanna-kruppe opened this issue Sep 19, 2018 · 3 comments
Labels
T-lang Relevant to the language team, which will review and decide on the PR/issue.

Comments

@hanna-kruppe
Copy link
Contributor

hanna-kruppe commented Sep 19, 2018

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

@eddyb
Copy link
Member

eddyb commented Sep 19, 2018

I doubt we can change Rust 2018 at all now, but we should be gathering data on coherence/type inference (given this rule), across the ecosystem. cc @nikomatsakis @aturon @Centril

@petrochenkov
Copy link
Contributor

cc rust-lang/rfcs#996 (the last iteration of the relevant RFC)

@jonas-schievink jonas-schievink added the C-future-incompatibility Category: Future-incompatibility lints label Apr 21, 2019
@Centril Centril added T-lang Relevant to the language team, which will review and decide on the PR/issue. and removed C-future-incompatibility Category: Future-incompatibility lints labels Aug 3, 2019
@Centril
Copy link
Contributor

Centril commented Aug 3, 2019

Removing C-future-compatibility since that should be used to track actual C-future-compat lints that have been implemented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-lang Relevant to the language team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

5 participants