Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 12f1474

Browse files
committedJan 4, 2024
Auto merge of #118861 - Veykril:r-a-in-tree, r=onur-ozkan
Set the `in-rust-tree` feature for all rust-analyzer{-proc-macro-srv} steps Some context: This came up in https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Frust-analyzer/topic/libraryfying.20match.20checking.3F where `test` and `check` behaved differently for rust-analyzer r? `@onur-ozkan`
2 parents f688dd6 + abf0822 commit 12f1474

File tree

9 files changed

+21
-11
lines changed

9 files changed

+21
-11
lines changed
 

‎src/bootstrap/src/core/build_steps/check.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ impl Step for RustAnalyzer {
386386
cargo_subcommand(builder.kind),
387387
"src/tools/rust-analyzer",
388388
SourceType::InTree,
389-
&["rust-analyzer/in-rust-tree".to_owned()],
389+
&["in-rust-tree".to_owned()],
390390
);
391391

392392
cargo.allow_features(crate::core::build_steps::tool::RustAnalyzer::ALLOW_FEATURES);

‎src/bootstrap/src/core/build_steps/test.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ impl Step for RustAnalyzer {
385385
"test",
386386
crate_path,
387387
SourceType::InTree,
388-
&["sysroot-abi".to_owned()],
388+
&["in-rust-tree".to_owned()],
389389
);
390390
cargo.allow_features(tool::RustAnalyzer::ALLOW_FEATURES);
391391

‎src/bootstrap/src/core/build_steps/tool.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,7 @@ impl Step for RustAnalyzer {
628628
tool: "rust-analyzer",
629629
mode: Mode::ToolRustc,
630630
path: "src/tools/rust-analyzer",
631-
extra_features: vec!["rust-analyzer/in-rust-tree".to_owned()],
631+
extra_features: vec!["in-rust-tree".to_owned()],
632632
source_type: SourceType::InTree,
633633
allow_features: RustAnalyzer::ALLOW_FEATURES,
634634
})
@@ -673,9 +673,9 @@ impl Step for RustAnalyzerProcMacroSrv {
673673
compiler: self.compiler,
674674
target: self.target,
675675
tool: "rust-analyzer-proc-macro-srv",
676-
mode: Mode::ToolStd,
676+
mode: Mode::ToolRustc,
677677
path: "src/tools/rust-analyzer/crates/proc-macro-srv-cli",
678-
extra_features: vec!["sysroot-abi".to_owned()],
678+
extra_features: vec!["in-rust-tree".to_owned()],
679679
source_type: SourceType::InTree,
680680
allow_features: RustAnalyzer::ALLOW_FEATURES,
681681
});

‎src/tools/rust-analyzer/crates/mbe/Cargo.toml

+4-1
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,8 @@ span.workspace = true
2727
[dev-dependencies]
2828
test-utils.workspace = true
2929

30+
[features]
31+
in-rust-tree = ["parser/in-rust-tree", "syntax/in-rust-tree"]
32+
3033
[lints]
31-
workspace = true
34+
workspace = true

‎src/tools/rust-analyzer/crates/proc-macro-srv-cli/Cargo.toml

+3-1
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,12 @@ proc-macro-api.workspace = true
1414

1515
[features]
1616
sysroot-abi = ["proc-macro-srv/sysroot-abi"]
17+
in-rust-tree = ["proc-macro-srv/in-rust-tree", "sysroot-abi"]
18+
1719

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

2224
[lints]
23-
workspace = true
25+
workspace = true

‎src/tools/rust-analyzer/crates/proc-macro-srv-cli/src/main.rs

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
//! A standalone binary for `proc-macro-srv`.
22
//! Driver for proc macro server
3+
#![cfg_attr(feature = "in-rust-tree", feature(rustc_private))]
4+
#[cfg(feature = "in-rust-tree")]
5+
extern crate rustc_driver as _;
6+
37
use std::io;
48

59
fn main() -> std::io::Result<()> {

‎src/tools/rust-analyzer/crates/proc-macro-srv/Cargo.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ proc-macro-test.path = "./proc-macro-test"
3838

3939
[features]
4040
sysroot-abi = ["proc-macro-test/sysroot-abi"]
41+
in-rust-tree = ["mbe/in-rust-tree", "sysroot-abi"]
4142

4243
[lints]
43-
workspace = true
44+
workspace = true

‎src/tools/rust-analyzer/crates/proc-macro-srv/src/lib.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,12 @@
1111
//! rustc rather than `unstable`. (Although in general ABI compatibility is still an issue)…
1212
1313
#![cfg(any(feature = "sysroot-abi", rust_analyzer))]
14-
#![feature(proc_macro_internals, proc_macro_diagnostic, proc_macro_span)]
14+
#![feature(proc_macro_internals, proc_macro_diagnostic, proc_macro_span, rustc_private)]
1515
#![warn(rust_2018_idioms, unused_lifetimes)]
1616
#![allow(unreachable_pub, internal_features)]
1717

1818
extern crate proc_macro;
19+
extern crate rustc_driver as _;
1920

2021
mod dylib;
2122
mod server;

‎src/tools/rust-analyzer/crates/rust-analyzer/src/bin/main.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
#![warn(rust_2018_idioms, unused_lifetimes)]
66
#![cfg_attr(feature = "in-rust-tree", feature(rustc_private))]
77
#[cfg(feature = "in-rust-tree")]
8-
#[allow(unused_extern_crates)]
9-
extern crate rustc_driver;
8+
extern crate rustc_driver as _;
109

1110
mod logger;
1211
mod rustc_wrapper;

0 commit comments

Comments
 (0)
Please sign in to comment.