@@ -64,8 +64,10 @@ impl WorkspaceBuildScripts {
6464 config : & CargoConfig ,
6565 allowed_features : & FxHashSet < String > ,
6666 manifest_path : & ManifestPath ,
67+ toolchain : Option < & Version > ,
6768 sysroot : Option < & Sysroot > ,
6869 ) -> io:: Result < Command > {
70+ const RUST_1_75 : Version = Version :: new ( 1 , 75 , 0 ) ;
6971 let mut cmd = match config. run_build_script_command . as_deref ( ) {
7072 Some ( [ program, args @ ..] ) => {
7173 let mut cmd = Command :: new ( program) ;
@@ -120,6 +122,10 @@ impl WorkspaceBuildScripts {
120122 cmd. arg ( "-Zscript" ) ;
121123 }
122124
125+ if toolchain. map_or ( false , |it| * it >= RUST_1_75 ) {
126+ cmd. arg ( "--keep-going" ) ;
127+ }
128+
123129 cmd
124130 }
125131 } ;
@@ -142,11 +148,9 @@ impl WorkspaceBuildScripts {
142148 config : & CargoConfig ,
143149 workspace : & CargoWorkspace ,
144150 progress : & dyn Fn ( String ) ,
145- toolchain : & Option < Version > ,
151+ toolchain : Option < & Version > ,
146152 sysroot : Option < & Sysroot > ,
147153 ) -> io:: Result < WorkspaceBuildScripts > {
148- const RUST_1_75 : Version = Version :: new ( 1 , 75 , 0 ) ;
149-
150154 let current_dir = match & config. invocation_location {
151155 InvocationLocation :: Root ( root) if config. run_build_script_command . is_some ( ) => {
152156 root. as_path ( )
@@ -156,11 +160,13 @@ impl WorkspaceBuildScripts {
156160 . as_ref ( ) ;
157161
158162 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+ ) ?;
164170 Self :: run_per_ws ( cmd, workspace, current_dir, progress)
165171 }
166172
@@ -189,6 +195,7 @@ impl WorkspaceBuildScripts {
189195 // This is not gonna be used anyways, so just construct a dummy here
190196 & ManifestPath :: try_from ( workspace_root. clone ( ) ) . unwrap ( ) ,
191197 None ,
198+ None ,
192199 ) ?;
193200 // NB: Cargo.toml could have been modified between `cargo metadata` and
194201 // `cargo check`. We shouldn't assume that package ids we see here are
0 commit comments