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 @@ impl Sysroot {
} }
if let Some(alloc) = sysroot.by_name("alloc") { if let Some(alloc) = sysroot.by_name("alloc") {
if let Some(core) = sysroot.by_name("core") { for dep in ALLOC_DEPS.trim().lines() {
sysroot.crates[alloc].deps.push(core); 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(proc_macro) = sysroot.by_name("proc_macro") {
if let Some(std) = sysroot.by_name("std") { for dep in PROC_MACRO_DEPS.trim().lines() {
sysroot.crates[proc_macro].deps.push(std); 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 = " const SYSROOT_CRATES: &str = "
alloc alloc
backtrace
core core
panic_abort panic_abort
panic_unwind panic_unwind
@ -246,17 +251,19 @@ proc_macro
profiler_builtins profiler_builtins
std std
stdarch/crates/std_detect stdarch/crates/std_detect
term
test test
unwind"; unwind";
const ALLOC_DEPS: &str = "core";
const STD_DEPS: &str = " const STD_DEPS: &str = "
alloc alloc
core
panic_abort
panic_unwind panic_unwind
panic_abort
core
profiler_builtins profiler_builtins
unwind
std_detect std_detect
term test";
test
unwind"; const PROC_MACRO_DEPS: &str = "std";

View file

@ -1566,10 +1566,10 @@ fn rust_project_hello_world_project_model() {
}, },
Dependency { Dependency {
crate_id: CrateId( crate_id: CrateId(
1, 3,
), ),
name: CrateName( name: CrateName(
"core", "panic_unwind",
), ),
prelude: true, prelude: true,
}, },
@ -1584,10 +1584,10 @@ fn rust_project_hello_world_project_model() {
}, },
Dependency { Dependency {
crate_id: CrateId( crate_id: CrateId(
3, 1,
), ),
name: CrateName( name: CrateName(
"panic_unwind", "core",
), ),
prelude: true, prelude: true,
}, },
@ -1600,6 +1600,15 @@ fn rust_project_hello_world_project_model() {
), ),
prelude: true, prelude: true,
}, },
Dependency {
crate_id: CrateId(
9,
),
name: CrateName(
"unwind",
),
prelude: true,
},
Dependency { Dependency {
crate_id: CrateId( crate_id: CrateId(
7, 7,
@ -1613,29 +1622,11 @@ fn rust_project_hello_world_project_model() {
crate_id: CrateId( crate_id: CrateId(
8, 8,
), ),
name: CrateName(
"term",
),
prelude: true,
},
Dependency {
crate_id: CrateId(
9,
),
name: CrateName( name: CrateName(
"test", "test",
), ),
prelude: true, prelude: true,
}, },
Dependency {
crate_id: CrateId(
10,
),
name: CrateName(
"unwind",
),
prelude: true,
},
], ],
proc_macro: Err( proc_macro: Err(
"no proc macro loaded for sysroot crate", "no proc macro loaded for sysroot crate",
@ -1687,40 +1678,6 @@ fn rust_project_hello_world_project_model() {
), ),
edition: Edition2018, edition: Edition2018,
version: None, 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( display_name: Some(
CrateDisplayName { CrateDisplayName {
crate_name: CrateName( crate_name: CrateName(
@ -1748,10 +1705,10 @@ fn rust_project_hello_world_project_model() {
is_proc_macro: false, is_proc_macro: false,
}, },
CrateId( CrateId(
10, 9,
): CrateData { ): CrateData {
root_file_id: FileId( root_file_id: FileId(
11, 10,
), ),
edition: Edition2018, edition: Edition2018,
version: None, version: None,
@ -1782,10 +1739,10 @@ fn rust_project_hello_world_project_model() {
is_proc_macro: false, is_proc_macro: false,
}, },
CrateId( CrateId(
11, 10,
): CrateData { ): CrateData {
root_file_id: FileId( root_file_id: FileId(
12, 11,
), ),
edition: Edition2018, edition: Edition2018,
version: None, version: None,
@ -1836,7 +1793,7 @@ fn rust_project_hello_world_project_model() {
}, },
Dependency { Dependency {
crate_id: CrateId( crate_id: CrateId(
9, 8,
), ),
name: CrateName( name: CrateName(
"test", "test",