Unnamed repository; edit this file 'description' to name the repository.
Auto merge of #13565 - Veykril:sysroot, r=Veykril
Update sysroot crates
bors 2022-11-07
parent d3d3806 · parent 8ad4a1d · commit c0310c1
-rw-r--r--crates/project-model/src/sysroot.rs27
-rw-r--r--crates/project-model/src/tests.rs71
2 files changed, 31 insertions, 67 deletions
diff --git a/crates/project-model/src/sysroot.rs b/crates/project-model/src/sysroot.rs
index fa8d76f3f4..f6c09a27c9 100644
--- a/crates/project-model/src/sysroot.rs
+++ b/crates/project-model/src/sysroot.rs
@@ -128,14 +128,18 @@ impl Sysroot {
}
if let Some(alloc) = sysroot.by_name("alloc") {
- if let Some(core) = sysroot.by_name("core") {
- sysroot.crates[alloc].deps.push(core);
+ for dep in ALLOC_DEPS.trim().lines() {
+ if let Some(dep) = sysroot.by_name(dep) {
+ sysroot.crates[alloc].deps.push(dep)
+ }
}
}
if let Some(proc_macro) = sysroot.by_name("proc_macro") {
- if let Some(std) = sysroot.by_name("std") {
- sysroot.crates[proc_macro].deps.push(std);
+ for dep in PROC_MACRO_DEPS.trim().lines() {
+ if let Some(dep) = sysroot.by_name(dep) {
+ sysroot.crates[proc_macro].deps.push(dep)
+ }
}
}
@@ -239,6 +243,7 @@ fn get_rust_src(sysroot_path: &AbsPath) -> Option<AbsPathBuf> {
const SYSROOT_CRATES: &str = "
alloc
+backtrace
core
panic_abort
panic_unwind
@@ -246,17 +251,19 @@ proc_macro
profiler_builtins
std
stdarch/crates/std_detect
-term
test
unwind";
+const ALLOC_DEPS: &str = "core";
+
const STD_DEPS: &str = "
alloc
-core
-panic_abort
panic_unwind
+panic_abort
+core
profiler_builtins
+unwind
std_detect
-term
-test
-unwind";
+test";
+
+const PROC_MACRO_DEPS: &str = "std";
diff --git a/crates/project-model/src/tests.rs b/crates/project-model/src/tests.rs
index e2444e2497..a1cb438bdd 100644
--- a/crates/project-model/src/tests.rs
+++ b/crates/project-model/src/tests.rs
@@ -1566,10 +1566,10 @@ fn rust_project_hello_world_project_model() {
},
Dependency {
crate_id: CrateId(
- 1,
+ 3,
),
name: CrateName(
- "core",
+ "panic_unwind",
),
prelude: true,
},
@@ -1584,10 +1584,10 @@ fn rust_project_hello_world_project_model() {
},
Dependency {
crate_id: CrateId(
- 3,
+ 1,
),
name: CrateName(
- "panic_unwind",
+ "core",
),
prelude: true,
},
@@ -1602,40 +1602,31 @@ fn rust_project_hello_world_project_model() {
},
Dependency {
crate_id: CrateId(
- 7,
+ 9,
),
name: CrateName(
- "std_detect",
+ "unwind",
),
prelude: true,
},
Dependency {
crate_id: CrateId(
- 8,
+ 7,
),
name: CrateName(
- "term",
+ "std_detect",
),
prelude: true,
},
Dependency {
crate_id: CrateId(
- 9,
+ 8,
),
name: CrateName(
"test",
),
prelude: true,
},
- Dependency {
- crate_id: CrateId(
- 10,
- ),
- name: CrateName(
- "unwind",
- ),
- prelude: true,
- },
],
proc_macro: Err(
"no proc macro loaded for sysroot crate",
@@ -1690,40 +1681,6 @@ fn rust_project_hello_world_project_model() {
display_name: Some(
CrateDisplayName {
crate_name: CrateName(
- "term",
- ),
- canonical_name: "term",
- },
- ),
- cfg_options: CfgOptions(
- [],
- ),
- potential_cfg_options: CfgOptions(
- [],
- ),
- env: Env {
- entries: {},
- },
- dependencies: [],
- proc_macro: Err(
- "no proc macro loaded for sysroot crate",
- ),
- origin: Lang(
- Other,
- ),
- is_proc_macro: false,
- },
- CrateId(
- 9,
- ): CrateData {
- root_file_id: FileId(
- 10,
- ),
- edition: Edition2018,
- version: None,
- display_name: Some(
- CrateDisplayName {
- crate_name: CrateName(
"test",
),
canonical_name: "test",
@@ -1748,10 +1705,10 @@ fn rust_project_hello_world_project_model() {
is_proc_macro: false,
},
CrateId(
- 10,
+ 9,
): CrateData {
root_file_id: FileId(
- 11,
+ 10,
),
edition: Edition2018,
version: None,
@@ -1782,10 +1739,10 @@ fn rust_project_hello_world_project_model() {
is_proc_macro: false,
},
CrateId(
- 11,
+ 10,
): CrateData {
root_file_id: FileId(
- 12,
+ 11,
),
edition: Edition2018,
version: None,
@@ -1836,7 +1793,7 @@ fn rust_project_hello_world_project_model() {
},
Dependency {
crate_id: CrateId(
- 9,
+ 8,
),
name: CrateName(
"test",