@@ -15,7 +15,7 @@ use std::path::PathBuf;
15
15
16
16
use super :: BuildConfig ;
17
17
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 > {
19
19
let mut crates = HashSet :: from_iter ( crates. iter ( ) . map ( |s| s. as_str ( ) ) ) ;
20
20
// This is a temporary hack until there is a more principled way to
21
21
// declare dependencies in Cargo.toml.
@@ -30,13 +30,11 @@ fn std_crates<'a>(crates: &'a [String], units: Option<&[Unit]>) -> HashSet<&'a s
30
30
crates. insert ( "compiler_builtins" ) ;
31
31
// Only build libtest if it looks like it is needed (libtest depends on libstd)
32
32
// 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" ) ;
40
38
}
41
39
} else if crates. contains ( "core" ) {
42
40
crates. insert ( "compiler_builtins" ) ;
@@ -50,27 +48,13 @@ pub fn resolve_std<'gctx>(
50
48
ws : & Workspace < ' gctx > ,
51
49
target_data : & mut RustcTargetData < ' gctx > ,
52
50
build_config : & BuildConfig ,
53
- crates : & [ String ] ,
54
51
) -> CargoResult < ( PackageSet < ' gctx > , Resolve , ResolvedFeatures ) > {
55
- let crates = std_crates ( crates, None ) ;
56
-
57
52
if build_config. build_plan {
58
53
ws. gctx ( )
59
54
. shell ( )
60
55
. warn ( "-Zbuild-std does not currently fully support --build-plan" ) ?;
61
56
}
62
57
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
-
74
58
let src_path = detect_sysroot_src_path ( target_data) ?;
75
59
let std_ws_manifest_path = src_path. join ( "Cargo.toml" ) ;
76
60
let gctx = ws. gctx ( ) ;
@@ -129,7 +113,7 @@ pub fn generate_std_roots(
129
113
profiles : & Profiles ,
130
114
target_data : & RustcTargetData < ' _ > ,
131
115
) -> CargoResult < HashMap < CompileKind , Vec < Unit > > > {
132
- let std_ids = std_crates ( crates, Some ( units) )
116
+ let std_ids = std_crates ( crates, units)
133
117
. iter ( )
134
118
. map ( |crate_name| std_resolve. query ( crate_name) )
135
119
. collect :: < CargoResult < Vec < PackageId > > > ( ) ?;
0 commit comments