Skip to content

Commit 59dafb3

Browse files
authored
Merge pull request #21097 from Veykril/push-zpqupukpkrts
proc-macro-srv: Reimplement token trees via immutable trees
2 parents 320c881 + bb89b62 commit 59dafb3

File tree

33 files changed

+1647
-1190
lines changed

33 files changed

+1647
-1190
lines changed

src/tools/rust-analyzer/Cargo.lock

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -772,7 +772,6 @@ dependencies = [
772772
"hir-def",
773773
"hir-expand",
774774
"hir-ty",
775-
"indexmap",
776775
"intern",
777776
"itertools 0.14.0",
778777
"ra-ap-rustc_type_ir",
@@ -824,7 +823,6 @@ dependencies = [
824823
"syntax-bridge",
825824
"test-fixture",
826825
"test-utils",
827-
"text-size 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
828826
"thin-vec",
829827
"tracing",
830828
"triomphe",
@@ -864,7 +862,6 @@ version = "0.0.0"
864862
dependencies = [
865863
"arrayvec",
866864
"base-db",
867-
"bitflags 2.9.4",
868865
"cov-mark",
869866
"either",
870867
"ena",
@@ -890,7 +887,6 @@ dependencies = [
890887
"rustc_apfloat",
891888
"salsa",
892889
"salsa-macros",
893-
"scoped-tls",
894890
"smallvec",
895891
"span",
896892
"stdx",
@@ -1085,7 +1081,6 @@ dependencies = [
10851081
"expect-test",
10861082
"fst",
10871083
"hir",
1088-
"indexmap",
10891084
"itertools 0.14.0",
10901085
"line-index 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
10911086
"macros",
@@ -1825,6 +1820,7 @@ dependencies = [
18251820
"indexmap",
18261821
"intern",
18271822
"paths",
1823+
"proc-macro-srv",
18281824
"rustc-hash 2.1.1",
18291825
"serde",
18301826
"serde_derive",
@@ -1849,9 +1845,7 @@ dependencies = [
18491845
"proc-macro-test",
18501846
"ra-ap-rustc_lexer",
18511847
"span",
1852-
"syntax-bridge",
18531848
"temp-dir",
1854-
"tt",
18551849
]
18561850

18571851
[[package]]
@@ -2291,14 +2285,12 @@ dependencies = [
22912285
"ide-db",
22922286
"ide-ssr",
22932287
"indexmap",
2294-
"intern",
22952288
"itertools 0.14.0",
22962289
"load-cargo",
22972290
"lsp-server 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)",
22982291
"lsp-types",
22992292
"memchr",
23002293
"mimalloc",
2301-
"nohash-hasher",
23022294
"num_cpus",
23032295
"oorandom",
23042296
"parking_lot",
@@ -2491,12 +2483,6 @@ dependencies = [
24912483
"protobuf",
24922484
]
24932485

2494-
[[package]]
2495-
name = "scoped-tls"
2496-
version = "1.0.1"
2497-
source = "registry+https://github.com/rust-lang/crates.io-index"
2498-
checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294"
2499-
25002486
[[package]]
25012487
name = "scopeguard"
25022488
version = "1.2.0"

src/tools/rust-analyzer/crates/hir-def/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ tracing = { workspace = true, features = ["attributes"] }
2727
smallvec.workspace = true
2828
triomphe.workspace = true
2929
rustc_apfloat = "0.2.3"
30-
text-size.workspace = true
3130
salsa.workspace = true
3231
salsa-macros.workspace = true
3332
query-group.workspace = true

src/tools/rust-analyzer/crates/hir-ty/Cargo.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,12 @@ doctest = false
1616
cov-mark = "2.0.0"
1717
itertools.workspace = true
1818
arrayvec.workspace = true
19-
bitflags.workspace = true
2019
smallvec.workspace = true
2120
ena = "0.14.3"
2221
either.workspace = true
2322
oorandom = "11.1.5"
2423
tracing = { workspace = true, features = ["attributes"] }
2524
rustc-hash.workspace = true
26-
scoped-tls = "1.0.1"
2725
la-arena.workspace = true
2826
triomphe.workspace = true
2927
typed-arena = "2.0.2"

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ itertools.workspace = true
2020
smallvec.workspace = true
2121
tracing = { workspace = true, features = ["attributes"] }
2222
triomphe.workspace = true
23-
indexmap.workspace = true
2423

2524
ra-ap-rustc_type_ir.workspace = true
2625

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ rustc-hash.workspace = true
2222
either.workspace = true
2323
itertools.workspace = true
2424
arrayvec.workspace = true
25-
indexmap.workspace = true
2625
memchr = "2.7.5"
2726
salsa.workspace = true
2827
salsa-macros.workspace = true

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,14 @@ indexmap.workspace = true
2424
paths = { workspace = true, features = ["serde1"] }
2525
tt.workspace = true
2626
stdx.workspace = true
27+
proc-macro-srv = {workspace = true, optional = true}
2728
# span = {workspace = true, default-features = false} does not work
2829
span = { path = "../span", version = "0.0.0", default-features = false}
2930

3031
intern.workspace = true
3132

33+
[features]
34+
sysroot-abi = ["proc-macro-srv", "proc-macro-srv/sysroot-abi"]
35+
3236
[lints]
3337
workspace = true

src/tools/rust-analyzer/crates/proc-macro-api/src/legacy_protocol.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,10 @@ pub(crate) fn expand(
9595
let mixed_site = span_data_table.insert_full(mixed_site).0;
9696
let task = ExpandMacro {
9797
data: ExpandMacroData {
98-
macro_body: FlatTree::new(subtree, version, &mut span_data_table),
98+
macro_body: FlatTree::from_subtree(subtree, version, &mut span_data_table),
9999
macro_name: proc_macro.name.to_string(),
100-
attributes: attr.map(|subtree| FlatTree::new(subtree, version, &mut span_data_table)),
100+
attributes: attr
101+
.map(|subtree| FlatTree::from_subtree(subtree, version, &mut span_data_table)),
101102
has_global_spans: ExpnGlobals {
102103
serialize: version >= version::HAS_GLOBAL_SPANS,
103104
def_site,

src/tools/rust-analyzer/crates/proc-macro-api/src/legacy_protocol/msg.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ mod tests {
297297
let mut span_data_table = Default::default();
298298
let task = ExpandMacro {
299299
data: ExpandMacroData {
300-
macro_body: FlatTree::new(tt.view(), v, &mut span_data_table),
300+
macro_body: FlatTree::from_subtree(tt.view(), v, &mut span_data_table),
301301
macro_name: Default::default(),
302302
attributes: None,
303303
has_global_spans: ExpnGlobals {

0 commit comments

Comments
 (0)