Skip to content

Commit 00eb8ce

Browse files
committed
Auto merge of rust-lang#16271 - Veykril:gate-proc-macro-test, r=Veykril
Remove sysroot-abi feature flag from proc-macro-test Closes rust-lang/rust-analyzer#16194
2 parents 5871b61 + 4b7b602 commit 00eb8ce

File tree

5 files changed

+16
-23
lines changed

5 files changed

+16
-23
lines changed

crates/proc-macro-srv/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ expect-test = "1.4.0"
3737
proc-macro-test.path = "./proc-macro-test"
3838

3939
[features]
40-
sysroot-abi = ["proc-macro-test/sysroot-abi"]
40+
sysroot-abi = []
4141
in-rust-tree = ["mbe/in-rust-tree", "sysroot-abi"]
4242

4343
[lints]

crates/proc-macro-srv/proc-macro-test/Cargo.toml

-3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,3 @@ cargo_metadata = "0.18.1"
1414

1515
# local deps
1616
toolchain.workspace = true
17-
18-
[features]
19-
sysroot-abi = []

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

+15-13
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,24 @@ use cargo_metadata::Message;
1717

1818
fn main() {
1919
println!("cargo:rerun-if-changed=imp");
20-
println!("cargo:rerun-if-env-changed=PROC_MACRO_TEST_TOOLCHAIN");
20+
21+
let has_features = env::var_os("RUSTC_BOOTSTRAP").is_some()
22+
|| String::from_utf8(
23+
Command::new(toolchain::cargo()).arg("--version").output().unwrap().stdout,
24+
)
25+
.unwrap()
26+
.contains("nightly");
2127

2228
let out_dir = env::var_os("OUT_DIR").unwrap();
2329
let out_dir = Path::new(&out_dir);
2430

31+
if !has_features {
32+
println!("proc-macro-test testing only works on nightly toolchains");
33+
let info_path = out_dir.join("proc_macro_test_location.txt");
34+
fs::File::create(info_path).unwrap();
35+
return;
36+
}
37+
2538
let name = "proc-macro-test-impl";
2639
let version = "0.0.0";
2740

@@ -53,15 +66,7 @@ fn main() {
5366

5467
let target_dir = out_dir.join("target");
5568

56-
let mut cmd = if let Ok(toolchain) = std::env::var("PROC_MACRO_TEST_TOOLCHAIN") {
57-
// leverage rustup to find user-specific toolchain
58-
let mut cmd = Command::new("cargo");
59-
cmd.arg(format!("+{toolchain}"));
60-
cmd
61-
} else {
62-
Command::new(toolchain::cargo())
63-
};
64-
69+
let mut cmd = Command::new(toolchain::cargo());
6570
cmd.current_dir(&staging_dir)
6671
.args(["build", "-p", "proc-macro-test-impl", "--message-format", "json"])
6772
// Explicit override the target directory to avoid using the same one which the parent
@@ -70,9 +75,6 @@ fn main() {
7075
// instance to use the same target directory.
7176
.arg("--target-dir")
7277
.arg(&target_dir);
73-
if cfg!(feature = "sysroot-abi") {
74-
cmd.args(["--features", "sysroot-abi"]);
75-
}
7678

7779
if let Ok(target) = std::env::var("TARGET") {
7880
cmd.args(["--target", &target]);

crates/proc-macro-srv/proc-macro-test/imp/Cargo.toml

-3
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,4 @@ proc-macro = true
1313
# this crate should not have any dependencies, since it uses its own workspace,
1414
# and its own `Cargo.lock`
1515

16-
[features]
17-
sysroot-abi = []
18-
1916
[workspace]

crates/proc-macro-srv/proc-macro-test/imp/src/lib.rs

-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
//! Exports a few trivial procedural macros for testing.
22
3-
#![allow(unexpected_cfgs)]
4-
#![cfg(feature = "sysroot-abi")]
5-
#![cfg(any(feature = "sysroot-abi", rust_analyzer))]
63
#![warn(rust_2018_idioms, unused_lifetimes)]
74
#![feature(proc_macro_span, proc_macro_def_site)]
85

0 commit comments

Comments
 (0)