@@ -871,7 +871,7 @@ pub fn build_session_options(matches: &getopts::Matches)
871871 output_types. push ( link:: OutputTypeExe ) ;
872872 }
873873
874- let sysroot_opt = matches. opt_str ( "sysroot" ) . map ( |m| @ Path :: new ( m) ) ;
874+ let sysroot_opt = matches. opt_str ( "sysroot" ) . map ( |m| Path :: new ( m) ) ;
875875 let target = matches. opt_str ( "target" ) . unwrap_or ( host_triple ( ) ) ;
876876 let opt_level = {
877877 if ( debugging_opts & session:: NO_OPT ) != 0 {
@@ -932,14 +932,14 @@ pub fn build_session_options(matches: &getopts::Matches)
932932 matches. opt_present ( "crate-file-name" ) ) ;
933933 let cg = build_codegen_options ( matches) ;
934934
935- let sopts = @session:: Options {
935+ @session:: Options {
936936 crate_types : crate_types,
937937 gc : gc,
938938 optimize : opt_level,
939939 debuginfo : debuginfo,
940940 lint_opts : lint_opts,
941941 output_types : output_types,
942- addl_lib_search_paths : @ RefCell :: new ( addl_lib_search_paths) ,
942+ addl_lib_search_paths : RefCell :: new ( addl_lib_search_paths) ,
943943 maybe_sysroot : sysroot_opt,
944944 target_triple : target,
945945 cfg : cfg,
@@ -951,8 +951,7 @@ pub fn build_session_options(matches: &getopts::Matches)
951951 write_dependency_info : write_dependency_info,
952952 print_metas : print_metas,
953953 cg : cg,
954- } ;
955- return sopts;
954+ }
956955}
957956
958957pub fn build_codegen_options ( matches : & getopts:: Matches )
@@ -1006,10 +1005,10 @@ pub fn build_session_(sopts: @session::Options,
10061005 let target_cfg = build_target_config ( sopts) ;
10071006 let p_s = parse:: new_parse_sess_special_handler ( span_diagnostic_handler, codemap) ;
10081007 let cstore = @CStore :: new ( token:: get_ident_interner ( ) ) ;
1009- let filesearch = @filesearch :: FileSearch :: new (
1010- & sopts . maybe_sysroot ,
1011- sopts . target_triple ,
1012- sopts . addl_lib_search_paths ) ;
1008+ let default_sysroot = match sopts . maybe_sysroot {
1009+ Some ( _ ) => None ,
1010+ None => Some ( filesearch :: get_or_default_sysroot ( ) )
1011+ } ;
10131012
10141013 // Make the path absolute, if necessary
10151014 let local_crate_source_file = local_crate_source_file. map ( |path|
@@ -1031,7 +1030,7 @@ pub fn build_session_(sopts: @session::Options,
10311030 entry_type : Cell :: new ( None ) ,
10321031 macro_registrar_fn : RefCell :: new ( None ) ,
10331032 span_diagnostic : span_diagnostic_handler,
1034- filesearch : filesearch ,
1033+ default_sysroot : default_sysroot ,
10351034 building_library : Cell :: new ( false ) ,
10361035 local_crate_source_file : local_crate_source_file,
10371036 working_dir : os:: getcwd ( ) ,
0 commit comments