@@ -27,7 +27,7 @@ use middle::{trans, freevars, kind, ty, typeck, lint, astencode, reachable};
2727use middle;
2828use util:: common:: time;
2929use util:: ppaux;
30- use util:: nodemap:: NodeSet ;
30+ use util:: nodemap:: { NodeMap , NodeSet } ;
3131
3232use serialize:: { json, Encodable } ;
3333
@@ -39,7 +39,6 @@ use std::mem::drop;
3939use std:: os;
4040use std:: vec_ng:: Vec ;
4141use std:: vec_ng;
42- use collections:: HashMap ;
4342use getopts:: { optopt, optmulti, optflag, optflagopt} ;
4443use getopts;
4544use syntax:: ast;
@@ -75,9 +74,9 @@ pub fn anon_src() -> ~str {
7574
7675pub fn source_name ( input : & Input ) -> ~str {
7776 match * input {
78- // FIXME (#9639): This needs to handle non-utf8 paths
79- FileInput ( ref ifile) => ifile. as_str ( ) . unwrap ( ) . to_str ( ) ,
80- StrInput ( _) => anon_src ( )
77+ // FIXME (#9639): This needs to handle non-utf8 paths
78+ FileInput ( ref ifile) => ifile. as_str ( ) . unwrap ( ) . to_str ( ) ,
79+ StrInput ( _) => anon_src ( )
8180 }
8281}
8382
@@ -213,7 +212,7 @@ pub fn phase_2_configure_and_expand(sess: &Session,
213212 -> ( ast:: Crate , syntax:: ast_map:: Map ) {
214213 let time_passes = sess. time_passes ( ) ;
215214
216- sess. building_library . set ( session:: building_library ( sess. opts , & krate) ) ;
215+ sess. building_library . set ( session:: building_library ( & sess. opts , & krate) ) ;
217216 sess. crate_types . set ( session:: collect_crate_types ( sess,
218217 krate. attrs
219218 . as_slice ( ) ) ) ;
@@ -315,7 +314,7 @@ pub fn phase_3_run_analysis_passes(sess: Session,
315314 sess. macro_registrar_fn . with_mut ( |r| * r =
316315 time ( time_passes, "looking for macro registrar" , ( ) , |_|
317316 syntax:: ext:: registrar:: find_macro_registrar (
318- sess. span_diagnostic , krate) ) ) ;
317+ sess. diagnostic ( ) , krate) ) ) ;
319318
320319 let freevars = time ( time_passes, "freevar finding" , ( ) , |_|
321320 freevars:: annotate_freevars ( def_map, krate) ) ;
@@ -541,19 +540,14 @@ fn write_out_deps(sess: &Session,
541540
542541 // Build a list of files used to compile the output and
543542 // write Makefile-compatible dependency rules
544- let files: Vec < ~str > = {
545- let files = sess. codemap . files . borrow ( ) ;
546- files. get ( )
547- . iter ( )
548- . filter_map ( |fmap| {
549- if fmap. is_real_file ( ) {
550- Some ( fmap. name . clone ( ) )
551- } else {
552- None
553- }
554- } )
555- . collect ( )
556- } ;
543+ let files: Vec < ~str > = sess. codemap ( ) . files . borrow ( ) . get ( )
544+ . iter ( ) . filter_map ( |fmap| {
545+ if fmap. deref ( ) . is_real_file ( ) {
546+ Some ( fmap. deref ( ) . name . clone ( ) )
547+ } else {
548+ None
549+ }
550+ } ) . collect ( ) ;
557551 let mut file = try!( io:: File :: create ( & deps_filename) ) ;
558552 for path in out_filenames. iter ( ) {
559553 try!( write ! ( & mut file as & mut Writer ,
@@ -741,8 +735,7 @@ static architecture_abis : &'static [(&'static str, abi::Architecture)] = &'stat
741735
742736 ( "mips" , abi:: Mips ) ] ;
743737
744- pub fn build_target_config ( sopts : @session:: Options )
745- -> @session:: Config {
738+ pub fn build_target_config ( sopts : & session:: Options ) -> session:: Config {
746739 let os = match get_os ( sopts. target_triple ) {
747740 Some ( os) => os,
748741 None => early_error ( "unknown operating system" )
@@ -764,14 +757,13 @@ pub fn build_target_config(sopts: @session::Options)
764757 abi:: Arm => arm:: get_target_strs ( target_triple, os) ,
765758 abi:: Mips => mips:: get_target_strs ( target_triple, os)
766759 } ;
767- let target_cfg = @ session:: Config {
760+ session:: Config {
768761 os : os,
769762 arch : arch,
770763 target_strs : target_strs,
771764 int_type : int_type,
772765 uint_type : uint_type,
773- } ;
774- return target_cfg;
766+ }
775767}
776768
777769pub fn host_triple ( ) -> ~str {
@@ -938,7 +930,7 @@ pub fn build_session_options(matches: &getopts::Matches)
938930 matches. opt_present ( "crate-file-name" ) ) ;
939931 let cg = build_codegen_options ( matches) ;
940932
941- @ session:: Options {
933+ session:: Options {
942934 crate_types : crate_types,
943935 gc : gc,
944936 optimize : opt_level,
@@ -991,25 +983,24 @@ pub fn build_codegen_options(matches: &getopts::Matches)
991983 return cg;
992984}
993985
994- pub fn build_session ( sopts : @ session:: Options ,
986+ pub fn build_session ( sopts : session:: Options ,
995987 local_crate_source_file : Option < Path > )
996988 -> Session {
997- let codemap = @ codemap:: CodeMap :: new ( ) ;
989+ let codemap = codemap:: CodeMap :: new ( ) ;
998990 let diagnostic_handler =
999991 diagnostic:: default_handler ( ) ;
1000992 let span_diagnostic_handler =
1001993 diagnostic:: mk_span_handler ( diagnostic_handler, codemap) ;
1002994
1003- build_session_ ( sopts, local_crate_source_file, codemap , span_diagnostic_handler)
995+ build_session_ ( sopts, local_crate_source_file, span_diagnostic_handler)
1004996}
1005997
1006- pub fn build_session_ ( sopts : @ session:: Options ,
998+ pub fn build_session_ ( sopts : session:: Options ,
1007999 local_crate_source_file : Option < Path > ,
1008- codemap : @codemap:: CodeMap ,
1009- span_diagnostic_handler : @diagnostic:: SpanHandler )
1000+ span_diagnostic : diagnostic:: SpanHandler )
10101001 -> Session {
1011- let target_cfg = build_target_config ( sopts) ;
1012- let p_s = parse:: new_parse_sess_special_handler ( span_diagnostic_handler , codemap ) ;
1002+ let target_cfg = build_target_config ( & sopts) ;
1003+ let p_s = parse:: new_parse_sess_special_handler ( span_diagnostic ) ;
10131004 let default_sysroot = match sopts. maybe_sysroot {
10141005 Some ( _) => None ,
10151006 None => Some ( filesearch:: get_or_default_sysroot ( ) )
@@ -1029,19 +1020,17 @@ pub fn build_session_(sopts: @session::Options,
10291020 opts : sopts,
10301021 cstore : CStore :: new ( token:: get_ident_interner ( ) ) ,
10311022 parse_sess : p_s,
1032- codemap : codemap,
10331023 // For a library crate, this is always none
10341024 entry_fn : RefCell :: new ( None ) ,
10351025 entry_type : Cell :: new ( None ) ,
10361026 macro_registrar_fn : RefCell :: new ( None ) ,
1037- span_diagnostic : span_diagnostic_handler,
10381027 default_sysroot : default_sysroot,
10391028 building_library : Cell :: new ( false ) ,
10401029 local_crate_source_file : local_crate_source_file,
10411030 working_dir : os:: getcwd ( ) ,
1042- lints : RefCell :: new ( HashMap :: new ( ) ) ,
1031+ lints : RefCell :: new ( NodeMap :: new ( ) ) ,
10431032 node_id : Cell :: new ( 1 ) ,
1044- crate_types : @ RefCell :: new ( Vec :: new ( ) ) ,
1033+ crate_types : RefCell :: new ( Vec :: new ( ) ) ,
10451034 features : front:: feature_gate:: Features :: new ( ) ,
10461035 recursion_limit : Cell :: new ( 64 ) ,
10471036 }
0 commit comments