Skip to content

Commit 7fba0c1

Browse files
committed
Better error message for when proc-macros have not yet been built
1 parent 0e5d3b4 commit 7fba0c1

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

crates/ide-diagnostics/src/handlers/unresolved_proc_macro.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ pub(crate) fn unresolved_proc_macro(
3232
let severity = if config_enabled { Severity::Error } else { Severity::WeakWarning };
3333
let def_map = ctx.sema.db.crate_def_map(d.krate);
3434
let message = if config_enabled {
35-
def_map.proc_macro_loading_error().unwrap_or("proc macro not found in the built dylib")
35+
def_map.proc_macro_loading_error().unwrap_or("internal error")
3636
} else {
3737
match d.kind {
3838
hir::MacroKind::Attr if proc_macros_enabled => "attribute macro expansion is disabled",

crates/rust-analyzer/src/reload.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,10 +528,16 @@ impl GlobalState {
528528
(crate_graph, proc_macros, crate_graph_file_dependencies)
529529
};
530530

531+
let mut change = Change::new();
531532
if self.config.expand_proc_macros() {
533+
change.set_proc_macros(
534+
crate_graph
535+
.iter()
536+
.map(|id| (id, Err("Proc-macros have not been built yet".to_owned())))
537+
.collect(),
538+
);
532539
self.fetch_proc_macros_queue.request_op(cause, proc_macro_paths);
533540
}
534-
let mut change = Change::new();
535541
change.set_crate_graph(crate_graph);
536542
self.analysis_host.apply_change(change);
537543
self.crate_graph_file_dependencies = crate_graph_file_dependencies;

0 commit comments

Comments
 (0)