When I have a
FileId, I can query the owning
SourceRoot, which knows whether it's "static" (from crates.io/sysroot) via
is_library. Is there a way to get the same info when I only have a
CrateData and no
SourceDatabaseExt (since I'm in
The answer is that you shouldn't be asking such questions :-)
Why do you need this info?
More seriously, the
Ext setup is specifically so that the compiler doesn't know too much
As an optimization. I want to generate a small-and-expensive-to-recompute index for static crates, and a heavy-but-fast-to-recompute index for workspace crates.
Index here is
No, something like
CrateImplDefs, an index of impls
Uhu.... At the moment, our model definitely doesn't allow for that. I am not sure if it should -- seems like this would inevitably add two different code paths, which would need to be unified
ImportMap is only consulted for direct dependencies, while for impls we have to look at all transitive deps
Do you think that a call might be helpful?
Yeah, that might help
impls_from_deps_query is only directly called for leaf crates, so we can maybe speed it up by first computing an
FxHashSet<CrateId> transitive closure of dep crates, and then invoking non-transiive version of the query.
A futher optimization would create a query for transitive closure / self. That way, we'll have to do only two hashmap lookups (local crate/some dep), but we won't have to recompure the closure for deps on modifications