@@ -347,7 +347,7 @@ impl<'test> TestCx<'test> {
347
347
. args ( & [ "--unpretty" , & pretty_type] )
348
348
. args ( & [ "--target" , & self . config . target ] )
349
349
. arg ( "-L" ) . arg ( & aux_dir)
350
- . args ( self . split_maybe_args ( & self . config . target_rustcflags ) )
350
+ . args ( self . split_maybe_lib_args ( & self . config . target_rustcflags ) )
351
351
. args ( & self . props . compile_flags )
352
352
. envs ( self . props . exec_env . clone ( ) ) ;
353
353
@@ -403,7 +403,7 @@ actual:\n\
403
403
rustc. args ( & [ "--cfg" , revision] ) ;
404
404
}
405
405
406
- rustc. args ( self . split_maybe_args ( & self . config . target_rustcflags ) ) ;
406
+ rustc. args ( self . split_maybe_lib_args ( & self . config . target_rustcflags ) ) ;
407
407
rustc. args ( & self . props . compile_flags ) ;
408
408
409
409
self . compose_and_run_compiler ( rustc, Some ( src) )
@@ -1448,7 +1448,7 @@ actual:\n\
1448
1448
if self . props . force_host {
1449
1449
rustc. args ( self . split_maybe_args ( & self . config . host_rustcflags ) ) ;
1450
1450
} else {
1451
- rustc. args ( self . split_maybe_args ( & self . config . target_rustcflags ) ) ;
1451
+ rustc. args ( self . split_maybe_lib_args ( & self . config . target_rustcflags ) ) ;
1452
1452
}
1453
1453
1454
1454
rustc. args ( & self . props . compile_flags ) ;
@@ -1524,6 +1524,25 @@ actual:\n\
1524
1524
}
1525
1525
}
1526
1526
1527
+ // Split library arguments on "-L" to handle paths with spaces properly. Like
1528
+ // split_maybe_args(), empty strings filtered out.
1529
+ fn split_maybe_lib_args ( & self , argstr : & Option < String > ) -> Vec < String > {
1530
+ if let Some ( ref s) = * argstr {
1531
+ s. split ( "-L" )
1532
+ . filter_map ( |p| {
1533
+ let p = p. trim ( ) ;
1534
+ if p. is_empty ( ) { None } else { Some ( p. to_owned ( ) ) }
1535
+ } )
1536
+ . fold ( Vec :: new ( ) , |mut v, arg| {
1537
+ v. push ( "-L" . to_owned ( ) ) ;
1538
+ v. push ( arg) ;
1539
+ v
1540
+ } )
1541
+ } else {
1542
+ Vec :: new ( )
1543
+ }
1544
+ }
1545
+
1527
1546
fn make_cmdline ( & self , command : & Command , libpath : & str ) -> String {
1528
1547
use util;
1529
1548
0 commit comments