@@ -16,7 +16,8 @@ use syntax::ast_util::*;
16
16
use syntax:: { ast, attr, codemap, diagnostic, fold, parse, visit} ;
17
17
use codemap:: span;
18
18
use semver:: Version ;
19
- use std:: { json, term, sort} ;
19
+ use std:: { json, term, sort, getopts} ;
20
+ use getopts:: groups:: getopts;
20
21
use api:: Listener ;
21
22
22
23
pub struct Package {
@@ -866,14 +867,15 @@ pub fn compile_input(sysroot: Option<Path>, input: driver::input, dir: &Path,
866
867
let bin_dir = dir. push( ~"bin") ;
867
868
let test_dir = dir. push( ~"test") ;
868
869
let binary = os:: args( ) [ 0 ] ;
869
- let options: @session:: options = @{
870
- binary: binary,
871
- crate_type: session:: unknown_crate,
872
- optimize: if opt { session : : Aggressive } else { session:: No } ,
873
- test: test,
874
- maybe_sysroot: sysroot,
875
- .. * session:: basic_options( )
876
- } ;
870
+ let matches = getopts( flags, driver:: optgroups( ) ) . get( ) ;
871
+ let mut options = driver:: build_session_options( binary, matches,
872
+ diagnostic:: emit) ;
873
+
874
+ options. crate_type = session:: unknown_crate;
875
+ options. optimize = if opt { session : : Aggressive } else { session:: No } ;
876
+ options. test = test;
877
+ options. maybe_sysroot = sysroot;
878
+
877
879
let sess = driver:: build_session( options, diagnostic:: emit) ;
878
880
let cfg = driver:: build_configuration( sess, binary, input) ;
879
881
let mut outputs = driver:: build_output_filenames( input, & None , & None ,
0 commit comments