]> git.lizzy.rs Git - rust.git/commit
Merge #6524
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>
Thu, 12 Nov 2020 17:55:32 +0000 (17:55 +0000)
committerGitHub <noreply@github.com>
Thu, 12 Nov 2020 17:55:32 +0000 (17:55 +0000)
commitddccaecb79246f0c2bffb0ef9614939ee9a25835
tree6dd43dd27d4ba2ae1ea7f8c9c4ca81c160d31848
parentcf73b6851b4e8f80c170d1ba8912f3c27b816c34
parent89ce6b6664c9451c3c6ab9446fcd40697c5b0267
Merge #6524

6524: Add support for loading rustc private crates r=matklad a=xldenis

This PR presents a solution to the problem of making`rustc_private` crates visible to `rust-analyzer`.
Currently developers add dependencies to those crates behind a `cfg(NOT_A_TARGET)` target to prevent `cargo` from building them.
This solution is unsatisfactory since it requires modifying `Cargo.toml` and causes problems for collaboration or CI.

The proposed solution suggested by @matklad is to allow users to give RA a path where the `rustc` sources could be found and then load that like a normal workspace.

This PR implements this solution by adding a `rustcSource` configuration item and adding the cargo metadata to the crate graph if it is provided.

------

I have no idea how this should be tested, or if this code is generally tested at all. I've locally run the extension with these changes and it correctly loads the relevant crates on a `rustc_private` project of mine.

Co-authored-by: Xavier Denis <xldenis@gmail.com>
crates/rust-analyzer/src/config.rs