@@ -55,14 +55,14 @@ pub enum pp_mode {
55
55
*/
56
56
pub fn anon_src ( ) -> ~str { ~"<anon>" }
57
57
58
- pub fn source_name(input: input) -> ~str {
59
- match input {
58
+ pub fn source_name(input: & input) -> ~str {
59
+ match * input {
60
60
file_input(ref ifile) => ifile.to_str(),
61
61
str_input(_) => anon_src()
62
62
}
63
63
}
64
64
65
- pub fn default_configuration(sess: Session, argv0: @~str, input: input) ->
65
+ pub fn default_configuration(sess: Session, argv0: @~str, input: & input) ->
66
66
ast::crate_cfg {
67
67
let libc = match sess.targ_cfg.os {
68
68
session::os_win32 => ~" msvcrt. dll",
@@ -105,7 +105,7 @@ pub fn default_configuration(sess: Session, argv0: @~str, input: input) ->
105
105
mk ( @~"build_input", @source_name ( input) ) ] ;
106
106
}
107
107
108
- pub fn append_configuration ( + cfg : ast:: crate_cfg , + name : ~str )
108
+ pub fn append_configuration ( cfg : ast:: crate_cfg , name : ~str )
109
109
-> ast:: crate_cfg {
110
110
if attr:: contains_name ( cfg, name) {
111
111
cfg
@@ -114,7 +114,7 @@ pub fn append_configuration(+cfg: ast::crate_cfg, +name: ~str)
114
114
}
115
115
}
116
116
117
- pub fn build_configuration ( sess : Session , argv0 : @~str , input : input ) ->
117
+ pub fn build_configuration ( sess : Session , argv0 : @~str , input : & input ) ->
118
118
ast:: crate_cfg {
119
119
// Combine the configuration requested by the session (command line) with
120
120
// some default and generated configuration items
@@ -132,7 +132,7 @@ pub fn build_configuration(sess: Session, argv0: @~str, input: input) ->
132
132
}
133
133
134
134
// Convert strings provided as --cfg [cfgspec] into a crate_cfg
135
- fn parse_cfgspecs ( + cfgspecs : ~[ ~str ] ,
135
+ fn parse_cfgspecs ( cfgspecs : ~[ ~str ] ,
136
136
demitter : diagnostic:: Emitter ) -> ast:: crate_cfg {
137
137
do vec:: map_consume ( cfgspecs) |s| {
138
138
let sess = parse:: new_parse_sess ( Some ( demitter) ) ;
@@ -147,9 +147,9 @@ pub enum input {
147
147
str_input( ~str )
148
148
}
149
149
150
- pub fn parse_input ( sess : Session , + cfg : ast:: crate_cfg , input : input )
150
+ pub fn parse_input ( sess : Session , cfg : ast:: crate_cfg , input : & input )
151
151
-> @ast:: crate {
152
- match input {
152
+ match * input {
153
153
file_input( ref file) => {
154
154
parse:: parse_crate_from_file_using_tts ( & ( * file) , cfg, sess. parse_sess )
155
155
}
@@ -207,10 +207,10 @@ pub fn compile_rest(sess: Session,
207
207
lint:: build_settings_crate ( sess, crate ) ) ;
208
208
209
209
let ast_map = time ( time_passes, ~"ast indexing", ||
210
- syntax:: ast_map:: map_crate ( sess. diagnostic ( ) , * crate ) ) ;
210
+ syntax:: ast_map:: map_crate ( sess. diagnostic ( ) , crate ) ) ;
211
211
212
212
time ( time_passes, ~"external crate/lib resolution", ||
213
- creader:: read_crates ( sess. diagnostic ( ) , * crate , sess. cstore ,
213
+ creader:: read_crates ( sess. diagnostic ( ) , crate , sess. cstore ,
214
214
sess. filesearch ,
215
215
session:: sess_os_to_meta_os ( sess. targ_cfg . os ) ,
216
216
sess. opts . is_static ,
@@ -344,8 +344,8 @@ pub fn compile_rest(sess: Session,
344
344
return ( crate , None ) ;
345
345
}
346
346
347
- pub fn compile_upto ( sess : Session , + cfg : ast:: crate_cfg ,
348
- input : input , upto : compile_upto ,
347
+ pub fn compile_upto ( sess : Session , cfg : ast:: crate_cfg ,
348
+ input : & input , upto : compile_upto ,
349
349
outputs : Option < @OutputFilenames > )
350
350
-> ( @ast:: crate , Option < ty:: ctxt > ) {
351
351
let time_passes = sess. time_passes ( ) ;
@@ -356,7 +356,7 @@ pub fn compile_upto(sess: Session, +cfg: ast::crate_cfg,
356
356
compile_rest ( sess, cfg, upto, outputs, Some ( crate ) )
357
357
}
358
358
359
- pub fn compile_input ( sess : Session , + cfg : ast:: crate_cfg , input : input ,
359
+ pub fn compile_input ( sess : Session , cfg : ast:: crate_cfg , input : & input ,
360
360
outdir : & Option < Path > , output : & Option < Path > ) {
361
361
let upto = if sess. opts . parse_only { cu_parse }
362
362
else if sess. opts . no_trans { cu_no_trans }
@@ -365,7 +365,7 @@ pub fn compile_input(sess: Session, +cfg: ast::crate_cfg, input: input,
365
365
compile_upto ( sess, cfg, input, upto, Some ( outputs) ) ;
366
366
}
367
367
368
- pub fn pretty_print_input( sess : Session , + cfg : ast:: crate_cfg , input : input ,
368
+ pub fn pretty_print_input( sess : Session , cfg : ast:: crate_cfg , input : & input ,
369
369
ppm : pp_mode ) {
370
370
fn ann_paren_for_expr ( node : pprust:: ann_node ) {
371
371
match node {
@@ -690,7 +690,7 @@ pub fn build_session_(sopts: @session::options,
690
690
cm);
691
691
let cstore = @mut cstore::mk_cstore(p_s.interner);
692
692
let filesearch = filesearch::mk_filesearch(
693
- sopts.maybe_sysroot,
693
+ & sopts.maybe_sysroot,
694
694
sopts.target_triple,
695
695
/*bad*/copy sopts.addl_lib_search_paths);
696
696
let lint_settings = lint::mk_lint_settings();
@@ -711,13 +711,13 @@ pub fn build_session_(sopts: @session::options,
711
711
}
712
712
}
713
713
714
- pub fn parse_pretty(sess: Session, && name: ~ str) -> pp_mode {
714
+ pub fn parse_pretty(sess: Session, name: & str) -> pp_mode {
715
715
match name {
716
- ~ " normal" => ppm_normal,
717
- ~ " expanded" => ppm_expanded,
718
- ~ " typed" => ppm_typed,
719
- ~ " expanded, identified" => ppm_expanded_identified,
720
- ~ " identified" => ppm_identified,
716
+ & " normal" => ppm_normal,
717
+ & " expanded" => ppm_expanded,
718
+ & " typed" => ppm_typed,
719
+ & " expanded, identified" => ppm_expanded_identified,
720
+ & " identified" => ppm_identified,
721
721
_ => {
722
722
sess.fatal(~" argument to `pretty` must be one of `normal`, \
723
723
`expanded`, `typed`, `identified`, \
@@ -790,7 +790,7 @@ pub struct OutputFilenames {
790
790
obj_filename : Path
791
791
}
792
792
793
- pub fn build_output_filenames( input: input,
793
+ pub fn build_output_filenames( input: & input,
794
794
odir: & Option < Path > ,
795
795
ofile: & Option < Path > ,
796
796
sess: Session )
@@ -820,13 +820,13 @@ pub fn build_output_filenames(input: input,
820
820
// We want to toss everything after the final '.'
821
821
let dirpath = match * odir {
822
822
Some ( ref d) => ( /*bad*/ copy * d) ,
823
- None => match input {
823
+ None => match * input {
824
824
str_input( _) => os : : getcwd( ) ,
825
825
file_input( ref ifile) => ( * ifile) . dir_path( )
826
826
}
827
827
} ;
828
828
829
- let stem = match input {
829
+ let stem = match * input {
830
830
file_input( ref ifile) => ( * ifile) . filestem( ) . get( ) ,
831
831
str_input( _) => ~"rust_out"
832
832
} ;
@@ -903,7 +903,7 @@ mod test {
903
903
let sessopts = build_session_options(
904
904
@~" rustc", matches, diagnostic:: emit) ;
905
905
let sess = build_session( sessopts, diagnostic:: emit) ;
906
- let cfg = build_configuration( sess, @~"whatever", str_input( ~"") ) ;
906
+ let cfg = build_configuration( sess, @~"whatever", & str_input( ~"") ) ;
907
907
assert!( ( attr:: contains_name( cfg, ~"test")));
908
908
}
909
909
@@ -922,7 +922,7 @@ mod test {
922
922
let sessopts = build_session_options(
923
923
@~" rustc", matches, diagnostic::emit);
924
924
let sess = build_session(sessopts, diagnostic::emit);
925
- let cfg = build_configuration(sess, @~" whatever", str_input(~" "));
925
+ let cfg = build_configuration(sess, @~" whatever", & str_input(~" "));
926
926
let test_items = attr::find_meta_items_by_name(cfg, ~" test" ) ;
927
927
assert!( ( vec:: len( test_items) == 1 u) ) ;
928
928
}
0 commit comments