-
Notifications
You must be signed in to change notification settings - Fork 13.3k
port the "autoref-arg" code used in overloaded operators to use the ptr adjustment table #3548
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
Comments
This is more of cleanup than an enhancement. Punting to 0.6. |
non-critical for 0.6, de-milestoning |
#5304 is the const part of this, I think. There might be other pieces that are already done; it looked as if expr translation was using adjustments when I was fixing consts, I think. |
@jld expr translation does use adjustments in general, but not to handle the autoref of arguments associated with operators. |
Confirmed 2013-05-29, this is still legit and is not a backwards compatibility risk, just eliminating redundancy inside the compiler. |
Visiting again for triage. Still appears to be a living issue in the compiler. |
Visiting for triage, FIXME still present. |
I have a branch that implemented this. It turns out to be somewhat more difficult than I anticipated, because the current rules permit things that autoref cannot currently express, such as using both autoref from an adjustment AND the magical operator autoref. I'm not a fan of supporting this anyhow but I deferred this branch in favor of finishing up some more pressing matters. |
@nikomatsakis Can this be closed? |
Sadly no. However, the difficulties I mentioned in my previous comment probably no longer apply since method dispatch has been made more regular. |
(Actually, I wonder if it can be closed.. I may have accidentally done this while doing the method dispatch operator overloading.) |
Well, I don't think we can close it, because the autoref machinery is still there, but it might be that all the interesting work is done. |
and what remains is to remove the outdated code |
Triage: this seems to be about deep compiler stuff that's probably gone by now. Is that true, @nikomatsakis ? |
Sadly it is not gone by now. But it's also a long standing bug that is not that important, MIR makes it even less relevant. |
For the record, this is currently handled in |
@eddyb maybe we should just close this? I feel like it'll be fixed "in passing" at some point, but I'm not sure that keeping the bug open is very valuable. |
Agreed, the only realistic way this may happen if HAIR is output from typeck. |
Turns out that it's not that hard of a change, so I'm doing it as minor cleanup in a future PR. |
Decompose Adjustment into smaller steps and remove the method map. The method map held method callee information for: * actual method calls (`x.f(...)`) * overloaded unary, binary, indexing and call operators * *every overloaded deref adjustment* (many can exist for each expression) That last one was a historical ~~accident~~ hack, and part of the motivation for this PR, along with: * a desire to compose adjustments more freely * containing the autoderef logic better to avoid mutation within an inference snapshot * not creating `TyFnDef` types which are incompatible with the original one * i.e. we used to take a`TyFnDef`'s `for<'a> &'a T -> &'a U` signature and instantiate `'a` using a region inference variable, *then* package the resulting `&'b T -> &'b U` signature in another `TyFnDef`, while keeping *the same* `DefId` and `Substs` * to fix #3548 by explicitly writing autorefs for the RHS of comparison operators Individual commits tell their own story, of "atomic" changes avoiding breaking semantics. Future work based on this PR could include: * removing the signature from `TyFnDef`, now that it's always "canonical" * some questions of variance remain, as subtyping *still* treats the signature differently * moving part of the typeck logic for methods, autoderef and coercion into `rustc::traits` * allowing LUB coercions (joining multiple expressions) to "stack up" many adjustments * transitive coercions (e.g. reify or unsize after multiple steps of autoderef) r? @nikomatsakis
…ttributes Fix normalisation of multiline doc attributes
make many-seeds a mode of ./miri run rather than a separate command Also parallelize it so we use all cores to try seeds at the same time. Fixes rust-lang/miri#3509 by not alternating between different build modes (with/without dev-dependencies) all the time.
make many-seeds a mode of ./miri run rather than a separate command Also parallelize it so we use all cores to try seeds at the same time. Fixes rust-lang/miri#3509 by not alternating between different build modes (with/without dev-dependencies) all the time.
We have this nice table in the tcx called
adjustments
that's supposed to track when an expression is being auto-ref'd or auto-deref'd. It would make borrowck, trans, and other pieces of code that are concerned with this "just work". But it's not being used for overloaded operators right now.The text was updated successfully, but these errors were encountered: