@@ -165,6 +165,18 @@ pub enum LinkerPluginLto {
165165 Disabled ,
166166}
167167
168+ /// Used with `-Z assert-incr-state`.
169+ #[ derive( Clone , Copy , PartialEq , Hash , Debug ) ]
170+ pub enum IncrementalStateAssertion {
171+ /// Found and loaded an existing session directory.
172+ ///
173+ /// Note that this says nothing about whether any particular query
174+ /// will be found to be red or green.
175+ Loaded ,
176+ /// Did not load an existing session directory.
177+ NotLoaded ,
178+ }
179+
168180impl LinkerPluginLto {
169181 pub fn enabled ( & self ) -> bool {
170182 match * self {
@@ -704,6 +716,7 @@ pub fn host_triple() -> &'static str {
704716impl Default for Options {
705717 fn default ( ) -> Options {
706718 Options {
719+ assert_incr_state : None ,
707720 crate_types : Vec :: new ( ) ,
708721 optimize : OptLevel :: No ,
709722 debuginfo : DebugInfo :: None ,
@@ -1626,6 +1639,21 @@ fn select_debuginfo(
16261639 }
16271640}
16281641
1642+ crate fn parse_assert_incr_state (
1643+ opt_assertion : & Option < String > ,
1644+ error_format : ErrorOutputType ,
1645+ ) -> Option < IncrementalStateAssertion > {
1646+ match opt_assertion {
1647+ Some ( s) if s. as_str ( ) == "loaded" => Some ( IncrementalStateAssertion :: Loaded ) ,
1648+ Some ( s) if s. as_str ( ) == "not-loaded" => Some ( IncrementalStateAssertion :: NotLoaded ) ,
1649+ Some ( s) => early_error (
1650+ error_format,
1651+ & format ! ( "unexpected incremental state assertion value: {}" , s) ,
1652+ ) ,
1653+ None => None ,
1654+ }
1655+ }
1656+
16291657fn parse_native_lib_kind (
16301658 matches : & getopts:: Matches ,
16311659 kind : & str ,
@@ -2015,6 +2043,9 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
20152043
20162044 let incremental = cg. incremental . as_ref ( ) . map ( PathBuf :: from) ;
20172045
2046+ let assert_incr_state =
2047+ parse_assert_incr_state ( & debugging_opts. assert_incr_state , error_format) ;
2048+
20182049 if debugging_opts. profile && incremental. is_some ( ) {
20192050 early_error (
20202051 error_format,
@@ -2179,6 +2210,7 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
21792210 } ;
21802211
21812212 Options {
2213+ assert_incr_state,
21822214 crate_types,
21832215 optimize : opt_level,
21842216 debuginfo,
0 commit comments