mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 13:51:31 +00:00
Implement autoderef using the Deref trait
- add support for other lang item targets, since we need the Deref lang item
This commit is contained in:
parent
49489dc20c
commit
9c5e7dd849
11 changed files with 153 additions and 48 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