Skip to content

Commit ad9e421

Browse files
committed
Auto merge of #7337 - alexcrichton:less-optional, r=ehuss
Don't resolve std's optional dependencies Use the `set_require_optional_deps(false)` escape hatch to avoid resolving optional dependencies for libstd. While it doesn't really matter a huge amount either way there's no need for us to generate resolution nodes for things like `rand` just to throw them away because they're never used. Closes rust-lang/wg-cargo-std-aware#37
2 parents f5a701e + 4592af4 commit ad9e421

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/cargo/core/compiler/standard_lib.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,13 @@ pub fn resolve_std<'cfg>(
8080
// now. Perhaps in the future features will be decoupled from the resolver
8181
// and it will be easier to control feature selection.
8282
let current_manifest = src_path.join("src/libtest/Cargo.toml");
83-
// TODO: Consider setting require_option_deps false?
8483
// TODO: Consider doing something to enforce --locked? Or to prevent the
8584
// lock file from being written, such as setting ephemeral.
86-
let std_ws = Workspace::new_virtual(src_path, current_manifest, virtual_manifest, config)?;
85+
let mut std_ws = Workspace::new_virtual(src_path, current_manifest, virtual_manifest, config)?;
86+
// Don't require optional dependencies in this workspace, aka std's own
87+
// `[dev-dependencies]`. No need for us to generate a `Resolve` which has
88+
// those included because we'll never use them anyway.
89+
std_ws.set_require_optional_deps(false);
8790
// `test` is not in the default set because it is optional, but it needs
8891
// to be part of the resolve in case we do need it.
8992
let mut spec_pkgs = Vec::from(crates);

0 commit comments

Comments
 (0)