@@ -35,6 +35,8 @@ use std::io::fs;
35
35
use std:: io:: MemReader ;
36
36
use std:: os;
37
37
use std:: vec;
38
+ use std:: vec_ng:: Vec ;
39
+ use std:: vec_ng;
38
40
use collections:: { HashMap , HashSet } ;
39
41
use getopts:: { optopt, optmulti, optflag, optflagopt} ;
40
42
use getopts;
@@ -101,15 +103,15 @@ pub fn default_configuration(sess: Session) ->
101
103
} ;
102
104
103
105
let mk = attr:: mk_name_value_item_str;
104
- return ~ [ // Target bindings.
106
+ return vec ! ( // Target bindings.
105
107
attr:: mk_word_item( fam. clone( ) ) ,
106
108
mk( InternedString :: new( "target_os" ) , tos) ,
107
109
mk( InternedString :: new( "target_family" ) , fam) ,
108
110
mk( InternedString :: new( "target_arch" ) , InternedString :: new( arch) ) ,
109
111
mk( InternedString :: new( "target_endian" ) , InternedString :: new( end) ) ,
110
112
mk( InternedString :: new( "target_word_size" ) ,
111
- InternedString :: new ( wordsz) ) ,
112
- ] ;
113
+ InternedString :: new( wordsz) )
114
+ ) ;
113
115
}
114
116
115
117
pub fn append_configuration ( cfg : & mut ast:: CrateConfig ,
@@ -119,8 +121,7 @@ pub fn append_configuration(cfg: &mut ast::CrateConfig,
119
121
}
120
122
}
121
123
122
- pub fn build_configuration ( sess : Session ) ->
123
- ast:: CrateConfig {
124
+ pub fn build_configuration ( sess : Session ) -> ast:: CrateConfig {
124
125
// Combine the configuration requested by the session (command line) with
125
126
// some default and generated configuration items
126
127
let default_cfg = default_configuration ( sess) ;
@@ -135,15 +136,19 @@ pub fn build_configuration(sess: Session) ->
135
136
} else {
136
137
InternedString :: new ( "nogc" )
137
138
} ) ;
138
- return vec:: append ( user_cfg, default_cfg) ;
139
+ return vec_ng:: append ( user_cfg. move_iter ( ) . collect ( ) ,
140
+ default_cfg. as_slice ( ) ) ;
139
141
}
140
142
141
143
// Convert strings provided as --cfg [cfgspec] into a crate_cfg
142
144
fn parse_cfgspecs ( cfgspecs : ~[ ~str ] )
143
145
-> ast:: CrateConfig {
144
146
cfgspecs. move_iter ( ) . map ( |s| {
145
147
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)
147
152
} ) . collect :: < ast:: CrateConfig > ( )
148
153
}
149
154
@@ -193,7 +198,9 @@ pub fn phase_2_configure_and_expand(sess: Session,
193
198
let time_passes = sess. time_passes ( ) ;
194
199
195
200
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 ( ) ) ) ;
197
204
198
205
time ( time_passes, "gated feature checking" , ( ) , |_|
199
206
front:: feature_gate:: check_crate ( sess, & krate) ) ;
@@ -472,7 +479,7 @@ fn write_out_deps(sess: Session,
472
479
input : & Input ,
473
480
outputs : & OutputFilenames ,
474
481
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) ;
476
483
477
484
let mut out_filenames = ~[ ] ;
478
485
for output_type in sess. opts . output_types . iter ( ) {
@@ -546,8 +553,11 @@ pub fn compile_input(sess: Session, cfg: ast::CrateConfig, input: &Input,
546
553
let loader = & mut Loader :: new ( sess) ;
547
554
phase_2_configure_and_expand ( sess, loader, krate)
548
555
} ;
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) ;
551
561
552
562
write_out_deps ( sess, input, & outputs, & expanded_crate) . unwrap ( ) ;
553
563
@@ -1180,7 +1190,7 @@ mod test {
1180
1190
let sessopts = build_session_options ( matches) ;
1181
1191
let sess = build_session ( sessopts, None ) ;
1182
1192
let cfg = build_configuration ( sess) ;
1183
- assert ! ( ( attr:: contains_name( cfg, "test" ) ) ) ;
1193
+ assert ! ( ( attr:: contains_name( cfg. as_slice ( ) , "test" ) ) ) ;
1184
1194
}
1185
1195
1186
1196
// When the user supplies --test and --cfg test, don't implicitly add
0 commit comments