Skip to content

Commit 71e9713

Browse files
committed
rust-analyzer: prep crates for testing against in-tree rustc_private
1 parent b1b08cd commit 71e9713

File tree

30 files changed

+126
-3
lines changed

30 files changed

+126
-3
lines changed

src/tools/rust-analyzer/crates/base-db/Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,9 @@ vfs.workspace = true
3131
span.workspace = true
3232
intern.workspace = true
3333

34+
[features]
35+
default = []
36+
in-rust-tree = []
37+
3438
[lints]
3539
workspace = true

src/tools/rust-analyzer/crates/base-db/src/lib.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
//! base_db defines basic database traits. The concrete DB is defined by ide.
22
3+
#![cfg_attr(feature = "in-rust-tree", feature(rustc_private))]
4+
5+
#[cfg(feature = "in-rust-tree")]
6+
extern crate rustc_driver as _;
7+
38
pub use salsa;
49
pub use salsa_macros;
510

src/tools/rust-analyzer/crates/cfg/Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,9 @@ syntax.workspace = true
3333
# tt is needed for testing
3434
cfg = { path = ".", default-features = false, features = ["tt"] }
3535

36+
[features]
37+
default = []
38+
in-rust-tree = []
39+
3640
[lints]
3741
workspace = true

src/tools/rust-analyzer/crates/cfg/src/lib.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
//! cfg defines conditional compiling options, `cfg` attribute parser and evaluator
22
3+
#![cfg_attr(feature = "in-rust-tree", feature(rustc_private))]
4+
5+
#[cfg(feature = "in-rust-tree")]
6+
extern crate rustc_driver as _;
7+
38
mod cfg_expr;
49
mod dnf;
510
#[cfg(test)]

src/tools/rust-analyzer/crates/ide-completion/Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,9 @@ expect-test = "1.5.1"
3737
test-utils.workspace = true
3838
test-fixture.workspace = true
3939

40+
[features]
41+
default = []
42+
in-rust-tree = []
43+
4044
[lints]
4145
workspace = true

src/tools/rust-analyzer/crates/ide-completion/src/lib.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
// It's useful to refer to code that is private in doc comments.
44
#![allow(rustdoc::private_intra_doc_links)]
55

6+
#![cfg_attr(feature = "in-rust-tree", feature(rustc_private))]
7+
8+
#[cfg(feature = "in-rust-tree")]
9+
extern crate rustc_driver as _;
10+
611
mod completions;
712
mod config;
813
mod context;

src/tools/rust-analyzer/crates/ide-db/Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,9 @@ line-index.workspace = true
5252
[dev-dependencies]
5353
expect-test = "1.5.1"
5454

55+
[features]
56+
default = []
57+
in-rust-tree = []
58+
5559
[lints]
5660
workspace = true

src/tools/rust-analyzer/crates/ide-db/src/lib.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
//!
33
//! It is mainly a `HirDatabase` for semantic analysis, plus a `SymbolsDatabase`, for fuzzy search.
44
5+
#![cfg_attr(feature = "in-rust-tree", feature(rustc_private))]
6+
7+
#[cfg(feature = "in-rust-tree")]
8+
extern crate rustc_driver as _;
9+
510
extern crate self as ide_db;
611

712
mod apply_change;

src/tools/rust-analyzer/crates/ide-diagnostics/Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,9 @@ expect-test = "1.5.1"
3434
test-utils.workspace = true
3535
test-fixture.workspace = true
3636

37+
[features]
38+
default = []
39+
in-rust-tree = []
40+
3741
[lints]
3842
workspace = true

src/tools/rust-analyzer/crates/ide-diagnostics/src/lib.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@
2323
//! There are also a couple of ad-hoc diagnostics implemented directly here, we
2424
//! don't yet have a great pattern for how to do them properly.
2525
26+
#![cfg_attr(feature = "in-rust-tree", feature(rustc_private))]
27+
28+
#[cfg(feature = "in-rust-tree")]
29+
extern crate rustc_driver as _;
30+
2631
mod handlers {
2732
pub(crate) mod await_outside_of_async;
2833
pub(crate) mod bad_rtn;

0 commit comments

Comments
 (0)