-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Tighten up the auto-deref algorithm #13542
Comments
Is this a dupe of #12825? |
No. I think what @brson was thinking of was an idea I had to make auto-deref behavior more predictable. The basic plan was to say that we always autoderef until we find a type T where one of the following conditions is true:
Such a plan would probably best go through the RFC process, and it might need some fine-tuning as well. I had planned to do some local experiments first. There are a fair number of pre-requisites, among them #5527 (which I think encompasses #12825). |
Assigning P-backcompat-lang, 1.0. |
Specifically: can we make it possible to add methods to smart pointers without breaking backwards compatibility for users of those smart pointers? Also, is there a way to make smart pointers able to explicitly identify methods that they DO want to override? For example, One issue with my proposal in general is that if I implement a trait on a pointer type, you still won't be able to use that trait with method notation. In other words,
and
cannot be used in an equivalent way (in fact, they are not quite equivalent in the trait method resolution algorithm I already proposed; that's something I ... kind of forgot about and was meaning to rectify. But it's not too hard to rectify today). |
@nikomatsakis Is there an RFC on this? If so, could you link to it? If not, could you make one? |
I have not made an RFC. I've been hoping to finish #5527 / UFCS and do some experiments. Perhaps that is too conservative. I'll try to write something up, sure. |
After talking with Niko I'd like to nominate this for removal from 1.0. We don't have clear ideas on what to do here. |
(postponing to triage where at least one of {patrick, niko} is present.) |
(okay patrick came back.) @pcwalton relays that during a 1:1 discussion with niko, their consensus is that the potential cures they could conceive seemed potentially worse than the disease here. So taking off the 1.0 milestone, at least until someone proposed an RFC that is actually a net improvement. In the meantime, the safest way to defend the issues described here that I can see is to use top-level functions rather than methods to manipulate the state of the smart pointer itself and avoid the auto-deref'ing. Closing. |
…r=y21 [`implicit_saturating_sub`] Fix suggestion with a less volatile approach Related to rust-lang#13533, such and obvious mistake got pass my watch, quite embarassing :/ Revert rust-lang#13533 and implement a more robust solution. Revert "Fix span issue on `implicit_saturating_sub` This reverts commit 140a127. changelog: [`lint_name`]: Fix suggestion for `if {} else if {} else {}` cases r? `@y21`
@nikomatsakis has mentioned that it has some unpredictable interactions with type checking. Hard to spec and understand as-is. Nominating.
The text was updated successfully, but these errors were encountered: