mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 22:01:37 +00:00
Merge #1408
1408: Associated type basics & Deref support r=matklad a=flodiebold This adds the necessary Chalk integration to handle associated types and uses it to implement support for `Deref` in the `*` operator and autoderef; so e.g. dot completions through an `Arc` work now. It doesn't yet implement resolution of associated types in paths, though. Also, there's a big FIXME about handling variables in the solution we get from Chalk correctly. Co-authored-by: Florian Diebold <flodiebold@gmail.com>
This commit is contained in:
commit
b81caed43f
19 changed files with 455 additions and 71 deletions
|
@ -15,7 +15,7 @@ pub(super) fn complete_dot(acc: &mut Completions, ctx: &CompletionContext) {
|
|||
}
|
||||
|
||||
fn complete_fields(acc: &mut Completions, ctx: &CompletionContext, receiver: Ty) {
|
||||
for receiver in receiver.autoderef(ctx.db) {
|
||||
for receiver in ctx.analyzer.autoderef(ctx.db, receiver) {
|
||||
if let Ty::Apply(a_ty) = receiver {
|
||||
match a_ty.ctor {
|
||||
TypeCtor::Adt(AdtDef::Struct(s)) => {
|
||||
|
|
|
@ -30,7 +30,7 @@ pub(crate) fn goto_type_definition(
|
|||
return None;
|
||||
};
|
||||
|
||||
let adt_def = ty.autoderef(db).find_map(|ty| ty.as_adt().map(|adt| adt.0))?;
|
||||
let adt_def = analyzer.autoderef(db, ty).find_map(|ty| ty.as_adt().map(|adt| adt.0))?;
|
||||
|
||||
let nav = NavigationTarget::from_adt_def(db, adt_def);
|
||||
Some(RangeInfo::new(node.range(), vec![nav]))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue