Skip to content

Commit c0310c1

Browse files
committed
Auto merge of rust-lang#13565 - Veykril:sysroot, r=Veykril
Update sysroot crates
2 parents d3d3806 + 8ad4a1d commit c0310c1

File tree

2 files changed

+31
-67
lines changed

2 files changed

+31
-67
lines changed

crates/project-model/src/sysroot.rs

+17-10
Original file line numberDiff line numberDiff line change
@@ -128,14 +128,18 @@ impl Sysroot {
128128
}
129129

130130
if let Some(alloc) = sysroot.by_name("alloc") {
131-
if let Some(core) = sysroot.by_name("core") {
132-
sysroot.crates[alloc].deps.push(core);
131+
for dep in ALLOC_DEPS.trim().lines() {
132+
if let Some(dep) = sysroot.by_name(dep) {
133+
sysroot.crates[alloc].deps.push(dep)
134+
}
133135
}
134136
}
135137

136138
if let Some(proc_macro) = sysroot.by_name("proc_macro") {
137-
if let Some(std) = sysroot.by_name("std") {
138-
sysroot.crates[proc_macro].deps.push(std);
139+
for dep in PROC_MACRO_DEPS.trim().lines() {
140+
if let Some(dep) = sysroot.by_name(dep) {
141+
sysroot.crates[proc_macro].deps.push(dep)
142+
}
139143
}
140144
}
141145

@@ -239,24 +243,27 @@ fn get_rust_src(sysroot_path: &AbsPath) -> Option<AbsPathBuf> {
239243

240244
const SYSROOT_CRATES: &str = "
241245
alloc
246+
backtrace
242247
core
243248
panic_abort
244249
panic_unwind
245250
proc_macro
246251
profiler_builtins
247252
std
248253
stdarch/crates/std_detect
249-
term
250254
test
251255
unwind";
252256

257+
const ALLOC_DEPS: &str = "core";
258+
253259
const STD_DEPS: &str = "
254260
alloc
255-
core
256-
panic_abort
257261
panic_unwind
262+
panic_abort
263+
core
258264
profiler_builtins
265+
unwind
259266
std_detect
260-
term
261-
test
262-
unwind";
267+
test";
268+
269+
const PROC_MACRO_DEPS: &str = "std";

crates/project-model/src/tests.rs

+14-57
Original file line numberDiff line numberDiff line change
@@ -1566,10 +1566,10 @@ fn rust_project_hello_world_project_model() {
15661566
},
15671567
Dependency {
15681568
crate_id: CrateId(
1569-
1,
1569+
3,
15701570
),
15711571
name: CrateName(
1572-
"core",
1572+
"panic_unwind",
15731573
),
15741574
prelude: true,
15751575
},
@@ -1584,10 +1584,10 @@ fn rust_project_hello_world_project_model() {
15841584
},
15851585
Dependency {
15861586
crate_id: CrateId(
1587-
3,
1587+
1,
15881588
),
15891589
name: CrateName(
1590-
"panic_unwind",
1590+
"core",
15911591
),
15921592
prelude: true,
15931593
},
@@ -1602,40 +1602,31 @@ fn rust_project_hello_world_project_model() {
16021602
},
16031603
Dependency {
16041604
crate_id: CrateId(
1605-
7,
1605+
9,
16061606
),
16071607
name: CrateName(
1608-
"std_detect",
1608+
"unwind",
16091609
),
16101610
prelude: true,
16111611
},
16121612
Dependency {
16131613
crate_id: CrateId(
1614-
8,
1614+
7,
16151615
),
16161616
name: CrateName(
1617-
"term",
1617+
"std_detect",
16181618
),
16191619
prelude: true,
16201620
},
16211621
Dependency {
16221622
crate_id: CrateId(
1623-
9,
1623+
8,
16241624
),
16251625
name: CrateName(
16261626
"test",
16271627
),
16281628
prelude: true,
16291629
},
1630-
Dependency {
1631-
crate_id: CrateId(
1632-
10,
1633-
),
1634-
name: CrateName(
1635-
"unwind",
1636-
),
1637-
prelude: true,
1638-
},
16391630
],
16401631
proc_macro: Err(
16411632
"no proc macro loaded for sysroot crate",
@@ -1687,40 +1678,6 @@ fn rust_project_hello_world_project_model() {
16871678
),
16881679
edition: Edition2018,
16891680
version: None,
1690-
display_name: Some(
1691-
CrateDisplayName {
1692-
crate_name: CrateName(
1693-
"term",
1694-
),
1695-
canonical_name: "term",
1696-
},
1697-
),
1698-
cfg_options: CfgOptions(
1699-
[],
1700-
),
1701-
potential_cfg_options: CfgOptions(
1702-
[],
1703-
),
1704-
env: Env {
1705-
entries: {},
1706-
},
1707-
dependencies: [],
1708-
proc_macro: Err(
1709-
"no proc macro loaded for sysroot crate",
1710-
),
1711-
origin: Lang(
1712-
Other,
1713-
),
1714-
is_proc_macro: false,
1715-
},
1716-
CrateId(
1717-
9,
1718-
): CrateData {
1719-
root_file_id: FileId(
1720-
10,
1721-
),
1722-
edition: Edition2018,
1723-
version: None,
17241681
display_name: Some(
17251682
CrateDisplayName {
17261683
crate_name: CrateName(
@@ -1748,10 +1705,10 @@ fn rust_project_hello_world_project_model() {
17481705
is_proc_macro: false,
17491706
},
17501707
CrateId(
1751-
10,
1708+
9,
17521709
): CrateData {
17531710
root_file_id: FileId(
1754-
11,
1711+
10,
17551712
),
17561713
edition: Edition2018,
17571714
version: None,
@@ -1782,10 +1739,10 @@ fn rust_project_hello_world_project_model() {
17821739
is_proc_macro: false,
17831740
},
17841741
CrateId(
1785-
11,
1742+
10,
17861743
): CrateData {
17871744
root_file_id: FileId(
1788-
12,
1745+
11,
17891746
),
17901747
edition: Edition2018,
17911748
version: None,
@@ -1836,7 +1793,7 @@ fn rust_project_hello_world_project_model() {
18361793
},
18371794
Dependency {
18381795
crate_id: CrateId(
1839-
9,
1796+
8,
18401797
),
18411798
name: CrateName(
18421799
"test",

0 commit comments

Comments
 (0)