@@ -27,7 +27,7 @@ use middle::{trans, freevars, kind, ty, typeck, lint, astencode, reachable};
27
27
use middle;
28
28
use util:: common:: time;
29
29
use util:: ppaux;
30
- use util:: nodemap:: NodeSet ;
30
+ use util:: nodemap:: { NodeMap , NodeSet } ;
31
31
32
32
use serialize:: { json, Encodable } ;
33
33
@@ -39,7 +39,6 @@ use std::mem::drop;
39
39
use std:: os;
40
40
use std:: vec_ng:: Vec ;
41
41
use std:: vec_ng;
42
- use collections:: HashMap ;
43
42
use getopts:: { optopt, optmulti, optflag, optflagopt} ;
44
43
use getopts;
45
44
use syntax:: ast;
@@ -75,9 +74,9 @@ pub fn anon_src() -> ~str {
75
74
76
75
pub fn source_name ( input : & Input ) -> ~str {
77
76
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 ( )
81
80
}
82
81
}
83
82
@@ -213,7 +212,7 @@ pub fn phase_2_configure_and_expand(sess: &Session,
213
212
-> ( ast:: Crate , syntax:: ast_map:: Map ) {
214
213
let time_passes = sess. time_passes ( ) ;
215
214
216
- sess. building_library . set ( session:: building_library ( sess. opts , & krate) ) ;
215
+ sess. building_library . set ( session:: building_library ( & sess. opts , & krate) ) ;
217
216
sess. crate_types . set ( session:: collect_crate_types ( sess,
218
217
krate. attrs
219
218
. as_slice ( ) ) ) ;
@@ -315,7 +314,7 @@ pub fn phase_3_run_analysis_passes(sess: Session,
315
314
sess. macro_registrar_fn . with_mut ( |r| * r =
316
315
time ( time_passes, "looking for macro registrar" , ( ) , |_|
317
316
syntax:: ext:: registrar:: find_macro_registrar (
318
- sess. span_diagnostic , krate) ) ) ;
317
+ sess. diagnostic ( ) , krate) ) ) ;
319
318
320
319
let freevars = time ( time_passes, "freevar finding" , ( ) , |_|
321
320
freevars:: annotate_freevars ( def_map, krate) ) ;
@@ -541,19 +540,14 @@ fn write_out_deps(sess: &Session,
541
540
542
541
// Build a list of files used to compile the output and
543
542
// 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 ( ) ;
557
551
let mut file = try!( io:: File :: create ( & deps_filename) ) ;
558
552
for path in out_filenames. iter ( ) {
559
553
try!( write ! ( & mut file as & mut Writer ,
@@ -741,8 +735,7 @@ static architecture_abis : &'static [(&'static str, abi::Architecture)] = &'stat
741
735
742
736
( "mips" , abi:: Mips ) ] ;
743
737
744
- pub fn build_target_config ( sopts : @session:: Options )
745
- -> @session:: Config {
738
+ pub fn build_target_config ( sopts : & session:: Options ) -> session:: Config {
746
739
let os = match get_os ( sopts. target_triple ) {
747
740
Some ( os) => os,
748
741
None => early_error ( "unknown operating system" )
@@ -764,14 +757,13 @@ pub fn build_target_config(sopts: @session::Options)
764
757
abi:: Arm => arm:: get_target_strs ( target_triple, os) ,
765
758
abi:: Mips => mips:: get_target_strs ( target_triple, os)
766
759
} ;
767
- let target_cfg = @ session:: Config {
760
+ session:: Config {
768
761
os : os,
769
762
arch : arch,
770
763
target_strs : target_strs,
771
764
int_type : int_type,
772
765
uint_type : uint_type,
773
- } ;
774
- return target_cfg;
766
+ }
775
767
}
776
768
777
769
pub fn host_triple ( ) -> ~str {
@@ -938,7 +930,7 @@ pub fn build_session_options(matches: &getopts::Matches)
938
930
matches. opt_present ( "crate-file-name" ) ) ;
939
931
let cg = build_codegen_options ( matches) ;
940
932
941
- @ session:: Options {
933
+ session:: Options {
942
934
crate_types : crate_types,
943
935
gc : gc,
944
936
optimize : opt_level,
@@ -991,25 +983,24 @@ pub fn build_codegen_options(matches: &getopts::Matches)
991
983
return cg;
992
984
}
993
985
994
- pub fn build_session ( sopts : @ session:: Options ,
986
+ pub fn build_session ( sopts : session:: Options ,
995
987
local_crate_source_file : Option < Path > )
996
988
-> Session {
997
- let codemap = @ codemap:: CodeMap :: new ( ) ;
989
+ let codemap = codemap:: CodeMap :: new ( ) ;
998
990
let diagnostic_handler =
999
991
diagnostic:: default_handler ( ) ;
1000
992
let span_diagnostic_handler =
1001
993
diagnostic:: mk_span_handler ( diagnostic_handler, codemap) ;
1002
994
1003
- build_session_ ( sopts, local_crate_source_file, codemap , span_diagnostic_handler)
995
+ build_session_ ( sopts, local_crate_source_file, span_diagnostic_handler)
1004
996
}
1005
997
1006
- pub fn build_session_ ( sopts : @ session:: Options ,
998
+ pub fn build_session_ ( sopts : session:: Options ,
1007
999
local_crate_source_file : Option < Path > ,
1008
- codemap : @codemap:: CodeMap ,
1009
- span_diagnostic_handler : @diagnostic:: SpanHandler )
1000
+ span_diagnostic : diagnostic:: SpanHandler )
1010
1001
-> 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 ) ;
1013
1004
let default_sysroot = match sopts. maybe_sysroot {
1014
1005
Some ( _) => None ,
1015
1006
None => Some ( filesearch:: get_or_default_sysroot ( ) )
@@ -1029,19 +1020,17 @@ pub fn build_session_(sopts: @session::Options,
1029
1020
opts : sopts,
1030
1021
cstore : CStore :: new ( token:: get_ident_interner ( ) ) ,
1031
1022
parse_sess : p_s,
1032
- codemap : codemap,
1033
1023
// For a library crate, this is always none
1034
1024
entry_fn : RefCell :: new ( None ) ,
1035
1025
entry_type : Cell :: new ( None ) ,
1036
1026
macro_registrar_fn : RefCell :: new ( None ) ,
1037
- span_diagnostic : span_diagnostic_handler,
1038
1027
default_sysroot : default_sysroot,
1039
1028
building_library : Cell :: new ( false ) ,
1040
1029
local_crate_source_file : local_crate_source_file,
1041
1030
working_dir : os:: getcwd ( ) ,
1042
- lints : RefCell :: new ( HashMap :: new ( ) ) ,
1031
+ lints : RefCell :: new ( NodeMap :: new ( ) ) ,
1043
1032
node_id : Cell :: new ( 1 ) ,
1044
- crate_types : @ RefCell :: new ( Vec :: new ( ) ) ,
1033
+ crate_types : RefCell :: new ( Vec :: new ( ) ) ,
1045
1034
features : front:: feature_gate:: Features :: new ( ) ,
1046
1035
recursion_limit : Cell :: new ( 64 ) ,
1047
1036
}
0 commit comments