Unnamed repository; edit this file 'description' to name the repository.
-rw-r--r--crates/proc-macro-srv/Cargo.toml2
-rw-r--r--crates/proc-macro-srv/proc-macro-test/Cargo.toml3
-rw-r--r--crates/proc-macro-srv/proc-macro-test/build.rs28
-rw-r--r--crates/proc-macro-srv/proc-macro-test/imp/Cargo.toml3
-rw-r--r--crates/proc-macro-srv/proc-macro-test/imp/src/lib.rs3
5 files changed, 16 insertions, 23 deletions
diff --git a/crates/proc-macro-srv/Cargo.toml b/crates/proc-macro-srv/Cargo.toml
index 9c4375559c..ba17ea6f7b 100644
--- a/crates/proc-macro-srv/Cargo.toml
+++ b/crates/proc-macro-srv/Cargo.toml
@@ -37,7 +37,7 @@ expect-test = "1.4.0"
proc-macro-test.path = "./proc-macro-test"
[features]
-sysroot-abi = ["proc-macro-test/sysroot-abi"]
+sysroot-abi = []
in-rust-tree = ["mbe/in-rust-tree", "sysroot-abi"]
[lints]
diff --git a/crates/proc-macro-srv/proc-macro-test/Cargo.toml b/crates/proc-macro-srv/proc-macro-test/Cargo.toml
index 90545bb513..7977afb1cb 100644
--- a/crates/proc-macro-srv/proc-macro-test/Cargo.toml
+++ b/crates/proc-macro-srv/proc-macro-test/Cargo.toml
@@ -14,6 +14,3 @@ cargo_metadata = "0.18.1"
# local deps
toolchain.workspace = true
-
-[features]
-sysroot-abi = []
diff --git a/crates/proc-macro-srv/proc-macro-test/build.rs b/crates/proc-macro-srv/proc-macro-test/build.rs
index 7299147686..6cf2b5643e 100644
--- a/crates/proc-macro-srv/proc-macro-test/build.rs
+++ b/crates/proc-macro-srv/proc-macro-test/build.rs
@@ -17,11 +17,24 @@ use cargo_metadata::Message;
fn main() {
println!("cargo:rerun-if-changed=imp");
- println!("cargo:rerun-if-env-changed=PROC_MACRO_TEST_TOOLCHAIN");
+
+ let has_features = env::var_os("RUSTC_BOOTSTRAP").is_some()
+ || String::from_utf8(
+ Command::new(toolchain::cargo()).arg("--version").output().unwrap().stdout,
+ )
+ .unwrap()
+ .contains("nightly");
let out_dir = env::var_os("OUT_DIR").unwrap();
let out_dir = Path::new(&out_dir);
+ if !has_features {
+ println!("proc-macro-test testing only works on nightly toolchains");
+ let info_path = out_dir.join("proc_macro_test_location.txt");
+ fs::File::create(info_path).unwrap();
+ return;
+ }
+
let name = "proc-macro-test-impl";
let version = "0.0.0";
@@ -53,15 +66,7 @@ fn main() {
let target_dir = out_dir.join("target");
- let mut cmd = if let Ok(toolchain) = std::env::var("PROC_MACRO_TEST_TOOLCHAIN") {
- // leverage rustup to find user-specific toolchain
- let mut cmd = Command::new("cargo");
- cmd.arg(format!("+{toolchain}"));
- cmd
- } else {
- Command::new(toolchain::cargo())
- };
-
+ let mut cmd = Command::new(toolchain::cargo());
cmd.current_dir(&staging_dir)
.args(["build", "-p", "proc-macro-test-impl", "--message-format", "json"])
// Explicit override the target directory to avoid using the same one which the parent
@@ -70,9 +75,6 @@ fn main() {
// instance to use the same target directory.
.arg("--target-dir")
.arg(&target_dir);
- if cfg!(feature = "sysroot-abi") {
- cmd.args(["--features", "sysroot-abi"]);
- }
if let Ok(target) = std::env::var("TARGET") {
cmd.args(["--target", &target]);
diff --git a/crates/proc-macro-srv/proc-macro-test/imp/Cargo.toml b/crates/proc-macro-srv/proc-macro-test/imp/Cargo.toml
index dc94fcd61a..fa189752b7 100644
--- a/crates/proc-macro-srv/proc-macro-test/imp/Cargo.toml
+++ b/crates/proc-macro-srv/proc-macro-test/imp/Cargo.toml
@@ -13,7 +13,4 @@ proc-macro = true
# this crate should not have any dependencies, since it uses its own workspace,
# and its own `Cargo.lock`
-[features]
-sysroot-abi = []
-
[workspace]
diff --git a/crates/proc-macro-srv/proc-macro-test/imp/src/lib.rs b/crates/proc-macro-srv/proc-macro-test/imp/src/lib.rs
index b8aad4acef..d9018b1b87 100644
--- a/crates/proc-macro-srv/proc-macro-test/imp/src/lib.rs
+++ b/crates/proc-macro-srv/proc-macro-test/imp/src/lib.rs
@@ -1,8 +1,5 @@
//! Exports a few trivial procedural macros for testing.
-#![allow(unexpected_cfgs)]
-#![cfg(feature = "sysroot-abi")]
-#![cfg(any(feature = "sysroot-abi", rust_analyzer))]
#![warn(rust_2018_idioms, unused_lifetimes)]
#![feature(proc_macro_span, proc_macro_def_site)]