Skip to content

Commit bd416e2

Browse files
committed
Merge commit '85fb463fc586594925f05fc8e285b1568f98f41a'
2 parents f2348fb + 85fb463 commit bd416e2

File tree

189 files changed

+4237
-2361
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

189 files changed

+4237
-2361
lines changed

src/tools/rust-analyzer/.github/workflows/ci.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ jobs:
3838
- 'crates/proc-macro-api/**'
3939
- 'crates/proc-macro-srv/**'
4040
- 'crates/proc-macro-srv-cli/**'
41-
- 'crates/proc-macro-test/**'
4241
4342
rust:
4443
needs: changes

src/tools/rust-analyzer/Cargo.lock

Lines changed: 48 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,11 @@ dependencies = [
7474
"profile",
7575
"rust-analyzer-salsa",
7676
"rustc-hash",
77+
"semver",
78+
"span",
7779
"stdx",
7880
"syntax",
79-
"test-utils",
8081
"triomphe",
81-
"tt",
8282
"vfs",
8383
]
8484

@@ -516,8 +516,10 @@ dependencies = [
516516
"rustc-dependencies",
517517
"rustc-hash",
518518
"smallvec",
519+
"span",
519520
"stdx",
520521
"syntax",
522+
"test-fixture",
521523
"test-utils",
522524
"tracing",
523525
"triomphe",
@@ -542,6 +544,7 @@ dependencies = [
542544
"profile",
543545
"rustc-hash",
544546
"smallvec",
547+
"span",
545548
"stdx",
546549
"syntax",
547550
"tracing",
@@ -581,6 +584,7 @@ dependencies = [
581584
"smallvec",
582585
"stdx",
583586
"syntax",
587+
"test-fixture",
584588
"test-utils",
585589
"tracing",
586590
"tracing-subscriber",
@@ -624,6 +628,7 @@ dependencies = [
624628
"smallvec",
625629
"stdx",
626630
"syntax",
631+
"test-fixture",
627632
"test-utils",
628633
"text-edit",
629634
"toolchain",
@@ -647,6 +652,7 @@ dependencies = [
647652
"sourcegen",
648653
"stdx",
649654
"syntax",
655+
"test-fixture",
650656
"test-utils",
651657
"text-edit",
652658
]
@@ -666,6 +672,7 @@ dependencies = [
666672
"smallvec",
667673
"stdx",
668674
"syntax",
675+
"test-fixture",
669676
"test-utils",
670677
"text-edit",
671678
]
@@ -694,8 +701,10 @@ dependencies = [
694701
"rayon",
695702
"rustc-hash",
696703
"sourcegen",
704+
"span",
697705
"stdx",
698706
"syntax",
707+
"test-fixture",
699708
"test-utils",
700709
"text-edit",
701710
"tracing",
@@ -720,6 +729,7 @@ dependencies = [
720729
"sourcegen",
721730
"stdx",
722731
"syntax",
732+
"test-fixture",
723733
"test-utils",
724734
"text-edit",
725735
]
@@ -737,6 +747,7 @@ dependencies = [
737747
"parser",
738748
"stdx",
739749
"syntax",
750+
"test-fixture",
740751
"test-utils",
741752
"text-edit",
742753
"triomphe",
@@ -903,11 +914,13 @@ version = "0.0.0"
903914
dependencies = [
904915
"anyhow",
905916
"crossbeam-channel",
917+
"hir-expand",
906918
"ide",
907919
"ide-db",
908920
"itertools",
909921
"proc-macro-api",
910922
"project-model",
923+
"span",
911924
"tracing",
912925
"tt",
913926
"vfs",
@@ -956,9 +969,9 @@ dependencies = [
956969

957970
[[package]]
958971
name = "lsp-types"
959-
version = "0.94.0"
972+
version = "0.95.0"
960973
source = "registry+https://github.com/rust-lang/crates.io-index"
961-
checksum = "0b63735a13a1f9cd4f4835223d828ed9c2e35c8c5e61837774399f558b6a1237"
974+
checksum = "158c1911354ef73e8fe42da6b10c0484cb65c7f1007f28022e847706c1ab6984"
962975
dependencies = [
963976
"bitflags 1.3.2",
964977
"serde",
@@ -975,6 +988,7 @@ dependencies = [
975988
"parser",
976989
"rustc-hash",
977990
"smallvec",
991+
"span",
978992
"stdx",
979993
"syntax",
980994
"test-utils",
@@ -1251,6 +1265,7 @@ dependencies = [
12511265
"serde",
12521266
"serde_json",
12531267
"snap",
1268+
"span",
12541269
"stdx",
12551270
"text-size",
12561271
"tracing",
@@ -1262,6 +1277,7 @@ dependencies = [
12621277
name = "proc-macro-srv"
12631278
version = "0.0.0"
12641279
dependencies = [
1280+
"base-db",
12651281
"expect-test",
12661282
"libloading",
12671283
"mbe",
@@ -1270,6 +1286,7 @@ dependencies = [
12701286
"paths",
12711287
"proc-macro-api",
12721288
"proc-macro-test",
1289+
"span",
12731290
"stdx",
12741291
"tt",
12751292
]
@@ -1287,14 +1304,9 @@ name = "proc-macro-test"
12871304
version = "0.0.0"
12881305
dependencies = [
12891306
"cargo_metadata",
1290-
"proc-macro-test-impl",
12911307
"toolchain",
12921308
]
12931309

1294-
[[package]]
1295-
name = "proc-macro-test-impl"
1296-
version = "0.0.0"
1297-
12981310
[[package]]
12991311
name = "proc-macro2"
13001312
version = "1.0.69"
@@ -1535,6 +1547,7 @@ dependencies = [
15351547
"sourcegen",
15361548
"stdx",
15371549
"syntax",
1550+
"test-fixture",
15381551
"test-utils",
15391552
"tikv-jemallocator",
15401553
"toolchain",
@@ -1726,6 +1739,17 @@ dependencies = [
17261739
"xshell",
17271740
]
17281741

1742+
[[package]]
1743+
name = "span"
1744+
version = "0.0.0"
1745+
dependencies = [
1746+
"la-arena 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
1747+
"rust-analyzer-salsa",
1748+
"stdx",
1749+
"syntax",
1750+
"vfs",
1751+
]
1752+
17291753
[[package]]
17301754
name = "static_assertions"
17311755
version = "1.1.0"
@@ -1796,6 +1820,20 @@ dependencies = [
17961820
"ungrammar",
17971821
]
17981822

1823+
[[package]]
1824+
name = "test-fixture"
1825+
version = "0.0.0"
1826+
dependencies = [
1827+
"base-db",
1828+
"cfg",
1829+
"hir-expand",
1830+
"rustc-hash",
1831+
"span",
1832+
"stdx",
1833+
"test-utils",
1834+
"tt",
1835+
]
1836+
17991837
[[package]]
18001838
name = "test-utils"
18011839
version = "0.0.0"
@@ -1998,6 +2036,7 @@ name = "tt"
19982036
version = "0.0.0"
19992037
dependencies = [
20002038
"smol_str",
2039+
"span",
20012040
"stdx",
20022041
"text-size",
20032042
]

src/tools/rust-analyzer/Cargo.toml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[workspace]
22
members = ["xtask/", "lib/*", "crates/*"]
3-
exclude = ["crates/proc-macro-test/imp"]
3+
exclude = ["crates/proc-macro-srv/proc-macro-test/"]
44
resolver = "2"
55

66
[workspace.package]
@@ -70,10 +70,9 @@ proc-macro-srv = { path = "./crates/proc-macro-srv", version = "0.0.0" }
7070
proc-macro-srv-cli = { path = "./crates/proc-macro-srv-cli", version = "0.0.0" }
7171
profile = { path = "./crates/profile", version = "0.0.0" }
7272
project-model = { path = "./crates/project-model", version = "0.0.0" }
73-
sourcegen = { path = "./crates/sourcegen", version = "0.0.0" }
73+
span = { path = "./crates/span", version = "0.0.0" }
7474
stdx = { path = "./crates/stdx", version = "0.0.0" }
7575
syntax = { path = "./crates/syntax", version = "0.0.0" }
76-
test-utils = { path = "./crates/test-utils", version = "0.0.0" }
7776
text-edit = { path = "./crates/text-edit", version = "0.0.0" }
7877
toolchain = { path = "./crates/toolchain", version = "0.0.0" }
7978
tt = { path = "./crates/tt", version = "0.0.0" }
@@ -82,7 +81,9 @@ vfs = { path = "./crates/vfs", version = "0.0.0" }
8281
rustc-dependencies = { path = "./crates/rustc-dependencies", version = "0.0.0" }
8382

8483
# local crates that aren't published to crates.io. These should not have versions.
85-
proc-macro-test = { path = "./crates/proc-macro-test" }
84+
sourcegen = { path = "./crates/sourcegen" }
85+
test-fixture = { path = "./crates/test-fixture" }
86+
test-utils = { path = "./crates/test-utils" }
8687

8788
# In-tree crates that are published separately and follow semver. See lib/README.md
8889
line-index = { version = "0.1.1" }
@@ -91,10 +92,14 @@ lsp-server = { version = "0.7.4" }
9192

9293
# non-local crates
9394
anyhow = "1.0.75"
95+
arrayvec = "0.7.4"
9496
bitflags = "2.4.1"
9597
cargo_metadata = "0.18.1"
98+
command-group = "2.0.1"
99+
crossbeam-channel = "0.5.8"
96100
dissimilar = "1.0.7"
97101
either = "1.9.0"
102+
expect-test = "1.4.0"
98103
hashbrown = { version = "0.14", features = [
99104
"inline-more",
100105
], default-features = false }
@@ -105,6 +110,7 @@ nohash-hasher = "0.2.0"
105110
rayon = "1.8.0"
106111
rust-analyzer-salsa = "0.17.0-pre.4"
107112
rustc-hash = "1.1.0"
113+
semver = "1.0.14"
108114
serde = { version = "1.0.192", features = ["derive"] }
109115
serde_json = "1.0.108"
110116
smallvec = { version = "1.10.0", features = [
@@ -124,5 +130,6 @@ tracing-subscriber = { version = "0.3.18", default-features = false, features =
124130
triomphe = { version = "0.1.10", default-features = false, features = ["std"] }
125131
xshell = "0.2.5"
126132

133+
127134
# We need to freeze the version of the crate, as the raw-api feature is considered unstable
128135
dashmap = { version = "=5.5.3", features = ["raw-api"] }

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ la-arena.workspace = true
1616
rust-analyzer-salsa.workspace = true
1717
rustc-hash.workspace = true
1818
triomphe.workspace = true
19+
semver.workspace = true
1920

2021
# local deps
2122
cfg.workspace = true
2223
profile.workspace = true
2324
stdx.workspace = true
2425
syntax.workspace = true
25-
test-utils.workspace = true
26-
tt.workspace = true
2726
vfs.workspace = true
27+
span.workspace = true

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

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,17 @@ use salsa::Durability;
77
use triomphe::Arc;
88
use vfs::FileId;
99

10-
use crate::{CrateGraph, ProcMacros, SourceDatabaseExt, SourceRoot, SourceRootId};
10+
use crate::{CrateGraph, SourceDatabaseExt, SourceRoot, SourceRootId};
1111

1212
/// Encapsulate a bunch of raw `.set` calls on the database.
1313
#[derive(Default)]
14-
pub struct Change {
14+
pub struct FileChange {
1515
pub roots: Option<Vec<SourceRoot>>,
1616
pub files_changed: Vec<(FileId, Option<Arc<str>>)>,
1717
pub crate_graph: Option<CrateGraph>,
18-
pub proc_macros: Option<ProcMacros>,
1918
}
2019

21-
impl fmt::Debug for Change {
20+
impl fmt::Debug for FileChange {
2221
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
2322
let mut d = fmt.debug_struct("Change");
2423
if let Some(roots) = &self.roots {
@@ -34,9 +33,9 @@ impl fmt::Debug for Change {
3433
}
3534
}
3635

37-
impl Change {
36+
impl FileChange {
3837
pub fn new() -> Self {
39-
Change::default()
38+
FileChange::default()
4039
}
4140

4241
pub fn set_roots(&mut self, roots: Vec<SourceRoot>) {
@@ -51,10 +50,6 @@ impl Change {
5150
self.crate_graph = Some(graph);
5251
}
5352

54-
pub fn set_proc_macros(&mut self, proc_macros: ProcMacros) {
55-
self.proc_macros = Some(proc_macros);
56-
}
57-
5853
pub fn apply(self, db: &mut dyn SourceDatabaseExt) {
5954
let _p = profile::span("RootDatabase::apply_change");
6055
if let Some(roots) = self.roots {
@@ -79,9 +74,6 @@ impl Change {
7974
if let Some(crate_graph) = self.crate_graph {
8075
db.set_crate_graph_with_durability(Arc::new(crate_graph), Durability::HIGH);
8176
}
82-
if let Some(proc_macros) = self.proc_macros {
83-
db.set_proc_macros_with_durability(Arc::new(proc_macros), Durability::HIGH);
84-
}
8577
}
8678
}
8779

0 commit comments

Comments
 (0)