@@ -14,7 +14,7 @@ use std::process;
14
14
use std:: str:: FromStr ;
15
15
16
16
use chrono:: { Date , Duration , NaiveDate , Utc } ;
17
- use clap:: { ArgAction , Parser , ValueEnum , builder :: PossibleValue } ;
17
+ use clap:: { ArgAction , Parser , ValueEnum } ;
18
18
use colored:: Colorize ;
19
19
use anyhow:: { bail, Context } ;
20
20
use log:: debug;
@@ -86,7 +86,7 @@ struct Opts {
86
86
long,
87
87
help = "Custom regression definition" ,
88
88
value_enum,
89
- default_value_t = RegressOn :: ErrorStatus ,
89
+ default_value_t = RegressOn :: Error ,
90
90
) ]
91
91
regress : RegressOn ,
92
92
@@ -272,19 +272,18 @@ impl Config {
272
272
273
273
let input = ( self . args . regress , status. success ( ) ) ;
274
274
let result = match input {
275
- ( RegressOn :: ErrorStatus , true ) | ( RegressOn :: SuccessStatus , false ) => {
276
- TestOutcome :: Baseline
275
+ ( RegressOn :: Error , true ) | ( RegressOn :: Success , false ) => TestOutcome :: Baseline ,
276
+ ( RegressOn :: Error , false ) | ( RegressOn :: Success | RegressOn :: NonError , true ) => {
277
+ TestOutcome :: Regressed
277
278
}
278
- ( RegressOn :: ErrorStatus , false )
279
- | ( RegressOn :: SuccessStatus | RegressOn :: NonCleanError , true ) => TestOutcome :: Regressed ,
280
- ( RegressOn :: IceAlone , _) | ( RegressOn :: NonCleanError , false ) => {
279
+ ( RegressOn :: Ice , _) | ( RegressOn :: NonError , false ) => {
281
280
if saw_ice {
282
281
TestOutcome :: Regressed
283
282
} else {
284
283
TestOutcome :: Baseline
285
284
}
286
285
}
287
- ( RegressOn :: NotIce , _) => {
286
+ ( RegressOn :: NonIce , _) => {
288
287
if saw_ice {
289
288
TestOutcome :: Baseline
290
289
} else {
@@ -315,87 +314,52 @@ impl Access {
315
314
}
316
315
}
317
316
318
- #[ derive( Copy , Clone , PartialEq , Eq , Debug ) ]
317
+ #[ derive( Copy , Clone , PartialEq , Eq , Debug , ValueEnum ) ]
319
318
/// Customize what is treated as regression.
320
319
enum RegressOn {
321
- /// `ErrorStatus`: Marks test outcome as `Regressed` if and only if
322
- /// the `rustc` process reports a non-success status. This corresponds to
323
- /// when `rustc` has an internal compiler error (ICE) or when it detects an
324
- /// error in the input program.
325
- ///
320
+ /// Marks test outcome as `Regressed` if and only if the `rustc`
321
+ /// process reports a non-success status. This corresponds to when `rustc`
322
+ /// has an internal compiler error (ICE) or when it detects an error in the
323
+ /// input program.
326
324
/// This covers the most common use case for `cargo-bisect-rustc` and is
327
325
/// thus the default setting.
328
- ///
329
- /// You explicitly opt into this seting via `--regress=error`.
330
- ErrorStatus ,
331
-
332
- /// `SuccessStatus`: Marks test outcome as `Regressed` if and only
333
- /// if the `rustc` process reports a success status. This corresponds to
334
- /// when `rustc` believes it has successfully compiled the program. This
335
- /// covers the use case for when you want to bisect to see when a bug was
336
- /// fixed.
337
- ///
338
- /// You explicitly opt into this seting via `--regress=success`.
339
- SuccessStatus ,
340
-
341
- /// `IceAlone`: Marks test outcome as `Regressed` if and only if
342
- /// the `rustc` process issues a diagnostic indicating that an internal
326
+ Error ,
327
+
328
+ /// Marks test outcome as `Regressed` if and only if the `rustc`
329
+ /// process reports a success status. This corresponds to when `rustc`
330
+ /// believes it has successfully compiled the program. This covers the use
331
+ /// case for when you want to bisect to see when a bug was fixed.
332
+ Success ,
333
+
334
+ /// `Ice`: Marks test outcome as `Regressed` if and only if the `rustc`
335
+ /// process issues a diagnostic indicating that an internal compiler error
336
+ /// (ICE) occurred. This covers the use case for when you want to bisect to
337
+ /// see when an ICE was introduced pon a codebase that is meant to produce
338
+ /// a clean error.
339
+ Ice ,
340
+
341
+ /// `NonIce`: Marks test outcome as `Regressed` if and only if the `rustc`
342
+ /// process does not issue a diagnostic indicating that an internal
343
343
/// compiler error (ICE) occurred. This covers the use case for when you
344
- /// want to bisect to see when an ICE was introduced pon a codebase that is
345
- /// meant to produce a clean error.
346
- ///
347
- /// You explicitly opt into this seting via `--regress=ice`.
348
- IceAlone ,
349
-
350
- /// `NotIce`: Marks test outcome as `Regressed` if and only if
351
- /// the `rustc` process does not issue a diagnostic indicating that an
352
- /// internal compiler error (ICE) occurred. This covers the use case for
353
- /// when you want to bisect to see when an ICE was fixed.
354
- ///
355
- /// You explicitly opt into this setting via `--regress=non-ice`
356
- NotIce ,
357
-
358
- /// `NonCleanError`: Marks test outcome as `Baseline` if and only
359
- /// if the `rustc` process reports error status and does not issue any
360
- /// diagnostic indicating that an internal compiler error (ICE) occurred.
361
- /// This is the use case if the regression is a case where an ill-formed
362
- /// program has stopped being properly rejected by the compiler.
363
- ///
364
- /// (The main difference between this case and `SuccessStatus` is
365
- /// the handling of ICE: `SuccessStatus` assumes that ICE should be
366
- /// considered baseline; `NonCleanError` assumes ICE should be
367
- /// considered a sign of a regression.)
368
- ///
369
- /// You explicitly opt into this seting via `--regress=non-error`.
370
- NonCleanError ,
371
- }
372
-
373
- impl ValueEnum for RegressOn {
374
- fn value_variants < ' a > ( ) -> & ' a [ Self ] {
375
- & [
376
- Self :: ErrorStatus ,
377
- Self :: SuccessStatus ,
378
- Self :: IceAlone ,
379
- Self :: NotIce ,
380
- Self :: NonCleanError ,
381
- ]
382
- }
383
- fn to_possible_value ( & self ) -> Option < PossibleValue > {
384
- Some ( PossibleValue :: new ( match self {
385
- Self :: ErrorStatus => "error" ,
386
- Self :: NonCleanError => "non-error" ,
387
- Self :: IceAlone => "ice" ,
388
- Self :: NotIce => "non-ice" ,
389
- Self :: SuccessStatus => "success" ,
390
- } ) )
391
- }
344
+ /// want to bisect to see when an ICE was fixed.
345
+ NonIce ,
346
+
347
+ /// `NonError`: Marks test outcome as `Baseline` if and only if the `rustc`
348
+ /// process reports error status and does not issue any diagnostic
349
+ /// indicating that an internal compiler error (ICE) occurred. This is the
350
+ /// use case if the regression is a case where an ill-formed program has
351
+ /// stopped being properly rejected by the compiler.
352
+ /// (The main difference between this case and `Success` is the handling of
353
+ /// ICE: `Success` assumes that ICE should be considered baseline;
354
+ /// `NonError` assumes ICE should be considered a sign of a regression.)
355
+ NonError ,
392
356
}
393
357
394
358
impl RegressOn {
395
359
fn must_process_stderr ( self ) -> bool {
396
360
match self {
397
- RegressOn :: ErrorStatus | RegressOn :: SuccessStatus => false ,
398
- RegressOn :: NonCleanError | RegressOn :: IceAlone | RegressOn :: NotIce => true ,
361
+ RegressOn :: Error | RegressOn :: Success => false ,
362
+ RegressOn :: NonError | RegressOn :: Ice | RegressOn :: NonIce => true ,
399
363
}
400
364
}
401
365
}
0 commit comments