mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 04:44:57 +00:00
feat: Render hover actions for closure captures and sig
This commit is contained in:
parent
2f8cd66fb4
commit
08dc0e21af
5 changed files with 131 additions and 16 deletions
|
@ -3221,6 +3221,20 @@ impl Closure {
|
|||
.collect()
|
||||
}
|
||||
|
||||
pub fn capture_types(&self, db: &dyn HirDatabase) -> Vec<Type> {
|
||||
let owner = db.lookup_intern_closure((self.id).into()).0;
|
||||
let infer = &db.infer(owner);
|
||||
let (captures, _) = infer.closure_info(&self.id);
|
||||
captures
|
||||
.iter()
|
||||
.cloned()
|
||||
.map(|capture| Type {
|
||||
env: db.trait_environment_for_body(owner),
|
||||
ty: capture.ty(&self.subst),
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
pub fn fn_trait(&self, db: &dyn HirDatabase) -> FnTrait {
|
||||
let owner = db.lookup_intern_closure((self.id).into()).0;
|
||||
let infer = &db.infer(owner);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue