@@ -139,11 +139,9 @@ pub struct Options {
139139 pub continue_parse_after_error : bool ,
140140 pub mir_opt_level : usize ,
141141
142- /// if true, build up the dep-graph
143- pub build_dep_graph : bool ,
144-
145- /// if true, -Z dump-dep-graph was passed to dump out the dep-graph
146- pub dump_dep_graph : bool ,
142+ /// if Some, enable incremental compilation, using the given
143+ /// directory to store intermediate results
144+ pub incremental : Option < PathBuf > ,
147145
148146 pub no_analysis : bool ,
149147 pub debugging_opts : DebuggingOptions ,
@@ -260,8 +258,7 @@ pub fn basic_options() -> Options {
260258 treat_err_as_bug : false ,
261259 continue_parse_after_error : false ,
262260 mir_opt_level : 1 ,
263- build_dep_graph : false ,
264- dump_dep_graph : false ,
261+ incremental : None ,
265262 no_analysis : false ,
266263 debugging_opts : basic_debugging_options ( ) ,
267264 prints : Vec :: new ( ) ,
@@ -276,6 +273,15 @@ pub fn basic_options() -> Options {
276273 }
277274}
278275
276+ impl Options {
277+ /// True if there is a reason to build the dep graph.
278+ pub fn build_dep_graph ( & self ) -> bool {
279+ self . incremental . is_some ( ) ||
280+ self . debugging_opts . dump_dep_graph ||
281+ self . debugging_opts . query_dep_graph
282+ }
283+ }
284+
279285// The type of entry function, so
280286// users can have their own entry
281287// functions that don't start a
@@ -635,10 +641,12 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
635641 "treat all errors that occur as bugs" ) ,
636642 continue_parse_after_error: bool = ( false , parse_bool,
637643 "attempt to recover from parse errors (experimental)" ) ,
638- incr_comp : bool = ( false , parse_bool ,
644+ incremental : Option < String > = ( None , parse_opt_string ,
639645 "enable incremental compilation (experimental)" ) ,
640646 dump_dep_graph: bool = ( false , parse_bool,
641647 "dump the dependency graph to $RUST_DEP_GRAPH (default: /tmp/dep_graph.gv)" ) ,
648+ query_dep_graph: bool = ( false , parse_bool,
649+ "enable queries of the dependency graph for regression testing" ) ,
642650 no_analysis: bool = ( false , parse_bool,
643651 "parse and expand the source, but run no analysis" ) ,
644652 extra_plugins: Vec <String > = ( Vec :: new( ) , parse_list,
@@ -1051,8 +1059,6 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
10511059 let treat_err_as_bug = debugging_opts. treat_err_as_bug ;
10521060 let continue_parse_after_error = debugging_opts. continue_parse_after_error ;
10531061 let mir_opt_level = debugging_opts. mir_opt_level . unwrap_or ( 1 ) ;
1054- let incremental_compilation = debugging_opts. incr_comp ;
1055- let dump_dep_graph = debugging_opts. dump_dep_graph ;
10561062 let no_analysis = debugging_opts. no_analysis ;
10571063
10581064 let mut output_types = HashMap :: new ( ) ;
@@ -1212,6 +1218,8 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
12121218
12131219 let crate_name = matches. opt_str ( "crate-name" ) ;
12141220
1221+ let incremental = debugging_opts. incremental . as_ref ( ) . map ( |m| PathBuf :: from ( m) ) ;
1222+
12151223 Options {
12161224 crate_types : crate_types,
12171225 gc : gc,
@@ -1231,8 +1239,7 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
12311239 treat_err_as_bug : treat_err_as_bug,
12321240 continue_parse_after_error : continue_parse_after_error,
12331241 mir_opt_level : mir_opt_level,
1234- build_dep_graph : incremental_compilation || dump_dep_graph,
1235- dump_dep_graph : dump_dep_graph,
1242+ incremental : incremental,
12361243 no_analysis : no_analysis,
12371244 debugging_opts : debugging_opts,
12381245 prints : prints,
0 commit comments