From e623cc10d1e418ab90285d42c0a0dfe2e97b654f Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Tue, 12 Dec 2023 09:42:16 +0100 Subject: [PATCH] Set the `in-rust-tree` feature for all rust-analyzer{-proc-macro-srv} steps --- src/bootstrap/src/core/build_steps/check.rs | 2 +- src/bootstrap/src/core/build_steps/test.rs | 2 +- src/bootstrap/src/core/build_steps/tool.rs | 4 ++-- src/tools/rust-analyzer/crates/mbe/Cargo.toml | 3 +++ src/tools/rust-analyzer/crates/proc-macro-srv-cli/Cargo.toml | 2 ++ src/tools/rust-analyzer/crates/proc-macro-srv/Cargo.toml | 1 + src/tools/rust-analyzer/crates/proc-macro-srv/src/lib.rs | 3 ++- 7 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/bootstrap/src/core/build_steps/check.rs b/src/bootstrap/src/core/build_steps/check.rs index ecaaf91aec12f..f1f2f28909dee 100644 --- a/src/bootstrap/src/core/build_steps/check.rs +++ b/src/bootstrap/src/core/build_steps/check.rs @@ -386,7 +386,7 @@ impl Step for RustAnalyzer { cargo_subcommand(builder.kind), "src/tools/rust-analyzer", SourceType::InTree, - &["rust-analyzer/in-rust-tree".to_owned()], + &["in-rust-tree".to_owned()], ); cargo.allow_features(crate::core::build_steps::tool::RustAnalyzer::ALLOW_FEATURES); diff --git a/src/bootstrap/src/core/build_steps/test.rs b/src/bootstrap/src/core/build_steps/test.rs index d0f36f99342fe..51b386d7d0819 100644 --- a/src/bootstrap/src/core/build_steps/test.rs +++ b/src/bootstrap/src/core/build_steps/test.rs @@ -385,7 +385,7 @@ impl Step for RustAnalyzer { "test", crate_path, SourceType::InTree, - &["sysroot-abi".to_owned()], + &["sysroot-abi".to_owned(), "in-rust-tree".to_owned()], ); cargo.allow_features(tool::RustAnalyzer::ALLOW_FEATURES); diff --git a/src/bootstrap/src/core/build_steps/tool.rs b/src/bootstrap/src/core/build_steps/tool.rs index 9942f00a0562b..fff97127a9eee 100644 --- a/src/bootstrap/src/core/build_steps/tool.rs +++ b/src/bootstrap/src/core/build_steps/tool.rs @@ -647,7 +647,7 @@ impl Step for RustAnalyzer { tool: "rust-analyzer", mode: Mode::ToolRustc, path: "src/tools/rust-analyzer", - extra_features: vec!["rust-analyzer/in-rust-tree".to_owned()], + extra_features: vec!["in-rust-tree".to_owned()], is_optional_tool: false, source_type: SourceType::InTree, allow_features: RustAnalyzer::ALLOW_FEATURES, @@ -692,7 +692,7 @@ impl Step for RustAnalyzerProcMacroSrv { tool: "rust-analyzer-proc-macro-srv", mode: Mode::ToolStd, path: "src/tools/rust-analyzer/crates/proc-macro-srv-cli", - extra_features: vec!["sysroot-abi".to_owned()], + extra_features: vec!["sysroot-abi".to_owned(), "in-rust-tree".to_owned()], is_optional_tool: false, source_type: SourceType::InTree, allow_features: RustAnalyzer::ALLOW_FEATURES, diff --git a/src/tools/rust-analyzer/crates/mbe/Cargo.toml b/src/tools/rust-analyzer/crates/mbe/Cargo.toml index adab1003d103b..958b8d550165b 100644 --- a/src/tools/rust-analyzer/crates/mbe/Cargo.toml +++ b/src/tools/rust-analyzer/crates/mbe/Cargo.toml @@ -25,3 +25,6 @@ stdx.workspace = true [dev-dependencies] test-utils.workspace = true + +[features] +in-rust-tree = ["parser/in-rust-tree", "syntax/in-rust-tree"] diff --git a/src/tools/rust-analyzer/crates/proc-macro-srv-cli/Cargo.toml b/src/tools/rust-analyzer/crates/proc-macro-srv-cli/Cargo.toml index 8f03c6ec7b572..2d08a5b92912e 100644 --- a/src/tools/rust-analyzer/crates/proc-macro-srv-cli/Cargo.toml +++ b/src/tools/rust-analyzer/crates/proc-macro-srv-cli/Cargo.toml @@ -14,6 +14,8 @@ proc-macro-api.workspace = true [features] sysroot-abi = ["proc-macro-srv/sysroot-abi"] +in-rust-tree = ["proc-macro-srv/in-rust-tree"] + [[bin]] name = "rust-analyzer-proc-macro-srv" diff --git a/src/tools/rust-analyzer/crates/proc-macro-srv/Cargo.toml b/src/tools/rust-analyzer/crates/proc-macro-srv/Cargo.toml index 99993f16e2767..37263e54cf02d 100644 --- a/src/tools/rust-analyzer/crates/proc-macro-srv/Cargo.toml +++ b/src/tools/rust-analyzer/crates/proc-macro-srv/Cargo.toml @@ -36,3 +36,4 @@ proc-macro-test.workspace = true [features] sysroot-abi = [] +in-rust-tree = ["mbe/in-rust-tree"] diff --git a/src/tools/rust-analyzer/crates/proc-macro-srv/src/lib.rs b/src/tools/rust-analyzer/crates/proc-macro-srv/src/lib.rs index 56529f71d855e..1c22678ab4e67 100644 --- a/src/tools/rust-analyzer/crates/proc-macro-srv/src/lib.rs +++ b/src/tools/rust-analyzer/crates/proc-macro-srv/src/lib.rs @@ -11,11 +11,12 @@ //! rustc rather than `unstable`. (Although in general ABI compatibility is still an issue)… #![cfg(any(feature = "sysroot-abi", rust_analyzer))] -#![feature(proc_macro_internals, proc_macro_diagnostic, proc_macro_span)] +#![feature(proc_macro_internals, proc_macro_diagnostic, proc_macro_span, rustc_private)] #![warn(rust_2018_idioms, unused_lifetimes)] #![allow(unreachable_pub, internal_features)] extern crate proc_macro; +extern crate rustc_driver as _; mod dylib; mod server;