Skip to content

Commit 25242fe

Browse files
committed
⬆️ rust-analyzer
Merge commit '368e0bb32f1178cf162c2ce5f7e10b7ae211eb26'
1 parent b3ef934 commit 25242fe

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

Cargo.lock

Lines changed: 81 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/base-db/src/fixture.rs

Lines changed: 11 additions & 3 deletions
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
}

crates/base-db/src/input.rs

Lines changed: 17 additions & 4 deletions
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(

crates/base-db/src/lib.rs

Lines changed: 2 additions & 2 deletions
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)