9874: fix: Always add implicit `proc_macro` dependency r=jonas-schievink a=jonas-schievink

Even crates that don't set `proc-macro = true` are allowed to depend on `proc_macro` (just none of the APIs work when called outside of a proc macro).

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/9857

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
This commit is contained in:
bors[bot] 2021-08-12 19:45:06 +00:00 committed by GitHub
commit 4466e07fd7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -533,15 +533,13 @@ fn cargo_to_crate_graph(
lib_tgt = Some((crate_id, cargo[tgt].name.clone()));
pkg_to_lib_crate.insert(pkg, crate_id);
}
if cargo[tgt].is_proc_macro {
if let Some(proc_macro) = libproc_macro {
add_dep(
&mut crate_graph,
crate_id,
CrateName::new("proc_macro").unwrap(),
proc_macro,
);
}
if let Some(proc_macro) = libproc_macro {
add_dep(
&mut crate_graph,
crate_id,
CrateName::new("proc_macro").unwrap(),
proc_macro,
);
}
pkg_crates.entry(pkg).or_insert_with(Vec::new).push((crate_id, cargo[tgt].kind));