@@ -34,6 +34,7 @@ use std::str;
34
34
use std:: io;
35
35
use std:: io:: Process ;
36
36
use std:: io:: fs;
37
+ use std:: vec_ng:: Vec ;
37
38
use flate;
38
39
use serialize:: hex:: ToHex ;
39
40
use extra:: tempfile:: TempDir ;
@@ -106,6 +107,7 @@ pub mod write {
106
107
use std:: io:: Process ;
107
108
use std:: libc:: { c_uint, c_int} ;
108
109
use std:: str;
110
+ use std:: vec_ng:: Vec ;
109
111
110
112
// On android, we by default compile for armv7 processors. This enables
111
113
// things like double word CAS instructions (rather than emulating them)
@@ -222,7 +224,7 @@ pub mod write {
222
224
223
225
if sess. lto ( ) {
224
226
time ( sess. time_passes ( ) , "all lto passes" , ( ) , |( ) |
225
- lto:: run ( sess, llmod, tm, trans. reachable ) ) ;
227
+ lto:: run ( sess, llmod, tm, trans. reachable . as_slice ( ) ) ) ;
226
228
227
229
if sess. opts . cg . save_temps {
228
230
output. with_extension ( "lto.bc" ) . with_c_str ( |buf| {
@@ -363,8 +365,8 @@ pub mod write {
363
365
let vectorize_slp = !sess. opts . cg . no_vectorize_slp &&
364
366
sess. opts . optimize == session:: Aggressive ;
365
367
366
- let mut llvm_c_strs = ~ [ ] ;
367
- let mut llvm_args = ~ [ ] ;
368
+ let mut llvm_c_strs = Vec :: new ( ) ;
369
+ let mut llvm_args = Vec :: new ( ) ;
368
370
{
369
371
let add = |arg : & str | {
370
372
let s = arg. to_c_str ( ) ;
@@ -781,8 +783,8 @@ fn remove(sess: Session, path: &Path) {
781
783
pub fn link_binary ( sess : Session ,
782
784
trans : & CrateTranslation ,
783
785
outputs : & OutputFilenames ,
784
- id : & CrateId ) -> ~ [ Path ] {
785
- let mut out_filenames = ~ [ ] ;
786
+ id : & CrateId ) -> Vec < Path > {
787
+ let mut out_filenames = Vec :: new ( ) ;
786
788
let crate_types = sess. crate_types . borrow ( ) ;
787
789
for & crate_type in crate_types. get ( ) . iter ( ) {
788
790
let out_file = link_binary_output ( sess, trans, crate_type, outputs, id) ;
@@ -931,7 +933,8 @@ fn link_rlib(sess: Session,
931
933
// the same filename for metadata (stomping over one another)
932
934
let tmpdir = TempDir :: new ( "rustc" ) . expect ( "needs a temp dir" ) ;
933
935
let metadata = tmpdir. path ( ) . join ( METADATA_FILENAME ) ;
934
- match fs:: File :: create ( & metadata) . write ( trans. metadata ) {
936
+ match fs:: File :: create ( & metadata) . write ( trans. metadata
937
+ . as_slice ( ) ) {
935
938
Ok ( ..) => { }
936
939
Err ( e) => {
937
940
sess. err ( format ! ( "failed to write {}: {}" ,
@@ -1035,7 +1038,7 @@ fn link_natively(sess: Session, dylib: bool, obj_filename: &Path,
1035
1038
// Invoke the system linker
1036
1039
debug ! ( "{} {}" , cc_prog, cc_args. connect( " " ) ) ;
1037
1040
let prog = time ( sess. time_passes ( ) , "running linker" , ( ) , |( ) |
1038
- Process :: output ( cc_prog, cc_args) ) ;
1041
+ Process :: output ( cc_prog, cc_args. as_slice ( ) ) ) ;
1039
1042
match prog {
1040
1043
Ok ( prog) => {
1041
1044
if !prog. status . success ( ) {
@@ -1071,15 +1074,15 @@ fn link_args(sess: Session,
1071
1074
dylib : bool ,
1072
1075
tmpdir : & Path ,
1073
1076
obj_filename : & Path ,
1074
- out_filename : & Path ) -> ~ [ ~ str ] {
1077
+ out_filename : & Path ) -> Vec < ~ str > {
1075
1078
1076
1079
// The default library location, we need this to find the runtime.
1077
1080
// The location of crates will be determined as needed.
1078
1081
// FIXME (#9639): This needs to handle non-utf8 paths
1079
1082
let lib_path = sess. filesearch . get_target_lib_path ( ) ;
1080
1083
let stage: ~str = ~"-L " + lib_path. as_str ( ) . unwrap ( ) ;
1081
1084
1082
- let mut args = ~ [ stage] ;
1085
+ let mut args = vec ! ( stage) ;
1083
1086
1084
1087
// FIXME (#9639): This needs to handle non-utf8 paths
1085
1088
args. push_all ( [
@@ -1198,7 +1201,7 @@ fn link_args(sess: Session,
1198
1201
// where extern libraries might live, based on the
1199
1202
// addl_lib_search_paths
1200
1203
if !sess. opts . cg . no_rpath {
1201
- args. push_all ( rpath:: get_rpath_flags ( sess, out_filename) ) ;
1204
+ args. push_all ( rpath:: get_rpath_flags ( sess, out_filename) . as_slice ( ) ) ;
1202
1205
}
1203
1206
1204
1207
// Stack growth requires statically linking a __morestack function
@@ -1210,7 +1213,7 @@ fn link_args(sess: Session,
1210
1213
1211
1214
// Finally add all the linker arguments provided on the command line along
1212
1215
// with any #[link_args] attributes found inside the crate
1213
- args. push_all ( sess. opts . cg . link_args ) ;
1216
+ args. push_all ( sess. opts . cg . link_args . as_slice ( ) ) ;
1214
1217
let used_link_args = sess. cstore . get_used_link_args ( ) ;
1215
1218
let used_link_args = used_link_args. borrow ( ) ;
1216
1219
for arg in used_link_args. get ( ) . iter ( ) {
@@ -1230,7 +1233,7 @@ fn link_args(sess: Session,
1230
1233
// Also note that the native libraries linked here are only the ones located
1231
1234
// in the current crate. Upstream crates with native library dependencies
1232
1235
// may have their native library pulled in above.
1233
- fn add_local_native_libraries ( args : & mut ~ [ ~ str ] , sess : Session ) {
1236
+ fn add_local_native_libraries ( args : & mut Vec < ~ str > , sess : Session ) {
1234
1237
let addl_lib_search_paths = sess. opts . addl_lib_search_paths . borrow ( ) ;
1235
1238
for path in addl_lib_search_paths. get ( ) . iter ( ) {
1236
1239
// FIXME (#9639): This needs to handle non-utf8 paths
@@ -1263,7 +1266,7 @@ fn add_local_native_libraries(args: &mut ~[~str], sess: Session) {
1263
1266
// Rust crates are not considered at all when creating an rlib output. All
1264
1267
// dependencies will be linked when producing the final output (instead of
1265
1268
// the intermediate rlib version)
1266
- fn add_upstream_rust_crates ( args : & mut ~ [ ~ str ] , sess : Session ,
1269
+ fn add_upstream_rust_crates ( args : & mut Vec < ~ str > , sess : Session ,
1267
1270
dylib : bool , tmpdir : & Path ) {
1268
1271
1269
1272
// As a limitation of the current implementation, we require that everything
@@ -1347,7 +1350,7 @@ fn add_upstream_rust_crates(args: &mut ~[~str], sess: Session,
1347
1350
// returning `None` if not all libraries could be found with that
1348
1351
// preference.
1349
1352
fn get_deps ( cstore : & cstore:: CStore , preference : cstore:: LinkagePreference )
1350
- -> Option < ~ [ ( ast:: CrateNum , Path ) ] >
1353
+ -> Option < Vec < ( ast:: CrateNum , Path ) > >
1351
1354
{
1352
1355
let crates = cstore. get_used_crates ( preference) ;
1353
1356
if crates. iter ( ) . all ( |& ( _, ref p) | p. is_some ( ) ) {
@@ -1358,8 +1361,8 @@ fn add_upstream_rust_crates(args: &mut ~[~str], sess: Session,
1358
1361
}
1359
1362
1360
1363
// Adds the static "rlib" versions of all crates to the command line.
1361
- fn add_static_crates ( args : & mut ~ [ ~ str ] , sess : Session , tmpdir : & Path ,
1362
- crates : ~ [ ( ast:: CrateNum , Path ) ] ) {
1364
+ fn add_static_crates ( args : & mut Vec < ~ str > , sess : Session , tmpdir : & Path ,
1365
+ crates : Vec < ( ast:: CrateNum , Path ) > ) {
1363
1366
for ( cnum, cratepath) in crates. move_iter ( ) {
1364
1367
// When performing LTO on an executable output, all of the
1365
1368
// bytecode from the upstream libraries has already been
@@ -1405,8 +1408,8 @@ fn add_upstream_rust_crates(args: &mut ~[~str], sess: Session,
1405
1408
}
1406
1409
1407
1410
// Same thing as above, but for dynamic crates instead of static crates.
1408
- fn add_dynamic_crates ( args : & mut ~ [ ~ str ] , sess : Session ,
1409
- crates : ~ [ ( ast:: CrateNum , Path ) ] ) {
1411
+ fn add_dynamic_crates ( args : & mut Vec < ~ str > , sess : Session ,
1412
+ crates : Vec < ( ast:: CrateNum , Path ) > ) {
1410
1413
// If we're performing LTO, then it should have been previously required
1411
1414
// that all upstream rust dependencies were available in an rlib format.
1412
1415
assert ! ( !sess. lto( ) ) ;
@@ -1440,7 +1443,7 @@ fn add_upstream_rust_crates(args: &mut ~[~str], sess: Session,
1440
1443
// generic function calls a native function, then the generic function must
1441
1444
// be instantiated in the target crate, meaning that the native symbol must
1442
1445
// also be resolved in the target crate.
1443
- fn add_upstream_native_libraries ( args : & mut ~ [ ~ str ] , sess : Session ) {
1446
+ fn add_upstream_native_libraries ( args : & mut Vec < ~ str > , sess : Session ) {
1444
1447
let cstore = sess. cstore ;
1445
1448
cstore. iter_crate_data ( |cnum, _| {
1446
1449
let libs = csearch:: get_native_libraries ( cstore, cnum) ;
0 commit comments