@@ -273,8 +273,8 @@ fn run_pretty_test(config: &Config, props: &TestProps, testfile: &Path) {
273
273
format!( "--target={}" , config. target) ,
274
274
"-L" . to_string( ) ,
275
275
aux_dir. as_str( ) . unwrap( ) . to_string( ) ) ;
276
- args. push_all_move ( split_maybe_args ( & config. target_rustcflags ) ) ;
277
- args. push_all_move ( split_maybe_args ( & props. compile_flags ) ) ;
276
+ args. extend ( split_maybe_args ( & config. target_rustcflags ) . into_iter ( ) ) ;
277
+ args. extend ( split_maybe_args ( & props. compile_flags ) . into_iter ( ) ) ;
278
278
return ProcArgs {
279
279
prog : config. rustc_path . as_str ( ) . unwrap ( ) . to_string ( ) ,
280
280
args : args,
@@ -321,8 +321,8 @@ actual:\n\
321
321
config. build_base. as_str( ) . unwrap( ) . to_string( ) ,
322
322
"-L" . to_string( ) ,
323
323
aux_dir. as_str( ) . unwrap( ) . to_string( ) ) ;
324
- args. push_all_move ( split_maybe_args ( & config. target_rustcflags ) ) ;
325
- args. push_all_move ( split_maybe_args ( & props. compile_flags ) ) ;
324
+ args. extend ( split_maybe_args ( & config. target_rustcflags ) . into_iter ( ) ) ;
325
+ args. extend ( split_maybe_args ( & props. compile_flags ) . into_iter ( ) ) ;
326
326
// FIXME (#9639): This needs to handle non-utf8 paths
327
327
return ProcArgs {
328
328
prog : config. rustc_path . as_str ( ) . unwrap ( ) . to_string ( ) ,
@@ -1095,11 +1095,12 @@ fn compile_test_(config: &Config, props: &TestProps,
1095
1095
testfile : & Path , extra_args : & [ String ] ) -> ProcRes {
1096
1096
let aux_dir = aux_output_dir_name ( config, testfile) ;
1097
1097
// FIXME (#9639): This needs to handle non-utf8 paths
1098
- let link_args = vec ! ( "-L" . to_string( ) ,
1099
- aux_dir. as_str( ) . unwrap( ) . to_string( ) ) ;
1098
+ let mut link_args = vec ! ( "-L" . to_string( ) ,
1099
+ aux_dir. as_str( ) . unwrap( ) . to_string( ) ) ;
1100
+ link_args. extend ( extra_args. iter ( ) . map ( |s| s. clone ( ) ) ) ;
1100
1101
let args = make_compile_args ( config,
1101
1102
props,
1102
- link_args. append ( extra_args ) ,
1103
+ link_args,
1103
1104
|a, b| ThisFile ( make_exe_name ( a, b) ) , testfile) ;
1104
1105
compose_and_run_compiler ( config, props, testfile, args, None )
1105
1106
}
@@ -1146,16 +1147,16 @@ fn compose_and_run_compiler(
1146
1147
for rel_ab in props. aux_builds . iter ( ) {
1147
1148
let abs_ab = config. aux_base . join ( rel_ab. as_slice ( ) ) ;
1148
1149
let aux_props = header:: load_props ( & abs_ab) ;
1149
- let crate_type = if aux_props. no_prefer_dynamic {
1150
+ let mut crate_type = if aux_props. no_prefer_dynamic {
1150
1151
Vec :: new ( )
1151
1152
} else {
1152
1153
vec ! ( "--crate-type=dylib" . to_string( ) )
1153
1154
} ;
1155
+ crate_type. extend ( extra_link_args. clone ( ) . into_iter ( ) ) ;
1154
1156
let aux_args =
1155
1157
make_compile_args ( config,
1156
1158
& aux_props,
1157
- crate_type. append (
1158
- extra_link_args. as_slice ( ) ) ,
1159
+ crate_type,
1159
1160
|a, b| {
1160
1161
let f = make_lib_name ( a, b, testfile) ;
1161
1162
ThisDirectory ( f. dir_path ( ) )
@@ -1246,11 +1247,11 @@ fn make_compile_args(config: &Config,
1246
1247
} ;
1247
1248
args. push ( path. as_str ( ) . unwrap ( ) . to_string ( ) ) ;
1248
1249
if props. force_host {
1249
- args. push_all_move ( split_maybe_args ( & config. host_rustcflags ) ) ;
1250
+ args. extend ( split_maybe_args ( & config. host_rustcflags ) . into_iter ( ) ) ;
1250
1251
} else {
1251
- args. push_all_move ( split_maybe_args ( & config. target_rustcflags ) ) ;
1252
+ args. extend ( split_maybe_args ( & config. target_rustcflags ) . into_iter ( ) ) ;
1252
1253
}
1253
- args. push_all_move ( split_maybe_args ( & props. compile_flags ) ) ;
1254
+ args. extend ( split_maybe_args ( & props. compile_flags ) . into_iter ( ) ) ;
1254
1255
return ProcArgs {
1255
1256
prog : config. rustc_path . as_str ( ) . unwrap ( ) . to_string ( ) ,
1256
1257
args : args,
@@ -1267,10 +1268,9 @@ fn make_lib_name(config: &Config, auxfile: &Path, testfile: &Path) -> Path {
1267
1268
fn make_exe_name ( config : & Config , testfile : & Path ) -> Path {
1268
1269
let mut f = output_base_name ( config, testfile) ;
1269
1270
if !os:: consts:: EXE_SUFFIX . is_empty ( ) {
1270
- match f. filename ( ) . map ( |s| Vec :: from_slice ( s) . append ( os:: consts:: EXE_SUFFIX . as_bytes ( ) ) ) {
1271
- Some ( v) => f. set_filename ( v) ,
1272
- None => ( )
1273
- }
1271
+ let mut fname = f. filename ( ) . unwrap ( ) . to_vec ( ) ;
1272
+ fname. extend ( os:: consts:: EXE_SUFFIX . bytes ( ) ) ;
1273
+ f. set_filename ( fname) ;
1274
1274
}
1275
1275
f
1276
1276
}
@@ -1286,7 +1286,7 @@ fn make_run_args(config: &Config, props: &TestProps, testfile: &Path) ->
1286
1286
args. push ( exe_file. as_str ( ) . unwrap ( ) . to_string ( ) ) ;
1287
1287
1288
1288
// Add the arguments in the run_flags directive
1289
- args. push_all_move ( split_maybe_args ( & props. run_flags ) ) ;
1289
+ args. extend ( split_maybe_args ( & props. run_flags ) . into_iter ( ) ) ;
1290
1290
1291
1291
let prog = args. remove ( 0 ) . unwrap ( ) ;
1292
1292
return ProcArgs {
@@ -1381,12 +1381,10 @@ fn make_out_name(config: &Config, testfile: &Path, extension: &str) -> Path {
1381
1381
}
1382
1382
1383
1383
fn aux_output_dir_name ( config : & Config , testfile : & Path ) -> Path {
1384
- let mut f = output_base_name ( config, testfile) ;
1385
- match f. filename ( ) . map ( |s| Vec :: from_slice ( s) . append ( b".libaux" ) ) {
1386
- Some ( v) => f. set_filename ( v) ,
1387
- None => ( )
1388
- }
1389
- f
1384
+ let f = output_base_name ( config, testfile) ;
1385
+ let mut fname = f. filename ( ) . unwrap ( ) . to_vec ( ) ;
1386
+ fname. extend ( "libaux" . bytes ( ) ) ;
1387
+ f. with_filename ( fname)
1390
1388
}
1391
1389
1392
1390
fn output_testname ( testfile : & Path ) -> Path {
@@ -1598,22 +1596,25 @@ fn append_suffix_to_stem(p: &Path, suffix: &str) -> Path {
1598
1596
if suffix. len ( ) == 0 {
1599
1597
( * p) . clone ( )
1600
1598
} else {
1601
- let stem = p. filestem ( ) . unwrap ( ) ;
1602
- p. with_filename ( Vec :: from_slice ( stem) . append ( b"-" ) . append ( suffix. as_bytes ( ) ) )
1599
+ let mut stem = p. filestem ( ) . unwrap ( ) . to_vec ( ) ;
1600
+ stem. extend ( "-" . bytes ( ) ) ;
1601
+ stem. extend ( suffix. bytes ( ) ) ;
1602
+ p. with_filename ( stem)
1603
1603
}
1604
1604
}
1605
1605
1606
1606
fn compile_test_and_save_bitcode ( config : & Config , props : & TestProps ,
1607
1607
testfile : & Path ) -> ProcRes {
1608
1608
let aux_dir = aux_output_dir_name ( config, testfile) ;
1609
1609
// FIXME (#9639): This needs to handle non-utf8 paths
1610
- let link_args = vec ! ( "-L" . to_string( ) ,
1611
- aux_dir. as_str( ) . unwrap( ) . to_string( ) ) ;
1610
+ let mut link_args = vec ! ( "-L" . to_string( ) ,
1611
+ aux_dir. as_str( ) . unwrap( ) . to_string( ) ) ;
1612
1612
let llvm_args = vec ! ( "--emit=bc,obj" . to_string( ) ,
1613
1613
"--crate-type=lib" . to_string( ) ) ;
1614
+ link_args. extend ( llvm_args. into_iter ( ) ) ;
1614
1615
let args = make_compile_args ( config,
1615
1616
props,
1616
- link_args. append ( llvm_args . as_slice ( ) ) ,
1617
+ link_args,
1617
1618
|a, b| ThisDirectory ( output_base_name ( a, b) . dir_path ( ) ) ,
1618
1619
testfile) ;
1619
1620
compose_and_run_compiler ( config, props, testfile, args, None )
0 commit comments