mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
Record derive helper attributes, resolve them in IDE layer
This commit is contained in:
parent
4e60db2d07
commit
aa1491ecde
22 changed files with 144 additions and 58 deletions
|
@ -934,11 +934,11 @@ fn derive_macro_as_call_id(
|
|||
derive_attr: AttrId,
|
||||
derive_pos: u32,
|
||||
krate: CrateId,
|
||||
resolver: impl Fn(path::ModPath) -> Option<MacroDefId>,
|
||||
) -> Result<MacroCallId, UnresolvedMacro> {
|
||||
let def: MacroDefId = resolver(item_attr.path.clone())
|
||||
resolver: impl Fn(path::ModPath) -> Option<(MacroId, MacroDefId)>,
|
||||
) -> Result<(MacroId, MacroDefId, MacroCallId), UnresolvedMacro> {
|
||||
let (macro_id, def_id) = resolver(item_attr.path.clone())
|
||||
.ok_or_else(|| UnresolvedMacro { path: item_attr.path.clone() })?;
|
||||
let res = def.as_lazy_macro(
|
||||
let call_id = def_id.as_lazy_macro(
|
||||
db.upcast(),
|
||||
krate,
|
||||
MacroCallKind::Derive {
|
||||
|
@ -947,7 +947,7 @@ fn derive_macro_as_call_id(
|
|||
derive_attr_index: derive_attr.ast_index,
|
||||
},
|
||||
);
|
||||
Ok(res)
|
||||
Ok((macro_id, def_id, call_id))
|
||||
}
|
||||
|
||||
fn attr_macro_as_call_id(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue