Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set the in-rust-tree feature for all rust-analyzer{-proc-macro-srv} steps #118861

Merged
merged 5 commits into from
Jan 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/bootstrap/src/core/build_steps/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()],
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed these prefixed ones given we didn't prefix the sysroot-abi feature either in the other places, and I was kind of confused that these worked in the first place

);

cargo.allow_features(crate::core::build_steps::tool::RustAnalyzer::ALLOW_FEATURES);
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/src/core/build_steps/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ impl Step for RustAnalyzer {
"test",
crate_path,
SourceType::InTree,
&["sysroot-abi".to_owned()],
&["in-rust-tree".to_owned()],
);
cargo.allow_features(tool::RustAnalyzer::ALLOW_FEATURES);

Expand Down
6 changes: 3 additions & 3 deletions src/bootstrap/src/core/build_steps/tool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,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()],
source_type: SourceType::InTree,
allow_features: RustAnalyzer::ALLOW_FEATURES,
})
Expand Down Expand Up @@ -673,9 +673,9 @@ impl Step for RustAnalyzerProcMacroSrv {
compiler: self.compiler,
target: self.target,
tool: "rust-analyzer-proc-macro-srv",
mode: Mode::ToolStd,
mode: Mode::ToolRustc,
path: "src/tools/rust-analyzer/crates/proc-macro-srv-cli",
extra_features: vec!["sysroot-abi".to_owned()],
extra_features: vec!["in-rust-tree".to_owned()],
source_type: SourceType::InTree,
allow_features: RustAnalyzer::ALLOW_FEATURES,
});
Expand Down
5 changes: 4 additions & 1 deletion src/tools/rust-analyzer/crates/mbe/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,8 @@ span.workspace = true
[dev-dependencies]
test-utils.workspace = true

[features]
in-rust-tree = ["parser/in-rust-tree", "syntax/in-rust-tree"]

[lints]
workspace = true
workspace = true
4 changes: 3 additions & 1 deletion src/tools/rust-analyzer/crates/proc-macro-srv-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@ proc-macro-api.workspace = true

[features]
sysroot-abi = ["proc-macro-srv/sysroot-abi"]
in-rust-tree = ["proc-macro-srv/in-rust-tree", "sysroot-abi"]


[[bin]]
name = "rust-analyzer-proc-macro-srv"
path = "src/main.rs"

[lints]
workspace = true
workspace = true
4 changes: 4 additions & 0 deletions src/tools/rust-analyzer/crates/proc-macro-srv-cli/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
//! A standalone binary for `proc-macro-srv`.
//! Driver for proc macro server
#![cfg_attr(feature = "in-rust-tree", feature(rustc_private))]
#[cfg(feature = "in-rust-tree")]
extern crate rustc_driver as _;

use std::io;

fn main() -> std::io::Result<()> {
Expand Down
3 changes: 2 additions & 1 deletion src/tools/rust-analyzer/crates/proc-macro-srv/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ proc-macro-test.path = "./proc-macro-test"

[features]
sysroot-abi = ["proc-macro-test/sysroot-abi"]
in-rust-tree = ["mbe/in-rust-tree", "sysroot-abi"]

[lints]
workspace = true
workspace = true
3 changes: 2 additions & 1 deletion src/tools/rust-analyzer/crates/proc-macro-srv/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 1 addition & 2 deletions src/tools/rust-analyzer/crates/rust-analyzer/src/bin/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
#![warn(rust_2018_idioms, unused_lifetimes)]
#![cfg_attr(feature = "in-rust-tree", feature(rustc_private))]
#[cfg(feature = "in-rust-tree")]
#[allow(unused_extern_crates)]
extern crate rustc_driver;
extern crate rustc_driver as _;

mod logger;
mod rustc_wrapper;
Expand Down
Loading