rust/crates/ide_ssr/src
Florian Diebold 6fb5abbc03 Refactor autoderef and method resolution
- don't return the receiver type from method resolution; instead just
 return the autorefs/autoderefs that happened and repeat them. This
 ensures all the effects like trait obligations and whatever we learned
 about type variables from derefing them are actually applied. Also, it
 allows us to get rid of `decanonicalize_ty`, which was just wrong in
 principle.

 - Autoderef itself now directly works with an inference table. Sadly
 this has the effect of making it harder to use as an iterator, often
 requiring manual `while let` loops. (rustc works around this by using
 inner mutability in the inference context, so that things like unifying
 types don't require a unique reference.)

 - We now record the adjustments (autoref/deref) for method receivers
 and index expressions, which we didn't before.

 - Removed the redundant crate parameter from method resolution, since
 the trait_env contains the crate as well.

 - in the HIR API, the methods now take a scope to determine the trait env.
 `Type` carries a trait env, but I think that's probably a bad decision
 because it's easy to create it with the wrong env, e.g. by using
 `Adt::ty`. This mostly didn't matter so far because
 `iterate_method_candidates` took a crate parameter and ignored
 `self.krate`, but the trait env would still have been wrong in those
 cases, which I think would give some wrong results in some edge cases.

Fixes #10058.
2022-02-25 11:47:14 +01:00
..
errors.rs
fragments.rs compress 2021-12-28 19:17:34 +03:00
from_comment.rs
lib.rs internal: start isolating ssr-related parsing APIs to SSR 2021-12-28 17:00:55 +03:00
matching.rs Rename *Owner traits to Has* 2021-09-27 12:54:24 +02:00
nester.rs Simplify 2021-09-19 23:34:07 +02:00
parsing.rs move the rest of ssr parsing to fragments 2021-12-28 17:00:55 +03:00
replacing.rs last use of parse api in ssr 2021-12-28 17:00:55 +03:00
resolving.rs Refactor autoderef and method resolution 2022-02-25 11:47:14 +01:00
search.rs maybe? 2021-11-04 22:01:59 +01:00
tests.rs add test 2021-12-28 17:00:55 +03:00