@@ -165,6 +165,18 @@ pub enum LinkerPluginLto {
165
165
Disabled ,
166
166
}
167
167
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
+
168
180
impl LinkerPluginLto {
169
181
pub fn enabled ( & self ) -> bool {
170
182
match * self {
@@ -704,6 +716,7 @@ pub fn host_triple() -> &'static str {
704
716
impl Default for Options {
705
717
fn default ( ) -> Options {
706
718
Options {
719
+ assert_incr_state : None ,
707
720
crate_types : Vec :: new ( ) ,
708
721
optimize : OptLevel :: No ,
709
722
debuginfo : DebugInfo :: None ,
@@ -1626,6 +1639,21 @@ fn select_debuginfo(
1626
1639
}
1627
1640
}
1628
1641
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
+
1629
1657
fn parse_native_lib_kind (
1630
1658
matches : & getopts:: Matches ,
1631
1659
kind : & str ,
@@ -2015,6 +2043,9 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
2015
2043
2016
2044
let incremental = cg. incremental . as_ref ( ) . map ( PathBuf :: from) ;
2017
2045
2046
+ let assert_incr_state =
2047
+ parse_assert_incr_state ( & debugging_opts. assert_incr_state , error_format) ;
2048
+
2018
2049
if debugging_opts. profile && incremental. is_some ( ) {
2019
2050
early_error (
2020
2051
error_format,
@@ -2179,6 +2210,7 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
2179
2210
} ;
2180
2211
2181
2212
Options {
2213
+ assert_incr_state,
2182
2214
crate_types,
2183
2215
optimize : opt_level,
2184
2216
debuginfo,
0 commit comments