@@ -28,6 +28,7 @@ import std::option::some;
28
28
import std:: option:: none;
29
29
import std:: str;
30
30
import std:: vec;
31
+ import std:: ivec;
31
32
import std:: int;
32
33
import std:: ioivec;
33
34
import std:: run;
@@ -78,7 +79,7 @@ fn build_configuration(sess: session::session, argv0: str, input: str) ->
78
79
}
79
80
80
81
// Convert strings provided as --cfg [cfgspec] into a crate_cfg
81
- fn parse_cfgspecs ( cfgspecs : & vec [ str ] ) -> ast:: crate_cfg {
82
+ fn parse_cfgspecs ( cfgspecs : & [ str ] ) -> ast:: crate_cfg {
82
83
// FIXME: It would be nice to use the parser to parse all varieties of
83
84
// meta_item here. At the moment we just support the meta_word variant.
84
85
let words = ~[ ] ;
@@ -383,7 +384,7 @@ fn build_session_options(binary: str, match: getopts::match, binary_dir: str)
383
384
none. { get_default_sysroot( binary) }
384
385
some( s) { s }
385
386
} ;
386
- let cfg = parse_cfgspecs( getopts:: opt_strs ( match , "cfg" ) ) ;
387
+ let cfg = parse_cfgspecs( getopts:: opt_strs_ivec ( match , "cfg" ) ) ;
387
388
let test = opt_present( match , "test" ) ;
388
389
let dps = opt_present( match , "dps" ) ;
389
390
let do_gc = opt_present( match , "gc" ) ;
@@ -428,24 +429,25 @@ fn parse_pretty(sess: session::session, name: &str) -> pp_mode {
428
429
"`typed`, or `identified`" ) ;
429
430
}
430
431
431
- fn opts ( ) -> vec [ getopts:: opt ] {
432
- ret [ optflag ( "h" ) , optflag ( "help" ) , optflag ( "v" ) , optflag ( "version" ) ,
433
- optflag ( "glue" ) , optflag ( "emit-llvm" ) , optflagopt ( "pretty" ) ,
434
- optflagopt ( "expand" ) , optflag ( "ls" ) , optflag ( "parse-only" ) ,
435
- optflag ( "no-trans" ) ,
436
- optflag ( "O" ) , optopt ( "OptLevel" ) , optmulti ( "L" ) , optflag ( "S" ) ,
437
- optflag ( "c" ) , optopt ( "o" ) , optflag ( "g" ) , optflag ( "save-temps" ) ,
438
- optopt ( "sysroot" ) , optflag ( "stats" ) , optflag ( "time-passes" ) ,
439
- optflag ( "time-llvm-passes" ) , optflag ( "no-typestate" ) ,
440
- optflag ( "noverify" ) , optmulti ( "cfg" ) , optflag ( "test" ) ,
441
- optflag ( "lib" ) , optflag ( "static" ) , optflag ( "dps" ) , optflag ( "gc" ) ] ;
432
+ fn opts ( ) -> [ getopts:: opt ] {
433
+ ret ~ [ optflag ( "h" ) , optflag ( "help" ) , optflag ( "v" ) , optflag ( "version" ) ,
434
+ optflag ( "glue" ) , optflag ( "emit-llvm" ) , optflagopt ( "pretty" ) ,
435
+ optflagopt ( "expand" ) , optflag ( "ls" ) , optflag ( "parse-only" ) ,
436
+ optflag ( "no-trans" ) ,
437
+ optflag ( "O" ) , optopt ( "OptLevel" ) , optmulti ( "L" ) , optflag ( "S" ) ,
438
+ optflag ( "c" ) , optopt ( "o" ) , optflag ( "g" ) , optflag ( "save-temps" ) ,
439
+ optopt ( "sysroot" ) , optflag ( "stats" ) , optflag ( "time-passes" ) ,
440
+ optflag ( "time-llvm-passes" ) , optflag ( "no-typestate" ) ,
441
+ optflag ( "noverify" ) , optmulti ( "cfg" ) , optflag ( "test" ) ,
442
+ optflag ( "lib" ) , optflag ( "static" ) , optflag ( "dps" ) , optflag ( "gc" ) ] ;
442
443
}
443
444
444
445
fn main( args : vec[ str ] ) {
445
- let binary = vec:: shift ( args) ;
446
+ let args_ivec = ivec:: from_vec ( args) ;
447
+ let binary = ivec:: shift ( args_ivec) ;
446
448
let binary_dir = fs:: dirname ( binary) ;
447
449
let match =
448
- alt getopts:: getopts ( args , opts ( ) ) {
450
+ alt getopts:: getopts_ivec ( args_ivec , opts ( ) ) {
449
451
getopts:: success ( m) { m }
450
452
getopts:: failure ( f) {
451
453
log_err #fmt( "error: %s" , getopts:: fail_str ( f) ) ;
@@ -517,25 +519,25 @@ fn main(args: vec[str]) {
517
519
none. {
518
520
// "-" as input file will cause the parser to read from stdin so we
519
521
// have to make up a name
520
- let parts : vec [ str ] = if !input_is_stdin ( ifile) {
521
- str:: split ( ifile, '.' as u8 )
522
+ let parts = if !input_is_stdin ( ifile) {
523
+ str:: split_ivec ( ifile, '.' as u8 )
522
524
} else {
523
- [ "default" , "rs" ]
525
+ ~ [ "default" , "rs" ]
524
526
} ;
525
- vec :: pop[ str ] ( parts) ;
527
+ ivec :: pop ( parts) ;
526
528
saved_out_filename = parts. ( 0 ) ;
527
529
alt sopts. output_type {
528
- link:: output_type_none. { parts += [ "none" ] ; }
529
- link:: output_type_bitcode. { parts += [ "bc" ] ; }
530
- link:: output_type_assembly. { parts += [ "s" ] ; }
530
+ link:: output_type_none. { parts += ~ [ "none" ] ; }
531
+ link:: output_type_bitcode. { parts += ~ [ "bc" ] ; }
532
+ link:: output_type_assembly. { parts += ~ [ "s" ] ; }
531
533
532
534
// Object and exe output both use the '.o' extension here
533
535
link:: output_type_object. {
534
- parts += [ "o" ] ;
536
+ parts += ~ [ "o" ] ;
535
537
}
536
- link:: output_type_exe. { parts += [ "o" ] ; }
538
+ link:: output_type_exe. { parts += ~ [ "o" ] ; }
537
539
}
538
- let ofile = str:: connect ( parts, "." ) ;
540
+ let ofile = str:: connect_ivec ( parts, "." ) ;
539
541
compile_input ( sess, cfg, ifile, ofile) ;
540
542
}
541
543
some( ofile) {
@@ -562,9 +564,9 @@ fn main(args: vec[str]) {
562
564
let prog: str = "gcc" ;
563
565
// The invocations of gcc share some flags across platforms
564
566
565
- let gcc_args: vec [ str ] =
566
- [ stage, "-Lrt" , "-lrustrt" , glu, "-m32" , "-o" , saved_out_filename,
567
- saved_out_filename + ".o" ] ;
567
+ let gcc_args =
568
+ ~ [ stage, "-Lrt" , "-lrustrt" , glu, "-m32" , "-o" , saved_out_filename,
569
+ saved_out_filename + ".o" ] ;
568
570
let lib_cmd;
569
571
570
572
let os = sess. get_targ_cfg ( ) . os ;
@@ -598,34 +600,34 @@ fn main(args: vec[str]) {
598
600
let cstore = sess. get_cstore ( ) ;
599
601
for cratepath: str in cstore:: get_used_crate_files ( cstore) {
600
602
if str:: ends_with ( cratepath, ".rlib" ) {
601
- gcc_args += [ cratepath] ;
603
+ gcc_args += ~ [ cratepath] ;
602
604
cont;
603
605
}
604
606
let dir = fs:: dirname ( cratepath) ;
605
- if dir != "" { gcc_args += [ "-L" + dir] ; }
607
+ if dir != "" { gcc_args += ~ [ "-L" + dir] ; }
606
608
let libarg = unlib ( sess. get_targ_cfg ( ) , fs:: basename ( cratepath) ) ;
607
- gcc_args += [ "-l" + libarg] ;
609
+ gcc_args += ~ [ "-l" + libarg] ;
608
610
}
609
611
610
- // FIXME: Remove this ivec->vec conversion.
611
612
let ula = cstore:: get_used_link_args ( cstore) ;
612
- for arg: str in ula { gcc_args += [ arg] ; }
613
+ for arg: str in ula { gcc_args += ~ [ arg] ; }
613
614
614
615
let used_libs = cstore:: get_used_libraries ( cstore) ;
615
- for l: str in used_libs { gcc_args += [ "-l" + l] ; }
616
+ for l: str in used_libs { gcc_args += ~ [ "-l" + l] ; }
616
617
617
618
if sopts. library {
618
- gcc_args += [ lib_cmd] ;
619
+ gcc_args += ~ [ lib_cmd] ;
619
620
} else {
620
621
// FIXME: why do we hardcode -lm?
621
- gcc_args += [ "-lm" , main] ;
622
+ gcc_args += ~ [ "-lm" , main] ;
622
623
}
623
624
// We run 'gcc' here
624
625
625
- let err_code = run:: run_program ( prog, gcc_args) ;
626
+ let err_code = run:: run_program ( prog, ivec :: to_vec ( gcc_args) ) ;
626
627
if 0 != err_code {
627
628
sess. err ( #fmt ( "linking with gcc failed with code %d" , err_code) ) ;
628
- sess. note ( #fmt ( "gcc arguments: %s" , str:: connect ( gcc_args, " " ) ) ) ;
629
+ sess. note ( #fmt ( "gcc arguments: %s" ,
630
+ str:: connect_ivec ( gcc_args, " " ) ) ) ;
629
631
sess. abort_if_errors ( ) ;
630
632
}
631
633
// Clean up on Darwin
@@ -650,7 +652,7 @@ mod test {
650
652
#[ test]
651
653
fn test_switch_implies_cfg_test ( ) {
652
654
let match =
653
- alt getopts:: getopts ( [ "--test" ] , opts ( ) ) {
655
+ alt getopts:: getopts_ivec ( ~ [ "--test" ] , opts ( ) ) {
654
656
getopts:: success ( m) { m }
655
657
} ;
656
658
let sessopts = build_session_options ( "whatever" , match , "whatever" ) ;
@@ -664,7 +666,7 @@ mod test {
664
666
#[ test]
665
667
fn test_switch_implies_cfg_test_unless_cfg_test ( ) {
666
668
let match =
667
- alt getopts:: getopts ( [ "--test" , "--cfg=test" ] , opts ( ) ) {
669
+ alt getopts:: getopts_ivec ( ~ [ "--test" , "--cfg=test" ] , opts ( ) ) {
668
670
getopts:: success ( m) { m }
669
671
} ;
670
672
let sessopts = build_session_options ( "whatever" , match , "whatever" ) ;
0 commit comments