mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-14 06:03:58 +00:00
Auto merge of #16271 - Veykril:gate-proc-macro-test, r=Veykril
Remove sysroot-abi feature flag from proc-macro-test Closes https://github.com/rust-lang/rust-analyzer/issues/16194
This commit is contained in:
commit
00eb8ce41e
5 changed files with 16 additions and 23 deletions
|
@ -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]
|
||||
|
|
|
@ -14,6 +14,3 @@ cargo_metadata = "0.18.1"
|
|||
|
||||
# local deps
|
||||
toolchain.workspace = true
|
||||
|
||||
[features]
|
||||
sysroot-abi = []
|
||||
|
|
|
@ -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]);
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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)]
|
||||
|
||||
|
|
Loading…
Reference in a new issue