diff options
| author | bors <bors@rust-lang.org> | 2024-04-18 12:13:06 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-04-18 12:13:06 +0000 |
| commit | af1fd88c4d3708c248323caec7c5ac52255f450f (patch) | |
| tree | e9a9766d19aeeee311a6eb29a6c5e4bc3656de31 | |
| parent | 08c706f2f8c1bc3bcbdb8074dafdb05862d484ba (diff) | |
| parent | 3a2ae6410dcca044f8e866c040c0f35592eba538 (diff) | |
Auto merge of #16257 - lnicola:rustc-check-cfg, r=Veykril
internal: Teach cargo about `cfg(rust_analyzer)` r? `@Urgau` is this a good idea?, CC `@Veykril`
| -rw-r--r-- | crates/proc-macro-srv-cli/build.rs | 5 | ||||
| -rw-r--r-- | crates/proc-macro-srv/build.rs | 2 | ||||
| -rw-r--r-- | crates/proc-macro-srv/proc-macro-test/build.rs | 2 | ||||
| -rw-r--r-- | crates/proc-macro-srv/proc-macro-test/imp/build.rs | 5 |
4 files changed, 13 insertions, 1 deletions
diff --git a/crates/proc-macro-srv-cli/build.rs b/crates/proc-macro-srv-cli/build.rs new file mode 100644 index 00000000000..07f914fece0 --- /dev/null +++ b/crates/proc-macro-srv-cli/build.rs @@ -0,0 +1,5 @@ +//! This teaches cargo about our cfg(rust_analyzer) + +fn main() { + println!("cargo:rustc-check-cfg=cfg(rust_analyzer)"); +} diff --git a/crates/proc-macro-srv/build.rs b/crates/proc-macro-srv/build.rs index a8c732f3154..874d1c6cd38 100644 --- a/crates/proc-macro-srv/build.rs +++ b/crates/proc-macro-srv/build.rs @@ -4,6 +4,8 @@ use std::{env, fs::File, io::Write, path::PathBuf, process::Command}; fn main() { + println!("cargo:rustc-check-cfg=cfg(rust_analyzer)"); + let mut path = PathBuf::from(env::var_os("OUT_DIR").unwrap()); path.push("rustc_version.rs"); let mut f = File::create(&path).unwrap(); diff --git a/crates/proc-macro-srv/proc-macro-test/build.rs b/crates/proc-macro-srv/proc-macro-test/build.rs index c76c201d69e..6a0ae362d88 100644 --- a/crates/proc-macro-srv/proc-macro-test/build.rs +++ b/crates/proc-macro-srv/proc-macro-test/build.rs @@ -53,7 +53,7 @@ fn main() { println!("Creating {}", src_dir.display()); std::fs::create_dir_all(src_dir).unwrap(); - for item_els in [&["Cargo.toml"][..], &["src", "lib.rs"]] { + for item_els in [&["Cargo.toml"][..], &["build.rs"][..], &["src", "lib.rs"]] { let mut src = imp_dir.clone(); let mut dst = staging_dir.clone(); for el in item_els { diff --git a/crates/proc-macro-srv/proc-macro-test/imp/build.rs b/crates/proc-macro-srv/proc-macro-test/imp/build.rs new file mode 100644 index 00000000000..07f914fece0 --- /dev/null +++ b/crates/proc-macro-srv/proc-macro-test/imp/build.rs @@ -0,0 +1,5 @@ +//! This teaches cargo about our cfg(rust_analyzer) + +fn main() { + println!("cargo:rustc-check-cfg=cfg(rust_analyzer)"); +} |
