-
Notifications
You must be signed in to change notification settings - Fork 26
Support multiple crate types and versions (and multiple passed directly in-memory) #93
Comments
Okay, so currently the data per each crate is organized in a
Additionally, when processing/lowering the analysis files, it tries to update a global This poses a few problems:
While the last concern sounds least practical, I think it's worth taking it into account when designing the solution. I think that the solution boils down to introducing a consistent Additionally, we'd need more information from the compiler in the save-analysis data. I was exploring a bit what could we emit to help identify the crate. Right now I tried to additionally expose external crate source (originating dylib/rlib/rmeta), changes for rustc, rls-data. "prelude": {
"crate_name": "different_dep_versions",
"crate_root": "src",
"external_crates": [
{
"file_name": "/home/xanewok/repos/different_dep_versions/src/main.rs",
"name": "rls_data",
"num": 17,
"source": {
"dylib": null,
"rlib": null,
"rmeta": "/home/xanewok/repos/different_dep_versions/target/debug/deps/librls_data-bb60ea1227c10c9b.rmeta"
}
},
...
{
"file_name": "/home/xanewok/repos/different_dep_versions/src/main.rs",
"name": "rls_data",
"num": 13,
"source": {
"dylib": null,
"rlib": null,
"rmeta": "/home/xanewok/repos/different_dep_versions/target/debug/deps/librls_data-e7a3c9e5473a310d.rmeta"
}
},
...
{
"file_name": "/home/xanewok/repos/different_dep_versions/src/main.rs",
"name": "core",
"num": 2,
"source": {
"dylib": null,
"rlib": "/home/xanewok/repos/rust/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-3181dd9e46400ebd.rlib",
"rmeta": null
}
},
{
"file_name": "/home/xanewok/repos/different_dep_versions/src/main.rs",
"name": "std",
"num": 1,
"source": {
"dylib": "/home/xanewok/repos/rust/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-5e8ebc384e5dfd82.so",
"rlib": "/home/xanewok/repos/rust/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-5e8ebc384e5dfd82.rlib",
"rmeta": null
}
},
... It's worth noting that even though in the analysis data for the root package two different This is meant more to highlight the problem and explore the solution space, rather than propose a concrete one. @nrc what do you think would be the best course of action here? |
I tried to do some more research, @nikomatsakis said that a I'm currently working on a version using the aforementioned disambiguator instead of using |
Emit crate disambiguators in save-analysis data Needed for rust-dev-tools/rls-analysis#93. Blocked by rust-dev-tools/rls-data#11. (For now, this pulls my branch [rls-data/crate-source](https://github.com/Xanewok/rls-data/tree/crate-source)) This will allow to disambiguate different crates types/versions when indexing resulting save-analysis data (most importantly allow to support bin+lib and different crate versions). r? @nrc
Currently master_crate_map maps between crate names (which is the same for lib and bin crate types).
Furthermore, when reloading multiple separate
Analysis
es, I think these are lowered intoId
s with badkrate
member (always 0, which isLOCAL_CRATE
from rustc).I'll edit this issue when I'll get to something more.
The text was updated successfully, but these errors were encountered: