-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Rewrite how trait-impl matching works in typeck #3742
Comments
Here is a test case where inference fails:
|
Actually, this example is illustrating a bit of a different bug than I thought it was. Here the bug is that operator overloading doesnt' attempt eager resolution. If you rewrite 'a * 3f' to 'a.mul(3f)' it works fine. |
I still think we should do this refactoring but I am not sure if it it will ultimately make inference work any better =) |
Nominating for milestone 5, production-ready |
punting to later bug triage with niko present |
accepted for well-defined milestone |
Triage bump. It still needs to be implemented. @nikomatsakis mentioned he has a concrete plan for it and he'll write it down later this week. |
Triage bump. Is this relevant? I tried and failed to create a test case for it. Might be related to #5527? |
Nominating for removal from "P-backcompat-lang". Should this issue even be open any more? |
closing as dupe of #5527. |
Move `needless_borrow` to style fixes: rust-lang#3742 rust-lang#7105 should be merged first to fix the false positive. changelog: move `needless_borrow` from `nursery` to `style`
TB: Reserved + Protected + IM + lazy is a horrible combination that should not exist As discovered by `@JoJoDeveloping,` the result of having both Protector exceptions on lazy locations (protectors only protect initialized bytes) and interior mutability exceptions for protected tags (Reserved IM does not accept foreign writes when protected) leads to some very undesirable results, namely that we cannot do spurious writes even on protected activated locations. We propose that Protected Reserved IM should no longer exist and instead when a type is retagged as part of a `FnEntry` it is assumed to lose interior mutability. In fact, this was already being done implicitly because relevant transitions were guarded by an `if protected`, but the difference is that now it also applies to transitions that occur after the end of the protector.
Right now, we have this hokey thing where it walks the tree at the end, but sometimes (to help with inference) does resolution eagerly, and it's all a big mess. Besides being hard to understand and inefficient, this also means that inference often fails where it could succeed. An example is the overloading example I gave in my blog post, where the result type often fails to be inferred (at least according to some folk on IRC, I haven't experimented much with this myself, so I don't have a precise test case).
I want to have it work something like this:
a.b()
always a method call, refactor how methods are represented in the compiler #3446These pairs more-or-less correspond to Haskell's type contexts. "Eager resolution" is context simplification. The only reason it's reasonable to use pairs is if we decide to enforce overload freedom, as I described in my blog post.
Also, to ensure termination, it may be necessary to add a depth to these pairs, unless we decide to enforce something like Haskell's Paterson or Basic conditions (which I am not sure how I feel about).
The text was updated successfully, but these errors were encountered: