mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 07:04:49 +00:00
Shrink MacroCallLoc
This commit is contained in:
parent
87e0bbc534
commit
abe3177445
7 changed files with 69 additions and 45 deletions
|
@ -745,6 +745,7 @@ impl<'a> AssocItemCollector<'a> {
|
|||
self.collect_macro_items(res, &|| hir_expand::MacroCallKind::FnLike {
|
||||
ast_id: InFile::new(file_id, ast_id),
|
||||
expand_to: hir_expand::ExpandTo::Items,
|
||||
eager: None,
|
||||
});
|
||||
}
|
||||
Ok(None) => (),
|
||||
|
@ -754,6 +755,7 @@ impl<'a> AssocItemCollector<'a> {
|
|||
MacroCallKind::FnLike {
|
||||
ast_id: InFile::new(file_id, ast_id),
|
||||
expand_to,
|
||||
eager: None,
|
||||
},
|
||||
Clone::clone(path),
|
||||
));
|
||||
|
|
|
@ -1410,10 +1410,10 @@ fn macro_call_as_call_id_with_eager(
|
|||
})
|
||||
}
|
||||
_ if def.is_fn_like() => ExpandResult {
|
||||
value: Some(def.as_lazy_macro(
|
||||
value: Some(def.make_call(
|
||||
db,
|
||||
krate,
|
||||
MacroCallKind::FnLike { ast_id: call.ast_id, expand_to },
|
||||
MacroCallKind::FnLike { ast_id: call.ast_id, expand_to, eager: None },
|
||||
call_site,
|
||||
)),
|
||||
err: None,
|
||||
|
|
|
@ -116,7 +116,7 @@ pub(super) fn attr_macro_as_call_id(
|
|||
_ => None,
|
||||
};
|
||||
|
||||
def.as_lazy_macro(
|
||||
def.make_call(
|
||||
db.upcast(),
|
||||
krate,
|
||||
MacroCallKind::Attr {
|
||||
|
@ -140,7 +140,7 @@ pub(super) fn derive_macro_as_call_id(
|
|||
let (macro_id, def_id) = resolver(item_attr.path.clone())
|
||||
.filter(|(_, def_id)| def_id.is_derive())
|
||||
.ok_or_else(|| UnresolvedMacro { path: item_attr.path.clone() })?;
|
||||
let call_id = def_id.as_lazy_macro(
|
||||
let call_id = def_id.make_call(
|
||||
db.upcast(),
|
||||
krate,
|
||||
MacroCallKind::Derive {
|
||||
|
|
|
@ -1451,7 +1451,11 @@ impl DefCollector<'_> {
|
|||
if let Err(UnresolvedMacro { path }) = macro_call_as_call_id {
|
||||
self.def_map.diagnostics.push(DefDiagnostic::unresolved_macro_call(
|
||||
directive.module_id,
|
||||
MacroCallKind::FnLike { ast_id: ast_id.ast_id, expand_to: *expand_to },
|
||||
MacroCallKind::FnLike {
|
||||
ast_id: ast_id.ast_id,
|
||||
expand_to: *expand_to,
|
||||
eager: None,
|
||||
},
|
||||
path,
|
||||
));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue