Update sysroot crates

This commit is contained in:
Lukas Wirth 2022-11-07 11:45:52 +01:00
parent e47460b208
commit 8ad4a1d118
2 changed files with 35 additions and 71 deletions

View File

@ -128,14 +128,18 @@ pub fn load(sysroot_dir: AbsPathBuf, sysroot_src_dir: AbsPathBuf) -> Result<Sysr
}
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 @@ fn get_rust_src(sysroot_path: &AbsPath) -> Option<AbsPathBuf> {
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";

View File

@ -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,
},
@ -1600,6 +1600,15 @@ fn rust_project_hello_world_project_model() {
),
prelude: true,
},
Dependency {
crate_id: CrateId(
9,
),
name: CrateName(
"unwind",
),
prelude: true,
},
Dependency {
crate_id: CrateId(
7,
@ -1613,29 +1622,11 @@ fn rust_project_hello_world_project_model() {
crate_id: CrateId(
8,
),
name: CrateName(
"term",
),
prelude: true,
},
Dependency {
crate_id: CrateId(
9,
),
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",
@ -1687,40 +1678,6 @@ fn rust_project_hello_world_project_model() {
),
edition: Edition2018,
version: None,
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(
@ -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",