Skip to content

Commit 3254bef

Browse files
committed
Auto merge of #105855 - arcnmx:rust-analyzer-2022-12, r=lnicola
⬆️ rust-analyzer Updates rust-analyzer to rust-lang/rust-analyzer@368e0bb This is a continuation/replacement of #105834, close that if this is chosen instead.
2 parents 3020239 + 06e705f commit 3254bef

File tree

395 files changed

+14558
-5744
lines changed

Some content is hidden

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

395 files changed

+14558
-5744
lines changed

src/tools/rust-analyzer/Cargo.lock

+81-8
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,12 @@ version = "1.3.2"
112112
source = "registry+https://github.com/rust-lang/crates.io-index"
113113
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
114114

115+
[[package]]
116+
name = "byteorder"
117+
version = "1.4.3"
118+
source = "registry+https://github.com/rust-lang/crates.io-index"
119+
checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
120+
115121
[[package]]
116122
name = "camino"
117123
version = "1.1.1"
@@ -171,9 +177,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
171177

172178
[[package]]
173179
name = "chalk-derive"
174-
version = "0.86.0"
180+
version = "0.88.0"
175181
source = "registry+https://github.com/rust-lang/crates.io-index"
176-
checksum = "5499d415d855b5094366a824815341893ad3de0ecb6048c430118bdae6d27402"
182+
checksum = "4df80a3fbc1f0e59f560eeeebca94bf655566a8ad3023c210a109deb6056455a"
177183
dependencies = [
178184
"proc-macro2",
179185
"quote",
@@ -183,9 +189,9 @@ dependencies = [
183189

184190
[[package]]
185191
name = "chalk-ir"
186-
version = "0.86.0"
192+
version = "0.88.0"
187193
source = "registry+https://github.com/rust-lang/crates.io-index"
188-
checksum = "3800118c76a48507b0eece3a01f3a429b5c478d203c493096e6040c67ab960e1"
194+
checksum = "f39e5272016916956298cceea5147006f897972c274a768ed4d6e074efe5d3fb"
189195
dependencies = [
190196
"bitflags",
191197
"chalk-derive",
@@ -194,9 +200,9 @@ dependencies = [
194200

195201
[[package]]
196202
name = "chalk-recursive"
197-
version = "0.86.0"
203+
version = "0.88.0"
198204
source = "registry+https://github.com/rust-lang/crates.io-index"
199-
checksum = "1baf60628fd73104d1f8562586a52d48f37f1e84435aab2e62674b1fd935b8c8"
205+
checksum = "d9d60b42ad7478d3e027e2f9ea4e99fbbb8fdee0c8c3cf068be269f57e603618"
200206
dependencies = [
201207
"chalk-derive",
202208
"chalk-ir",
@@ -207,9 +213,9 @@ dependencies = [
207213

208214
[[package]]
209215
name = "chalk-solve"
210-
version = "0.86.0"
216+
version = "0.88.0"
211217
source = "registry+https://github.com/rust-lang/crates.io-index"
212-
checksum = "0e9c3c068f9358786348e58a1b94ef0a5cf90a9810fc1f10fda896f0b5d80185"
218+
checksum = "ab30620ea5b36819525eaab2204f4b8e1842fc7ee36826424a28bef59ae7fecf"
213219
dependencies = [
214220
"chalk-derive",
215221
"chalk-ir",
@@ -510,6 +516,8 @@ dependencies = [
510516
"fst",
511517
"hashbrown",
512518
"hir-expand",
519+
"hkalbasi-rustc-ap-rustc_abi",
520+
"hkalbasi-rustc-ap-rustc_index",
513521
"indexmap",
514522
"itertools",
515523
"la-arena",
@@ -555,6 +563,7 @@ version = "0.0.0"
555563
dependencies = [
556564
"arrayvec",
557565
"base-db",
566+
"bitflags",
558567
"chalk-derive",
559568
"chalk-ir",
560569
"chalk-recursive",
@@ -564,6 +573,7 @@ dependencies = [
564573
"expect-test",
565574
"hir-def",
566575
"hir-expand",
576+
"hkalbasi-rustc-ap-rustc_index",
567577
"itertools",
568578
"la-arena",
569579
"limit",
@@ -581,6 +591,27 @@ dependencies = [
581591
"typed-arena",
582592
]
583593

594+
[[package]]
595+
name = "hkalbasi-rustc-ap-rustc_abi"
596+
version = "0.0.20221221"
597+
source = "registry+https://github.com/rust-lang/crates.io-index"
598+
checksum = "adabaadad9aa7576f97af02241cdf5554d62fb3d51a84cb05d77ba28edd3013f"
599+
dependencies = [
600+
"bitflags",
601+
"hkalbasi-rustc-ap-rustc_index",
602+
"tracing",
603+
]
604+
605+
[[package]]
606+
name = "hkalbasi-rustc-ap-rustc_index"
607+
version = "0.0.20221221"
608+
source = "registry+https://github.com/rust-lang/crates.io-index"
609+
checksum = "f4d3c48474e09afb0f5efbd6f758e05411699301a113c47d454d28ec7059d00e"
610+
dependencies = [
611+
"arrayvec",
612+
"smallvec",
613+
]
614+
584615
[[package]]
585616
name = "home"
586617
version = "0.5.4"
@@ -631,6 +662,7 @@ dependencies = [
631662
"ide-db",
632663
"itertools",
633664
"profile",
665+
"smallvec",
634666
"sourcegen",
635667
"stdx",
636668
"syntax",
@@ -1750,6 +1782,33 @@ dependencies = [
17501782
"tikv-jemalloc-sys",
17511783
]
17521784

1785+
[[package]]
1786+
name = "time"
1787+
version = "0.3.17"
1788+
source = "registry+https://github.com/rust-lang/crates.io-index"
1789+
checksum = "a561bf4617eebd33bca6434b988f39ed798e527f51a1e797d0ee4f61c0a38376"
1790+
dependencies = [
1791+
"itoa",
1792+
"serde",
1793+
"time-core",
1794+
"time-macros",
1795+
]
1796+
1797+
[[package]]
1798+
name = "time-core"
1799+
version = "0.1.0"
1800+
source = "registry+https://github.com/rust-lang/crates.io-index"
1801+
checksum = "2e153e1f1acaef8acc537e68b44906d2db6436e2b35ac2c6b42640fff91f00fd"
1802+
1803+
[[package]]
1804+
name = "time-macros"
1805+
version = "0.2.6"
1806+
source = "registry+https://github.com/rust-lang/crates.io-index"
1807+
checksum = "d967f99f534ca7e495c575c62638eebc2898a8c84c119b89e250477bc4ba16b2"
1808+
dependencies = [
1809+
"time-core",
1810+
]
1811+
17531812
[[package]]
17541813
name = "tinyvec"
17551814
version = "1.6.0"
@@ -2148,4 +2207,18 @@ dependencies = [
21482207
"write-json",
21492208
"xflags",
21502209
"xshell",
2210+
"zip",
2211+
]
2212+
2213+
[[package]]
2214+
name = "zip"
2215+
version = "0.6.3"
2216+
source = "registry+https://github.com/rust-lang/crates.io-index"
2217+
checksum = "537ce7411d25e54e8ae21a7ce0b15840e7bfcff15b51d697ec3266cc76bdf080"
2218+
dependencies = [
2219+
"byteorder",
2220+
"crc32fast",
2221+
"crossbeam-utils",
2222+
"flate2",
2223+
"time",
21512224
]

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

+11-3
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ impl ChangeFixture {
162162
Ok(Vec::new()),
163163
false,
164164
origin,
165+
meta.target_data_layout.as_deref().map(Arc::from),
165166
);
166167
let prev = crates.insert(crate_name.clone(), crate_id);
167168
assert!(prev.is_none());
@@ -197,6 +198,7 @@ impl ChangeFixture {
197198
Ok(Vec::new()),
198199
false,
199200
CrateOrigin::CratesIo { repo: None, name: None },
201+
None,
200202
);
201203
} else {
202204
for (from, to, prelude) in crate_deps {
@@ -210,6 +212,8 @@ impl ChangeFixture {
210212
.unwrap();
211213
}
212214
}
215+
let target_layout =
216+
crate_graph.iter().next().and_then(|it| crate_graph[it].target_layout.clone());
213217

214218
if let Some(mini_core) = mini_core {
215219
let core_file = file_id;
@@ -234,6 +238,7 @@ impl ChangeFixture {
234238
Ok(Vec::new()),
235239
false,
236240
CrateOrigin::Lang(LangCrateOrigin::Core),
241+
target_layout.clone(),
237242
);
238243

239244
for krate in all_crates {
@@ -271,6 +276,7 @@ impl ChangeFixture {
271276
Ok(proc_macro),
272277
true,
273278
CrateOrigin::CratesIo { repo: None, name: None },
279+
target_layout,
274280
);
275281

276282
for krate in all_crates {
@@ -391,6 +397,7 @@ struct FileMeta {
391397
edition: Edition,
392398
env: Env,
393399
introduce_new_source_root: Option<SourceRootKind>,
400+
target_data_layout: Option<String>,
394401
}
395402

396403
fn parse_crate(crate_str: String) -> (String, CrateOrigin, Option<String>) {
@@ -400,9 +407,9 @@ fn parse_crate(crate_str: String) -> (String, CrateOrigin, Option<String>) {
400407
Some((version, url)) => {
401408
(version, CrateOrigin::CratesIo { repo: Some(url.to_owned()), name: None })
402409
}
403-
_ => panic!("Bad crates.io parameter: {}", data),
410+
_ => panic!("Bad crates.io parameter: {data}"),
404411
},
405-
_ => panic!("Bad string for crate origin: {}", b),
412+
_ => panic!("Bad string for crate origin: {b}"),
406413
};
407414
(a.to_owned(), origin, Some(version.to_string()))
408415
} else {
@@ -432,8 +439,9 @@ impl From<Fixture> for FileMeta {
432439
introduce_new_source_root: f.introduce_new_source_root.map(|kind| match &*kind {
433440
"local" => SourceRootKind::Local,
434441
"library" => SourceRootKind::Library,
435-
invalid => panic!("invalid source root kind '{}'", invalid),
442+
invalid => panic!("invalid source root kind '{invalid}'"),
436443
}),
444+
target_data_layout: f.target_data_layout,
437445
}
438446
}
439447
}

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

+17-4
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ impl fmt::Display for CrateName {
128128
impl ops::Deref for CrateName {
129129
type Target = str;
130130
fn deref(&self) -> &str {
131-
&*self.0
131+
&self.0
132132
}
133133
}
134134

@@ -211,7 +211,7 @@ impl fmt::Display for CrateDisplayName {
211211
impl ops::Deref for CrateDisplayName {
212212
type Target = str;
213213
fn deref(&self) -> &str {
214-
&*self.crate_name
214+
&self.crate_name
215215
}
216216
}
217217

@@ -270,6 +270,7 @@ pub struct CrateData {
270270
pub display_name: Option<CrateDisplayName>,
271271
pub cfg_options: CfgOptions,
272272
pub potential_cfg_options: CfgOptions,
273+
pub target_layout: Option<Arc<str>>,
273274
pub env: Env,
274275
pub dependencies: Vec<Dependency>,
275276
pub proc_macro: ProcMacroLoadResult,
@@ -328,6 +329,7 @@ impl CrateGraph {
328329
proc_macro: ProcMacroLoadResult,
329330
is_proc_macro: bool,
330331
origin: CrateOrigin,
332+
target_layout: Option<Arc<str>>,
331333
) -> CrateId {
332334
let data = CrateData {
333335
root_file_id,
@@ -340,6 +342,7 @@ impl CrateGraph {
340342
proc_macro,
341343
dependencies: Vec::new(),
342344
origin,
345+
target_layout,
343346
is_proc_macro,
344347
};
345348
let crate_id = CrateId(self.arena.len() as u32);
@@ -615,8 +618,8 @@ impl CyclicDependenciesError {
615618
impl fmt::Display for CyclicDependenciesError {
616619
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
617620
let render = |(id, name): &(CrateId, Option<CrateDisplayName>)| match name {
618-
Some(it) => format!("{}({:?})", it, id),
619-
None => format!("{:?}", id),
621+
Some(it) => format!("{it}({id:?})"),
622+
None => format!("{id:?}"),
620623
};
621624
let path = self.path.iter().rev().map(render).collect::<Vec<String>>().join(" -> ");
622625
write!(
@@ -649,6 +652,7 @@ mod tests {
649652
Ok(Vec::new()),
650653
false,
651654
CrateOrigin::CratesIo { repo: None, name: None },
655+
None,
652656
);
653657
let crate2 = graph.add_crate_root(
654658
FileId(2u32),
@@ -661,6 +665,7 @@ mod tests {
661665
Ok(Vec::new()),
662666
false,
663667
CrateOrigin::CratesIo { repo: None, name: None },
668+
None,
664669
);
665670
let crate3 = graph.add_crate_root(
666671
FileId(3u32),
@@ -673,6 +678,7 @@ mod tests {
673678
Ok(Vec::new()),
674679
false,
675680
CrateOrigin::CratesIo { repo: None, name: None },
681+
None,
676682
);
677683
assert!(graph
678684
.add_dep(crate1, Dependency::new(CrateName::new("crate2").unwrap(), crate2))
@@ -699,6 +705,7 @@ mod tests {
699705
Ok(Vec::new()),
700706
false,
701707
CrateOrigin::CratesIo { repo: None, name: None },
708+
None,
702709
);
703710
let crate2 = graph.add_crate_root(
704711
FileId(2u32),
@@ -711,6 +718,7 @@ mod tests {
711718
Ok(Vec::new()),
712719
false,
713720
CrateOrigin::CratesIo { repo: None, name: None },
721+
None,
714722
);
715723
assert!(graph
716724
.add_dep(crate1, Dependency::new(CrateName::new("crate2").unwrap(), crate2))
@@ -734,6 +742,7 @@ mod tests {
734742
Ok(Vec::new()),
735743
false,
736744
CrateOrigin::CratesIo { repo: None, name: None },
745+
None,
737746
);
738747
let crate2 = graph.add_crate_root(
739748
FileId(2u32),
@@ -746,6 +755,7 @@ mod tests {
746755
Ok(Vec::new()),
747756
false,
748757
CrateOrigin::CratesIo { repo: None, name: None },
758+
None,
749759
);
750760
let crate3 = graph.add_crate_root(
751761
FileId(3u32),
@@ -758,6 +768,7 @@ mod tests {
758768
Ok(Vec::new()),
759769
false,
760770
CrateOrigin::CratesIo { repo: None, name: None },
771+
None,
761772
);
762773
assert!(graph
763774
.add_dep(crate1, Dependency::new(CrateName::new("crate2").unwrap(), crate2))
@@ -781,6 +792,7 @@ mod tests {
781792
Ok(Vec::new()),
782793
false,
783794
CrateOrigin::CratesIo { repo: None, name: None },
795+
None,
784796
);
785797
let crate2 = graph.add_crate_root(
786798
FileId(2u32),
@@ -793,6 +805,7 @@ mod tests {
793805
Ok(Vec::new()),
794806
false,
795807
CrateOrigin::CratesIo { repo: None, name: None },
808+
None,
796809
);
797810
assert!(graph
798811
.add_dep(

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ pub trait SourceDatabase: FileLoader + std::fmt::Debug {
7575
}
7676

7777
fn parse_query(db: &dyn SourceDatabase, file_id: FileId) -> Parse<ast::SourceFile> {
78-
let _p = profile::span("parse_query").detail(|| format!("{:?}", file_id));
78+
let _p = profile::span("parse_query").detail(|| format!("{file_id:?}"));
7979
let text = db.file_text(file_id);
80-
SourceFile::parse(&*text)
80+
SourceFile::parse(&text)
8181
}
8282

8383
/// We don't want to give HIR knowledge of source roots, hence we extract these

0 commit comments

Comments
 (0)