Internal: Cleanup proc-macro error handling

This commit is contained in:
Lukas Wirth 2024-07-26 14:36:13 +02:00
parent df15b6f668
commit 7beac14cba
39 changed files with 380 additions and 522 deletions

View file

@ -657,22 +657,17 @@ impl<'a> AssocItemCollector<'a> {
// crate failed), skip expansion like we would if it was
// disabled. This is analogous to the handling in
// `DefCollector::collect_macros`.
if exp.is_dummy() {
self.diagnostics.push(DefDiagnostic::unresolved_proc_macro(
if let Some(err) = exp.as_expand_error(self.module_id.krate) {
self.diagnostics.push(DefDiagnostic::macro_error(
self.module_id.local_id,
loc.kind,
loc.def.krate,
ast_id,
err,
));
continue 'attrs;
}
if exp.is_disabled() {
continue 'attrs;
}
}
self.macro_calls.push((ast_id, call_id));
let res =
self.expander.enter_expand_id::<ast::MacroItems>(self.db, call_id);
self.collect_macro_items(res);