@@ -34,6 +34,7 @@ use std::str;
3434use std:: io;
3535use std:: io:: Process ;
3636use std:: io:: fs;
37+ use std:: vec_ng:: Vec ;
3738use flate;
3839use serialize:: hex:: ToHex ;
3940use extra:: tempfile:: TempDir ;
@@ -106,6 +107,7 @@ pub mod write {
106107 use std:: io:: Process ;
107108 use std:: libc:: { c_uint, c_int} ;
108109 use std:: str;
110+ use std:: vec_ng:: Vec ;
109111
110112 // On android, we by default compile for armv7 processors. This enables
111113 // things like double word CAS instructions (rather than emulating them)
@@ -222,7 +224,7 @@ pub mod write {
222224
223225 if sess. lto ( ) {
224226 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 ( ) ) ) ;
226228
227229 if sess. opts . cg . save_temps {
228230 output. with_extension ( "lto.bc" ) . with_c_str ( |buf| {
@@ -363,8 +365,8 @@ pub mod write {
363365 let vectorize_slp = !sess. opts . cg . no_vectorize_slp &&
364366 sess. opts . optimize == session:: Aggressive ;
365367
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 ( ) ;
368370 {
369371 let add = |arg : & str | {
370372 let s = arg. to_c_str ( ) ;
@@ -781,8 +783,8 @@ fn remove(sess: Session, path: &Path) {
781783pub fn link_binary ( sess : Session ,
782784 trans : & CrateTranslation ,
783785 outputs : & OutputFilenames ,
784- id : & CrateId ) -> ~ [ Path ] {
785- let mut out_filenames = ~ [ ] ;
786+ id : & CrateId ) -> Vec < Path > {
787+ let mut out_filenames = Vec :: new ( ) ;
786788 let crate_types = sess. crate_types . borrow ( ) ;
787789 for & crate_type in crate_types. get ( ) . iter ( ) {
788790 let out_file = link_binary_output ( sess, trans, crate_type, outputs, id) ;
@@ -931,7 +933,8 @@ fn link_rlib(sess: Session,
931933 // the same filename for metadata (stomping over one another)
932934 let tmpdir = TempDir :: new ( "rustc" ) . expect ( "needs a temp dir" ) ;
933935 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 ( ) ) {
935938 Ok ( ..) => { }
936939 Err ( e) => {
937940 sess. err ( format ! ( "failed to write {}: {}" ,
@@ -1035,7 +1038,7 @@ fn link_natively(sess: Session, dylib: bool, obj_filename: &Path,
10351038 // Invoke the system linker
10361039 debug ! ( "{} {}" , cc_prog, cc_args. connect( " " ) ) ;
10371040 let prog = time ( sess. time_passes ( ) , "running linker" , ( ) , |( ) |
1038- Process :: output ( cc_prog, cc_args) ) ;
1041+ Process :: output ( cc_prog, cc_args. as_slice ( ) ) ) ;
10391042 match prog {
10401043 Ok ( prog) => {
10411044 if !prog. status . success ( ) {
@@ -1071,15 +1074,15 @@ fn link_args(sess: Session,
10711074 dylib : bool ,
10721075 tmpdir : & Path ,
10731076 obj_filename : & Path ,
1074- out_filename : & Path ) -> ~ [ ~ str ] {
1077+ out_filename : & Path ) -> Vec < ~ str > {
10751078
10761079 // The default library location, we need this to find the runtime.
10771080 // The location of crates will be determined as needed.
10781081 // FIXME (#9639): This needs to handle non-utf8 paths
10791082 let lib_path = sess. filesearch . get_target_lib_path ( ) ;
10801083 let stage: ~str = ~"-L " + lib_path. as_str ( ) . unwrap ( ) ;
10811084
1082- let mut args = ~ [ stage] ;
1085+ let mut args = vec ! ( stage) ;
10831086
10841087 // FIXME (#9639): This needs to handle non-utf8 paths
10851088 args. push_all ( [
@@ -1198,7 +1201,7 @@ fn link_args(sess: Session,
11981201 // where extern libraries might live, based on the
11991202 // addl_lib_search_paths
12001203 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 ( ) ) ;
12021205 }
12031206
12041207 // Stack growth requires statically linking a __morestack function
@@ -1210,7 +1213,7 @@ fn link_args(sess: Session,
12101213
12111214 // Finally add all the linker arguments provided on the command line along
12121215 // 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 ( ) ) ;
12141217 let used_link_args = sess. cstore . get_used_link_args ( ) ;
12151218 let used_link_args = used_link_args. borrow ( ) ;
12161219 for arg in used_link_args. get ( ) . iter ( ) {
@@ -1230,7 +1233,7 @@ fn link_args(sess: Session,
12301233// Also note that the native libraries linked here are only the ones located
12311234// in the current crate. Upstream crates with native library dependencies
12321235// 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 ) {
12341237 let addl_lib_search_paths = sess. opts . addl_lib_search_paths . borrow ( ) ;
12351238 for path in addl_lib_search_paths. get ( ) . iter ( ) {
12361239 // FIXME (#9639): This needs to handle non-utf8 paths
@@ -1263,7 +1266,7 @@ fn add_local_native_libraries(args: &mut ~[~str], sess: Session) {
12631266// Rust crates are not considered at all when creating an rlib output. All
12641267// dependencies will be linked when producing the final output (instead of
12651268// 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 ,
12671270 dylib : bool , tmpdir : & Path ) {
12681271
12691272 // 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,
13471350 // returning `None` if not all libraries could be found with that
13481351 // preference.
13491352 fn get_deps ( cstore : & cstore:: CStore , preference : cstore:: LinkagePreference )
1350- -> Option < ~ [ ( ast:: CrateNum , Path ) ] >
1353+ -> Option < Vec < ( ast:: CrateNum , Path ) > >
13511354 {
13521355 let crates = cstore. get_used_crates ( preference) ;
13531356 if crates. iter ( ) . all ( |& ( _, ref p) | p. is_some ( ) ) {
@@ -1358,8 +1361,8 @@ fn add_upstream_rust_crates(args: &mut ~[~str], sess: Session,
13581361 }
13591362
13601363 // 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 ) > ) {
13631366 for ( cnum, cratepath) in crates. move_iter ( ) {
13641367 // When performing LTO on an executable output, all of the
13651368 // bytecode from the upstream libraries has already been
@@ -1405,8 +1408,8 @@ fn add_upstream_rust_crates(args: &mut ~[~str], sess: Session,
14051408 }
14061409
14071410 // 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 ) > ) {
14101413 // If we're performing LTO, then it should have been previously required
14111414 // that all upstream rust dependencies were available in an rlib format.
14121415 assert ! ( !sess. lto( ) ) ;
@@ -1440,7 +1443,7 @@ fn add_upstream_rust_crates(args: &mut ~[~str], sess: Session,
14401443// generic function calls a native function, then the generic function must
14411444// be instantiated in the target crate, meaning that the native symbol must
14421445// 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 ) {
14441447 let cstore = sess. cstore ;
14451448 cstore. iter_crate_data ( |cnum, _| {
14461449 let libs = csearch:: get_native_libraries ( cstore, cnum) ;
0 commit comments