aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_hir_expand/src/builtin_derive.rs10
1 files changed, 6 insertions, 4 deletions
diff --git a/crates/ra_hir_expand/src/builtin_derive.rs b/crates/ra_hir_expand/src/builtin_derive.rs
index 3bd3f7041..e60f879a3 100644
--- a/crates/ra_hir_expand/src/builtin_derive.rs
+++ b/crates/ra_hir_expand/src/builtin_derive.rs
@@ -169,11 +169,13 @@ fn find_builtin_crate(db: &dyn AstDatabase, id: LazyMacroId) -> tt::TokenTree {
169 } 169 }
170 }; 170 };
171 171
172 // Check whether it has any deps, if not, it should be core: 172 // XXX
173 let tt = if cg[*krate].dependencies.is_empty() { 173 // All crates except core itself should have a dependency on core,
174 quote! { crate } 174 // We detect `core` by seeing whether it doesn't have such a dependency.
175 } else { 175 let tt = if cg[*krate].dependencies.iter().any(|dep| dep.name == "core") {
176 quote! { core } 176 quote! { core }
177 } else {
178 quote! { crate }
177 }; 179 };
178 180
179 tt.token_trees[0].clone() 181 tt.token_trees[0].clone()