@@ -214,31 +214,7 @@ impl<'a, 'gctx> BuildRunner<'a, 'gctx> {
214
214
215
215
// Collect the result of the build into `self.compilation`.
216
216
for unit in & self . bcx . roots {
217
- // Collect tests and executables.
218
- for output in self . outputs ( unit) ?. iter ( ) {
219
- if output. flavor == FileFlavor :: DebugInfo || output. flavor == FileFlavor :: Auxiliary
220
- {
221
- continue ;
222
- }
223
-
224
- let bindst = output. bin_dst ( ) ;
225
-
226
- if unit. mode == CompileMode :: Test {
227
- self . compilation
228
- . tests
229
- . push ( self . unit_output ( unit, & output. path ) ) ;
230
- } else if unit. target . is_executable ( ) {
231
- self . compilation
232
- . binaries
233
- . push ( self . unit_output ( unit, bindst) ) ;
234
- } else if unit. target . is_cdylib ( )
235
- && !self . compilation . cdylibs . iter ( ) . any ( |uo| uo. unit == * unit)
236
- {
237
- self . compilation
238
- . cdylibs
239
- . push ( self . unit_output ( unit, bindst) ) ;
240
- }
241
- }
217
+ self . collect_tests_and_executables ( unit) ?;
242
218
243
219
// Collect information for `rustdoc --test`.
244
220
if unit. mode . is_doc_test ( ) {
@@ -307,6 +283,33 @@ impl<'a, 'gctx> BuildRunner<'a, 'gctx> {
307
283
Ok ( self . compilation )
308
284
}
309
285
286
+ fn collect_tests_and_executables ( & mut self , unit : & Unit ) -> CargoResult < ( ) > {
287
+ for output in self . outputs ( unit) ?. iter ( ) {
288
+ if output. flavor == FileFlavor :: DebugInfo || output. flavor == FileFlavor :: Auxiliary {
289
+ continue ;
290
+ }
291
+
292
+ let bindst = output. bin_dst ( ) ;
293
+
294
+ if unit. mode == CompileMode :: Test {
295
+ self . compilation
296
+ . tests
297
+ . push ( self . unit_output ( unit, & output. path ) ) ;
298
+ } else if unit. target . is_executable ( ) {
299
+ self . compilation
300
+ . binaries
301
+ . push ( self . unit_output ( unit, bindst) ) ;
302
+ } else if unit. target . is_cdylib ( )
303
+ && !self . compilation . cdylibs . iter ( ) . any ( |uo| uo. unit == * unit)
304
+ {
305
+ self . compilation
306
+ . cdylibs
307
+ . push ( self . unit_output ( unit, bindst) ) ;
308
+ }
309
+ }
310
+ Ok ( ( ) )
311
+ }
312
+
310
313
/// Returns the executable for the specified unit (if any).
311
314
pub fn get_executable ( & mut self , unit : & Unit ) -> CargoResult < Option < PathBuf > > {
312
315
let is_binary = unit. target . is_executable ( ) ;
0 commit comments