From 9c5e7dd849eff7bd6f20aa353feef083d089ff58 Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Sun, 12 May 2019 18:33:47 +0200 Subject: Implement autoderef using the Deref trait - add support for other lang item targets, since we need the Deref lang item --- crates/ra_ide_api/src/completion/complete_dot.rs | 2 +- crates/ra_ide_api/src/goto_type_definition.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'crates/ra_ide_api/src') diff --git a/crates/ra_ide_api/src/completion/complete_dot.rs b/crates/ra_ide_api/src/completion/complete_dot.rs index 0822a0e7e..f26fd06b3 100644 --- a/crates/ra_ide_api/src/completion/complete_dot.rs +++ b/crates/ra_ide_api/src/completion/complete_dot.rs @@ -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)) => { diff --git a/crates/ra_ide_api/src/goto_type_definition.rs b/crates/ra_ide_api/src/goto_type_definition.rs index 0f638b170..6f5164e0b 100644 --- a/crates/ra_ide_api/src/goto_type_definition.rs +++ b/crates/ra_ide_api/src/goto_type_definition.rs @@ -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])) -- cgit v1.2.3