@@ -35,6 +35,8 @@ use std::io::fs;
3535use std:: io:: MemReader ;
3636use std:: os;
3737use std:: vec;
38+ use std:: vec_ng:: Vec ;
39+ use std:: vec_ng;
3840use collections:: { HashMap , HashSet } ;
3941use getopts:: { optopt, optmulti, optflag, optflagopt} ;
4042use getopts;
@@ -101,15 +103,15 @@ pub fn default_configuration(sess: Session) ->
101103 } ;
102104
103105 let mk = attr:: mk_name_value_item_str;
104- return ~ [ // Target bindings.
106+ return vec ! ( // Target bindings.
105107 attr:: mk_word_item( fam. clone( ) ) ,
106108 mk( InternedString :: new( "target_os" ) , tos) ,
107109 mk( InternedString :: new( "target_family" ) , fam) ,
108110 mk( InternedString :: new( "target_arch" ) , InternedString :: new( arch) ) ,
109111 mk( InternedString :: new( "target_endian" ) , InternedString :: new( end) ) ,
110112 mk( InternedString :: new( "target_word_size" ) ,
111- InternedString :: new ( wordsz) ) ,
112- ] ;
113+ InternedString :: new( wordsz) )
114+ ) ;
113115}
114116
115117pub fn append_configuration ( cfg : & mut ast:: CrateConfig ,
@@ -119,8 +121,7 @@ pub fn append_configuration(cfg: &mut ast::CrateConfig,
119121 }
120122}
121123
122- pub fn build_configuration ( sess : Session ) ->
123- ast:: CrateConfig {
124+ pub fn build_configuration ( sess : Session ) -> ast:: CrateConfig {
124125 // Combine the configuration requested by the session (command line) with
125126 // some default and generated configuration items
126127 let default_cfg = default_configuration ( sess) ;
@@ -135,15 +136,19 @@ pub fn build_configuration(sess: Session) ->
135136 } else {
136137 InternedString :: new ( "nogc" )
137138 } ) ;
138- return vec:: append ( user_cfg, default_cfg) ;
139+ return vec_ng:: append ( user_cfg. move_iter ( ) . collect ( ) ,
140+ default_cfg. as_slice ( ) ) ;
139141}
140142
141143// Convert strings provided as --cfg [cfgspec] into a crate_cfg
142144fn parse_cfgspecs ( cfgspecs : ~[ ~str ] )
143145 -> ast:: CrateConfig {
144146 cfgspecs. move_iter ( ) . map ( |s| {
145147 let sess = parse:: new_parse_sess ( ) ;
146- parse:: parse_meta_from_source_str ( "cfgspec" . to_str ( ) , s, ~[ ] , sess)
148+ parse:: parse_meta_from_source_str ( "cfgspec" . to_str ( ) ,
149+ s,
150+ Vec :: new ( ) ,
151+ sess)
147152 } ) . collect :: < ast:: CrateConfig > ( )
148153}
149154
@@ -193,7 +198,9 @@ pub fn phase_2_configure_and_expand(sess: Session,
193198 let time_passes = sess. time_passes ( ) ;
194199
195200 sess. building_library . set ( session:: building_library ( sess. opts , & krate) ) ;
196- sess. crate_types . set ( session:: collect_crate_types ( & sess, krate. attrs ) ) ;
201+ sess. crate_types . set ( session:: collect_crate_types ( & sess,
202+ krate. attrs
203+ . as_slice ( ) ) ) ;
197204
198205 time ( time_passes, "gated feature checking" , ( ) , |_|
199206 front:: feature_gate:: check_crate ( sess, & krate) ) ;
@@ -472,7 +479,7 @@ fn write_out_deps(sess: Session,
472479 input : & Input ,
473480 outputs : & OutputFilenames ,
474481 krate : & ast:: Crate ) -> io:: IoResult < ( ) > {
475- let id = link:: find_crate_id ( krate. attrs , outputs) ;
482+ let id = link:: find_crate_id ( krate. attrs . as_slice ( ) , outputs) ;
476483
477484 let mut out_filenames = ~[ ] ;
478485 for output_type in sess. opts . output_types . iter ( ) {
@@ -546,8 +553,11 @@ pub fn compile_input(sess: Session, cfg: ast::CrateConfig, input: &Input,
546553 let loader = & mut Loader :: new ( sess) ;
547554 phase_2_configure_and_expand ( sess, loader, krate)
548555 } ;
549- let outputs = build_output_filenames ( input, outdir, output,
550- expanded_crate. attrs , sess) ;
556+ let outputs = build_output_filenames ( input,
557+ outdir,
558+ output,
559+ expanded_crate. attrs . as_slice ( ) ,
560+ sess) ;
551561
552562 write_out_deps ( sess, input, & outputs, & expanded_crate) . unwrap ( ) ;
553563
@@ -1180,7 +1190,7 @@ mod test {
11801190 let sessopts = build_session_options ( matches) ;
11811191 let sess = build_session ( sessopts, None ) ;
11821192 let cfg = build_configuration ( sess) ;
1183- assert ! ( ( attr:: contains_name( cfg, "test" ) ) ) ;
1193+ assert ! ( ( attr:: contains_name( cfg. as_slice ( ) , "test" ) ) ) ;
11841194 }
11851195
11861196 // When the user supplies --test and --cfg test, don't implicitly add
0 commit comments