Auto merge of #14875 - ponyii:fix/implement-missing-members-do-not-transform-lifetimes, r=Veykril

fix: implemeted lifetime transformation fot assits

A part of https://github.com/rust-lang/rust-analyzer/issues/13363
I expect to implement transformation of const params in a separate PR

Other assists and a completion affected:
- `generate_function` currently just ignores lifetimes and, consequently, is not affected
- `inline_call` and `replace_derive_with...` don't seem to need lifetime transformation
- `trait_impl` (a completion) is fixed and tested
This commit is contained in:
bors 2023-06-10 13:22:50 +00:00
commit 95228d23bb
4 changed files with 151 additions and 29 deletions

View file

@ -2641,14 +2641,22 @@ impl GenericDef {
Either::Right(x) => GenericParam::TypeParam(x),
}
});
let lt_params = generics
self.lifetime_params(db)
.into_iter()
.map(GenericParam::LifetimeParam)
.chain(ty_params)
.collect()
}
pub fn lifetime_params(self, db: &dyn HirDatabase) -> Vec<LifetimeParam> {
let generics = db.generic_params(self.into());
generics
.lifetimes
.iter()
.map(|(local_id, _)| LifetimeParam {
id: LifetimeParamId { parent: self.into(), local_id },
})
.map(GenericParam::LifetimeParam);
lt_params.chain(ty_params).collect()
.collect()
}
pub fn type_params(self, db: &dyn HirDatabase) -> Vec<TypeOrConstParam> {