@@ -64,8 +64,10 @@ impl WorkspaceBuildScripts {
64
64
config : & CargoConfig ,
65
65
allowed_features : & FxHashSet < String > ,
66
66
manifest_path : & ManifestPath ,
67
+ toolchain : Option < & Version > ,
67
68
sysroot : Option < & Sysroot > ,
68
69
) -> io:: Result < Command > {
70
+ const RUST_1_75 : Version = Version :: new ( 1 , 75 , 0 ) ;
69
71
let mut cmd = match config. run_build_script_command . as_deref ( ) {
70
72
Some ( [ program, args @ ..] ) => {
71
73
let mut cmd = Command :: new ( program) ;
@@ -120,6 +122,10 @@ impl WorkspaceBuildScripts {
120
122
cmd. arg ( "-Zscript" ) ;
121
123
}
122
124
125
+ if toolchain. map_or ( false , |it| * it >= RUST_1_75 ) {
126
+ cmd. arg ( "--keep-going" ) ;
127
+ }
128
+
123
129
cmd
124
130
}
125
131
} ;
@@ -142,11 +148,9 @@ impl WorkspaceBuildScripts {
142
148
config : & CargoConfig ,
143
149
workspace : & CargoWorkspace ,
144
150
progress : & dyn Fn ( String ) ,
145
- toolchain : & Option < Version > ,
151
+ toolchain : Option < & Version > ,
146
152
sysroot : Option < & Sysroot > ,
147
153
) -> io:: Result < WorkspaceBuildScripts > {
148
- const RUST_1_75 : Version = Version :: new ( 1 , 75 , 0 ) ;
149
-
150
154
let current_dir = match & config. invocation_location {
151
155
InvocationLocation :: Root ( root) if config. run_build_script_command . is_some ( ) => {
152
156
root. as_path ( )
@@ -156,11 +160,13 @@ impl WorkspaceBuildScripts {
156
160
. as_ref ( ) ;
157
161
158
162
let allowed_features = workspace. workspace_features ( ) ;
159
- let mut cmd =
160
- Self :: build_command ( config, & allowed_features, workspace. manifest_path ( ) , sysroot) ?;
161
- if toolchain. as_ref ( ) . map_or ( false , |it| * it >= RUST_1_75 ) {
162
- cmd. args ( [ "--keep-going" ] ) ;
163
- }
163
+ let cmd = Self :: build_command (
164
+ config,
165
+ & allowed_features,
166
+ workspace. manifest_path ( ) ,
167
+ toolchain,
168
+ sysroot,
169
+ ) ?;
164
170
Self :: run_per_ws ( cmd, workspace, current_dir, progress)
165
171
}
166
172
@@ -189,6 +195,7 @@ impl WorkspaceBuildScripts {
189
195
// This is not gonna be used anyways, so just construct a dummy here
190
196
& ManifestPath :: try_from ( workspace_root. clone ( ) ) . unwrap ( ) ,
191
197
None ,
198
+ None ,
192
199
) ?;
193
200
// NB: Cargo.toml could have been modified between `cargo metadata` and
194
201
// `cargo check`. We shouldn't assume that package ids we see here are
0 commit comments