Skip to content

Commit af1fd88

Browse files
committed
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`
2 parents 08c706f + 3a2ae64 commit af1fd88

File tree

4 files changed

+13
-1
lines changed

4 files changed

+13
-1
lines changed

crates/proc-macro-srv-cli/build.rs

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
//! This teaches cargo about our cfg(rust_analyzer)
2+
3+
fn main() {
4+
println!("cargo:rustc-check-cfg=cfg(rust_analyzer)");
5+
}

crates/proc-macro-srv/build.rs

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
use std::{env, fs::File, io::Write, path::PathBuf, process::Command};
55

66
fn main() {
7+
println!("cargo:rustc-check-cfg=cfg(rust_analyzer)");
8+
79
let mut path = PathBuf::from(env::var_os("OUT_DIR").unwrap());
810
path.push("rustc_version.rs");
911
let mut f = File::create(&path).unwrap();

crates/proc-macro-srv/proc-macro-test/build.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ fn main() {
5353
println!("Creating {}", src_dir.display());
5454
std::fs::create_dir_all(src_dir).unwrap();
5555

56-
for item_els in [&["Cargo.toml"][..], &["src", "lib.rs"]] {
56+
for item_els in [&["Cargo.toml"][..], &["build.rs"][..], &["src", "lib.rs"]] {
5757
let mut src = imp_dir.clone();
5858
let mut dst = staging_dir.clone();
5959
for el in item_els {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
//! This teaches cargo about our cfg(rust_analyzer)
2+
3+
fn main() {
4+
println!("cargo:rustc-check-cfg=cfg(rust_analyzer)");
5+
}

0 commit comments

Comments
 (0)