Skip to content

Commit 3a85d3f

Browse files
committed
Auto merge of #131832 - lnicola:sync-from-ra, r=lnicola
Subtree update of `rust-analyzer` r? `@ghost`
2 parents 03983fb + e09bf4c commit 3a85d3f

File tree

154 files changed

+2098
-1113
lines changed

Some content is hidden

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

154 files changed

+2098
-1113
lines changed

src/tools/rust-analyzer/Cargo.lock

+42-18
Original file line numberDiff line numberDiff line change
@@ -1187,6 +1187,15 @@ dependencies = [
11871187
"libc",
11881188
]
11891189

1190+
[[package]]
1191+
name = "num_threads"
1192+
version = "0.1.7"
1193+
source = "registry+https://github.com/rust-lang/crates.io-index"
1194+
checksum = "5c7398b9c8b70908f6371f47ed36737907c87c52af34c268fed0bf0ceb92ead9"
1195+
dependencies = [
1196+
"libc",
1197+
]
1198+
11901199
[[package]]
11911200
name = "object"
11921201
version = "0.33.0"
@@ -1439,9 +1448,9 @@ dependencies = [
14391448

14401449
[[package]]
14411450
name = "protobuf"
1442-
version = "3.2.0"
1451+
version = "3.7.1"
14431452
source = "registry+https://github.com/rust-lang/crates.io-index"
1444-
checksum = "b55bad9126f378a853655831eb7363b7b01b81d19f8cb1218861086ca4a1a61e"
1453+
checksum = "a3a7c64d9bf75b1b8d981124c14c179074e8caa7dfe7b6a12e6222ddcd0c8f72"
14451454
dependencies = [
14461455
"once_cell",
14471456
"protobuf-support",
@@ -1450,9 +1459,9 @@ dependencies = [
14501459

14511460
[[package]]
14521461
name = "protobuf-support"
1453-
version = "3.2.0"
1462+
version = "3.7.1"
14541463
source = "registry+https://github.com/rust-lang/crates.io-index"
1455-
checksum = "a5d4d7b8601c814cfb36bcebb79f0e61e45e1e93640cf778837833bbed05c372"
1464+
checksum = "b088fd20b938a875ea00843b6faf48579462630015c3788d397ad6a786663252"
14561465
dependencies = [
14571466
"thiserror",
14581467
]
@@ -1488,9 +1497,9 @@ dependencies = [
14881497

14891498
[[package]]
14901499
name = "ra-ap-rustc_abi"
1491-
version = "0.68.0"
1500+
version = "0.71.0"
14921501
source = "registry+https://github.com/rust-lang/crates.io-index"
1493-
checksum = "2a8cb51bb4534ac3e9c74f1d9bd90e607e60f94f734b1cf1a66f753ad2af6ed7"
1502+
checksum = "c6999d098000b98415939f13158dac78cb3eeeb7b0c073847f3e4b623866e27c"
14941503
dependencies = [
14951504
"bitflags 2.6.0",
14961505
"ra-ap-rustc_index",
@@ -1499,9 +1508,9 @@ dependencies = [
14991508

15001509
[[package]]
15011510
name = "ra-ap-rustc_index"
1502-
version = "0.68.0"
1511+
version = "0.71.0"
15031512
source = "registry+https://github.com/rust-lang/crates.io-index"
1504-
checksum = "8b640fba2b7ef4f875459e2e76daeb846ef341d1d376fa758962ac0eba79bce6"
1513+
checksum = "ae9fb312d942817dab10790881f555928c1f6a11a85186e8e573ad4a86c7d3be"
15051514
dependencies = [
15061515
"arrayvec",
15071516
"ra-ap-rustc_index_macros",
@@ -1510,9 +1519,9 @@ dependencies = [
15101519

15111520
[[package]]
15121521
name = "ra-ap-rustc_index_macros"
1513-
version = "0.68.0"
1522+
version = "0.71.0"
15141523
source = "registry+https://github.com/rust-lang/crates.io-index"
1515-
checksum = "faef502419ba5ac9d3079b1a835c6e5b4e605388254bbe55eb5683936f541be9"
1524+
checksum = "766e3990eb1066a06deefc561b5a01b32ca5c9211feea31cbf4ed50611519872"
15161525
dependencies = [
15171526
"proc-macro2",
15181527
"quote",
@@ -1521,29 +1530,29 @@ dependencies = [
15211530

15221531
[[package]]
15231532
name = "ra-ap-rustc_lexer"
1524-
version = "0.68.0"
1533+
version = "0.71.0"
15251534
source = "registry+https://github.com/rust-lang/crates.io-index"
1526-
checksum = "5da7f9d533b8d5be6704558da741ff20b982ad4647b1e9e08632853e4fecf9d5"
1535+
checksum = "f4afa98eb7889c137d5a3f1cd189089e16da04d1e4837d358a67aa3dab10ffbe"
15271536
dependencies = [
15281537
"unicode-properties",
15291538
"unicode-xid",
15301539
]
15311540

15321541
[[package]]
15331542
name = "ra-ap-rustc_parse_format"
1534-
version = "0.68.0"
1543+
version = "0.71.0"
15351544
source = "registry+https://github.com/rust-lang/crates.io-index"
1536-
checksum = "94389cf81c651b1bda9ac45d3de6a2d851bb6fd4cb893875daa44e419c94205f"
1545+
checksum = "d9234c96ffb0565286790407fb7eb7f55ebf69267de4db382fdec0a17f14b0e2"
15371546
dependencies = [
15381547
"ra-ap-rustc_index",
15391548
"ra-ap-rustc_lexer",
15401549
]
15411550

15421551
[[package]]
15431552
name = "ra-ap-rustc_pattern_analysis"
1544-
version = "0.68.0"
1553+
version = "0.71.0"
15451554
source = "registry+https://github.com/rust-lang/crates.io-index"
1546-
checksum = "3679d8dd0114ed6000918309f843782738e51c99d8e4baec0d0f706e4d948819"
1555+
checksum = "273d5f72926a58c7eea27aebc898d1d5b32d23d2342f692a94a2cf8746aa4a2f"
15471556
dependencies = [
15481557
"ra-ap-rustc_index",
15491558
"rustc-hash",
@@ -1765,9 +1774,9 @@ dependencies = [
17651774

17661775
[[package]]
17671776
name = "scip"
1768-
version = "0.3.3"
1777+
version = "0.5.1"
17691778
source = "registry+https://github.com/rust-lang/crates.io-index"
1770-
checksum = "e5dc1bd66649133af84ab62436ddd2856c2605182b02dec2cd197f684dfe15ef"
1779+
checksum = "8dfafd2fa14c6237fa1fc4310f739d02fa915d92977fa069426591f1de046f81"
17711780
dependencies = [
17721781
"protobuf",
17731782
]
@@ -2093,10 +2102,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
20932102
checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885"
20942103
dependencies = [
20952104
"deranged",
2105+
"itoa",
2106+
"libc",
20962107
"num-conv",
2108+
"num_threads",
20972109
"powerfmt",
20982110
"serde",
20992111
"time-core",
2112+
"time-macros",
21002113
]
21012114

21022115
[[package]]
@@ -2105,6 +2118,16 @@ version = "0.1.2"
21052118
source = "registry+https://github.com/rust-lang/crates.io-index"
21062119
checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3"
21072120

2121+
[[package]]
2122+
name = "time-macros"
2123+
version = "0.2.18"
2124+
source = "registry+https://github.com/rust-lang/crates.io-index"
2125+
checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf"
2126+
dependencies = [
2127+
"num-conv",
2128+
"time-core",
2129+
]
2130+
21082131
[[package]]
21092132
name = "tinyvec"
21102133
version = "1.8.0"
@@ -2213,6 +2236,7 @@ checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b"
22132236
dependencies = [
22142237
"sharded-slab",
22152238
"thread_local",
2239+
"time",
22162240
"tracing-core",
22172241
"tracing-log",
22182242
]

src/tools/rust-analyzer/Cargo.toml

+9-6
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ proc-macro-srv = { path = "./crates/proc-macro-srv", version = "0.0.0" }
7474
proc-macro-srv-cli = { path = "./crates/proc-macro-srv-cli", version = "0.0.0" }
7575
profile = { path = "./crates/profile", version = "0.0.0" }
7676
project-model = { path = "./crates/project-model", version = "0.0.0" }
77-
salsa = { path = "./crates/salsa", version = "0.0.0" }
77+
ra-salsa = { path = "./crates/ra-salsa", package = "salsa", version = "0.0.0" }
7878
span = { path = "./crates/span", version = "0.0.0" }
7979
stdx = { path = "./crates/stdx", version = "0.0.0" }
8080
syntax = { path = "./crates/syntax", version = "0.0.0" }
@@ -85,11 +85,11 @@ tt = { path = "./crates/tt", version = "0.0.0" }
8585
vfs-notify = { path = "./crates/vfs-notify", version = "0.0.0" }
8686
vfs = { path = "./crates/vfs", version = "0.0.0" }
8787

88-
ra-ap-rustc_lexer = { version = "0.68.0", default-features = false }
89-
ra-ap-rustc_parse_format = { version = "0.68.0", default-features = false }
90-
ra-ap-rustc_index = { version = "0.68.0", default-features = false }
91-
ra-ap-rustc_abi = { version = "0.68.0", default-features = false }
92-
ra-ap-rustc_pattern_analysis = { version = "0.68.0", default-features = false }
88+
ra-ap-rustc_lexer = { version = "0.71.0", default-features = false }
89+
ra-ap-rustc_parse_format = { version = "0.71.0", default-features = false }
90+
ra-ap-rustc_index = { version = "0.71.0", default-features = false }
91+
ra-ap-rustc_abi = { version = "0.71.0", default-features = false }
92+
ra-ap-rustc_pattern_analysis = { version = "0.71.0", default-features = false }
9393

9494
# local crates that aren't published to crates.io. These should not have versions.
9595
test-fixture = { path = "./crates/test-fixture" }
@@ -153,6 +153,9 @@ tracing-tree = "0.3.0"
153153
tracing-subscriber = { version = "0.3.18", default-features = false, features = [
154154
"registry",
155155
"fmt",
156+
"local-time",
157+
"std",
158+
"time",
156159
"tracing-log",
157160
] }
158161
triomphe = { version = "0.1.10", default-features = false, features = ["std"] }

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ doctest = false
1616
lz4_flex = { version = "0.11", default-features = false }
1717

1818
la-arena.workspace = true
19-
salsa.workspace = true
19+
ra-salsa.workspace = true
2020
rustc-hash.workspace = true
2121
triomphe.workspace = true
2222
semver.workspace = true

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
44
use std::fmt;
55

6+
use ra_salsa::Durability;
67
use rustc_hash::FxHashMap;
7-
use salsa::Durability;
88
use triomphe::Arc;
99
use vfs::FileId;
1010

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

+5
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,11 @@ pub struct CrateData {
288288
/// The cfg options that could be used by the crate
289289
pub potential_cfg_options: Option<Arc<CfgOptions>>,
290290
pub env: Env,
291+
/// The dependencies of this crate.
292+
///
293+
/// Note that this may contain more dependencies than the crate actually uses.
294+
/// A common example is the test crate which is included but only actually is active when
295+
/// declared in source via `extern crate test`.
291296
pub dependencies: Vec<Dependency>,
292297
pub origin: CrateOrigin,
293298
pub is_proc_macro: bool,

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

+15-15
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ mod input;
55

66
use std::panic;
77

8+
use ra_salsa::Durability;
89
use rustc_hash::FxHashMap;
9-
use salsa::Durability;
1010
use span::EditionedFileId;
1111
use syntax::{ast, Parse, SourceFile, SyntaxError};
1212
use triomphe::Arc;
@@ -20,19 +20,19 @@ pub use crate::{
2020
TargetLayoutLoadResult,
2121
},
2222
};
23-
pub use salsa::{self, Cancelled};
23+
pub use ra_salsa::{self, Cancelled};
2424
pub use vfs::{file_set::FileSet, AnchoredPath, AnchoredPathBuf, VfsPath};
2525

2626
pub use semver::{BuildMetadata, Prerelease, Version, VersionReq};
2727

2828
#[macro_export]
2929
macro_rules! impl_intern_key {
3030
($name:ident) => {
31-
impl $crate::salsa::InternKey for $name {
32-
fn from_intern_id(v: $crate::salsa::InternId) -> Self {
31+
impl $crate::ra_salsa::InternKey for $name {
32+
fn from_intern_id(v: $crate::ra_salsa::InternId) -> Self {
3333
$name(v)
3434
}
35-
fn as_intern_id(&self) -> $crate::salsa::InternId {
35+
fn as_intern_id(&self) -> $crate::ra_salsa::InternId {
3636
self.0
3737
}
3838
}
@@ -55,30 +55,30 @@ pub trait FileLoader {
5555

5656
/// Database which stores all significant input facts: source code and project
5757
/// model. Everything else in rust-analyzer is derived from these queries.
58-
#[salsa::query_group(SourceDatabaseStorage)]
58+
#[ra_salsa::query_group(SourceDatabaseStorage)]
5959
pub trait SourceDatabase: FileLoader + std::fmt::Debug {
60-
#[salsa::input]
60+
#[ra_salsa::input]
6161
fn compressed_file_text(&self, file_id: FileId) -> Arc<[u8]>;
6262

6363
/// Text of the file.
64-
#[salsa::lru]
64+
#[ra_salsa::lru]
6565
fn file_text(&self, file_id: FileId) -> Arc<str>;
6666

6767
/// Parses the file into the syntax tree.
68-
#[salsa::lru]
68+
#[ra_salsa::lru]
6969
fn parse(&self, file_id: EditionedFileId) -> Parse<ast::SourceFile>;
7070

7171
/// Returns the set of errors obtained from parsing the file including validation errors.
7272
fn parse_errors(&self, file_id: EditionedFileId) -> Option<Arc<[SyntaxError]>>;
7373

7474
/// The crate graph.
75-
#[salsa::input]
75+
#[ra_salsa::input]
7676
fn crate_graph(&self) -> Arc<CrateGraph>;
7777

78-
#[salsa::input]
78+
#[ra_salsa::input]
7979
fn crate_workspace_data(&self) -> Arc<FxHashMap<CrateId, Arc<CrateWorkspaceData>>>;
8080

81-
#[salsa::transparent]
81+
#[ra_salsa::transparent]
8282
fn toolchain_channel(&self, krate: CrateId) -> Option<ReleaseChannel>;
8383
}
8484

@@ -126,14 +126,14 @@ fn file_text(db: &dyn SourceDatabase, file_id: FileId) -> Arc<str> {
126126

127127
/// We don't want to give HIR knowledge of source roots, hence we extract these
128128
/// methods into a separate DB.
129-
#[salsa::query_group(SourceRootDatabaseStorage)]
129+
#[ra_salsa::query_group(SourceRootDatabaseStorage)]
130130
pub trait SourceRootDatabase: SourceDatabase {
131131
/// Path to a file, relative to the root of its source root.
132132
/// Source root of the file.
133-
#[salsa::input]
133+
#[ra_salsa::input]
134134
fn file_source_root(&self, file_id: FileId) -> SourceRootId;
135135
/// Contents of the source root.
136-
#[salsa::input]
136+
#[ra_salsa::input]
137137
fn source_root(&self, id: SourceRootId) -> Arc<SourceRoot>;
138138

139139
/// Crates whose root fool is in `id`.

src/tools/rust-analyzer/crates/hir-def/src/data.rs

+8-5
Original file line numberDiff line numberDiff line change
@@ -506,14 +506,17 @@ impl ExternCrateDeclData {
506506
let crate_id = if name == sym::self_.clone() {
507507
Some(krate)
508508
} else {
509-
db.crate_def_map(krate)
510-
.extern_prelude()
511-
.find(|&(prelude_name, ..)| *prelude_name == name)
512-
.map(|(_, (root, _))| root.krate())
509+
db.crate_graph()[krate].dependencies.iter().find_map(|dep| {
510+
if dep.name.symbol() == name.symbol() {
511+
Some(dep.crate_id)
512+
} else {
513+
None
514+
}
515+
})
513516
};
514517

515518
Arc::new(Self {
516-
name: extern_crate.name.clone(),
519+
name,
517520
visibility: item_tree[extern_crate.visibility].clone(),
518521
alias: extern_crate.alias.clone(),
519522
crate_id,

0 commit comments

Comments
 (0)