@@ -15,7 +15,7 @@ use std::path::PathBuf;
1515
1616use super :: BuildConfig ;
1717
18- fn std_crates < ' a > ( crates : & ' a [ String ] , units : Option < & [ Unit ] > ) -> HashSet < & ' a str > {
18+ fn std_crates < ' a > ( crates : & ' a [ String ] , units : & [ Unit ] ) -> HashSet < & ' a str > {
1919 let mut crates = HashSet :: from_iter ( crates. iter ( ) . map ( |s| s. as_str ( ) ) ) ;
2020 // This is a temporary hack until there is a more principled way to
2121 // declare dependencies in Cargo.toml.
@@ -30,13 +30,11 @@ fn std_crates<'a>(crates: &'a [String], units: Option<&[Unit]>) -> HashSet<&'a s
3030 crates. insert ( "compiler_builtins" ) ;
3131 // Only build libtest if it looks like it is needed (libtest depends on libstd)
3232 // If we know what units we're building, we can filter for libtest depending on the jobs.
33- if let Some ( units) = units {
34- if units
35- . iter ( )
36- . any ( |unit| unit. mode . is_rustc_test ( ) && unit. target . harness ( ) )
37- {
38- crates. insert ( "test" ) ;
39- }
33+ if units
34+ . iter ( )
35+ . any ( |unit| unit. mode . is_rustc_test ( ) && unit. target . harness ( ) )
36+ {
37+ crates. insert ( "test" ) ;
4038 }
4139 } else if crates. contains ( "core" ) {
4240 crates. insert ( "compiler_builtins" ) ;
@@ -50,27 +48,13 @@ pub fn resolve_std<'gctx>(
5048 ws : & Workspace < ' gctx > ,
5149 target_data : & mut RustcTargetData < ' gctx > ,
5250 build_config : & BuildConfig ,
53- crates : & [ String ] ,
5451) -> CargoResult < ( PackageSet < ' gctx > , Resolve , ResolvedFeatures ) > {
55- let crates = std_crates ( crates, None ) ;
56-
5752 if build_config. build_plan {
5853 ws. gctx ( )
5954 . shell ( )
6055 . warn ( "-Zbuild-std does not currently fully support --build-plan" ) ?;
6156 }
6257
63- // check that targets support building std
64- if crates. contains ( "std" ) {
65- let unsupported_targets = target_data. get_unsupported_std_targets ( ) ;
66- if !unsupported_targets. is_empty ( ) {
67- anyhow:: bail!(
68- "building std is not supported on the following targets: {}" ,
69- unsupported_targets. join( ", " )
70- )
71- }
72- }
73-
7458 let src_path = detect_sysroot_src_path ( target_data) ?;
7559 let std_ws_manifest_path = src_path. join ( "Cargo.toml" ) ;
7660 let gctx = ws. gctx ( ) ;
@@ -129,7 +113,7 @@ pub fn generate_std_roots(
129113 profiles : & Profiles ,
130114 target_data : & RustcTargetData < ' _ > ,
131115) -> CargoResult < HashMap < CompileKind , Vec < Unit > > > {
132- let std_ids = std_crates ( crates, Some ( units) )
116+ let std_ids = std_crates ( crates, units)
133117 . iter ( )
134118 . map ( |crate_name| std_resolve. query ( crate_name) )
135119 . collect :: < CargoResult < Vec < PackageId > > > ( ) ?;
0 commit comments