mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 06:11:35 +00:00
Support function pointer MIR lowering
This commit is contained in:
parent
1b85b43e6f
commit
a063f000ff
14 changed files with 468 additions and 164 deletions
|
@ -11,6 +11,7 @@ use hir_def::{
|
|||
lang_item::{LangItem, LangItemTarget},
|
||||
TraitId,
|
||||
};
|
||||
use hir_expand::name::{name, Name};
|
||||
use stdx::panic_context;
|
||||
|
||||
use crate::{
|
||||
|
@ -187,6 +188,14 @@ impl FnTrait {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn method_name(&self) -> Name {
|
||||
match self {
|
||||
FnTrait::FnOnce => name!(call_once),
|
||||
FnTrait::FnMut => name!(call_mut),
|
||||
FnTrait::Fn => name!(call),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_id(&self, db: &dyn HirDatabase, krate: CrateId) -> Option<TraitId> {
|
||||
let target = db.lang_item(krate, self.lang_item())?;
|
||||
match target {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue