Skip to content

Commit

Permalink
Remove sysroot-abi feature flag from proc-macro-test
Browse files Browse the repository at this point in the history
  • Loading branch information
Veykril committed Jan 10, 2024
1 parent 5871b61 commit 43c01f8
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 20 deletions.
2 changes: 1 addition & 1 deletion crates/proc-macro-srv/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
3 changes: 0 additions & 3 deletions crates/proc-macro-srv/proc-macro-test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,3 @@ cargo_metadata = "0.18.1"

# local deps
toolchain.workspace = true

[features]
sysroot-abi = []
19 changes: 8 additions & 11 deletions crates/proc-macro-srv/proc-macro-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ use cargo_metadata::Message;

fn main() {
println!("cargo:rerun-if-changed=imp");
println!("cargo:rerun-if-env-changed=PROC_MACRO_TEST_TOOLCHAIN");

let out_dir = env::var_os("OUT_DIR").unwrap();
let out_dir = Path::new(&out_dir);
Expand Down Expand Up @@ -53,15 +52,13 @@ 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 is_nightly = String::from_utf8(
Command::new(toolchain::cargo()).arg("--version").output().unwrap().stdout,
)
.unwrap()
.contains("nightly");

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
Expand All @@ -70,8 +67,8 @@ 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 is_nightly {
cmd.args(["--features", "nightly"]);
}

if let Ok(target) = std::env::var("TARGET") {
Expand Down
2 changes: 1 addition & 1 deletion crates/proc-macro-srv/proc-macro-test/imp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ proc-macro = true
# and its own `Cargo.lock`

[features]
sysroot-abi = []
nightly = []

[workspace]
6 changes: 2 additions & 4 deletions crates/proc-macro-srv/proc-macro-test/imp/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
//! 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)]
#![cfg_attr(feature = "nightly", feature(proc_macro_span, proc_macro_def_site))]

use proc_macro::{Group, Ident, Literal, Punct, Span, TokenStream, TokenTree};

Expand Down Expand Up @@ -64,6 +61,7 @@ pub fn fn_like_span_join(args: TokenStream) -> TokenStream {
)))
}

#[cfg(feature = "nightly")]
#[proc_macro]
pub fn fn_like_span_ops(args: TokenStream) -> TokenStream {
let args = &mut args.into_iter();
Expand Down

0 comments on commit 43c01f8

Please sign in to comment.