Skip to content

Commit 7228368

Browse files
committed
Auto merge of #5882 - dima74:ra_setup-prevent-compile-rustc, r=Manishearth
Prevent compile parts of rustc when using `cargo dev ra-setup` Currently after running `cargo dev ra-setup` the following lines are added to `Cargo.toml`: ```toml [target] rustc_data_structures = { path = ".../rust/src/librustc_data_structures" } rustc_driver = { path = ".../rust/src/librustc_driver" } rustc_errors = { path = ".../rust/src/librustc_errors" } rustc_interface = { path = ".../rust/src/librustc_interface" } rustc_middle = { path = ".../rust/src/librustc_middle" } ``` This pull request adds dependencies for `rustc` crates under `cfg(NOT_A_PLATFORM)`, thus preventing them from compiling together with clippy: ```toml [target.'cfg(NOT_A_PLATFORM)'.dependencies] rustc_data_structures = { path = ".../rust/src/librustc_data_structures" } rustc_driver = { path = ".../rust/src/librustc_driver" } rustc_errors = { path = ".../rust/src/librustc_errors" } rustc_interface = { path = ".../rust/src/librustc_interface" } rustc_middle = { path = ".../rust/src/librustc_middle" } ``` --- This approach was [originally proposed for IntelliJ Rust](intellij-rust/intellij-rust#1618 (comment)), and looks like it works for rust-analyzer too. changelog: none
2 parents 70c46de + 6af9693 commit 7228368

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

clippy_dev/src/ra_setup.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,11 @@ fn inject_deps_into_manifest(
6868
});
6969

7070
// format a new [dependencies]-block with the new deps we need to inject
71-
let mut all_deps = String::from("[dependencies]\n");
71+
let mut all_deps = String::from("[target.'cfg(NOT_A_PLATFORM)'.dependencies]\n");
7272
new_deps.for_each(|dep_line| {
7373
all_deps.push_str(&dep_line);
7474
});
75+
all_deps.push_str("\n[dependencies]\n");
7576

7677
// replace "[dependencies]" with
7778
// [dependencies]

0 commit comments

Comments
 (0)