Skip to content

Commit 125e873

Browse files
committed
refactor(build-std): sysroot has everything we need for Resolve
sysroot depends on `std`, `proc_macro`, and `test` [1], which includes everything we need from the default set of crates. Passing `sysroot` alone as spec should produce the same resolution. [1]: https://github.com/rust-lang/rust/blob/acabb5248231987ae1f0c215208d1005a5db402d/library/sysroot/Cargo.toml#L7-L11
1 parent 30d11ce commit 125e873

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/cargo/core/compiler/standard_lib.rs

+4-6
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,10 @@ pub fn resolve_std<'gctx>(
8181
// `[dev-dependencies]`. No need for us to generate a `Resolve` which has
8282
// those included because we'll never use them anyway.
8383
std_ws.set_require_optional_deps(false);
84-
// `sysroot` is not in the default set because it is optional, but it needs
85-
// to be part of the resolve in case we do need it or `libtest`.
86-
let mut spec_pkgs: Vec<String> = crates.iter().map(|s| s.to_string()).collect();
87-
spec_pkgs.push("sysroot".to_string());
88-
let spec = Packages::Packages(spec_pkgs);
89-
let specs = spec.to_package_id_specs(&std_ws)?;
84+
// `sysroot` + the default feature set below should give us a good default
85+
// Resolve, which includes `libtest` as well.
86+
let specs = Packages::Packages(vec!["sysroot".into()]);
87+
let specs = specs.to_package_id_specs(&std_ws)?;
9088
let features = match &gctx.cli_unstable().build_std_features {
9189
Some(list) => list.clone(),
9290
None => vec![

0 commit comments

Comments
 (0)