Skip to content

Commit bffcd3f

Browse files
Carolyn Zechtautschnig
andauthored
[Breaking Changes] Remove unstable list feature and default memory checks (#4258)
Follow up to #4108 - Removes the positive default memory check options (the ones not prefixed with `--no`) - Removes the unstable list option - Also stops warning about `--unstable-options` for jobs The rationale being that #4108 was in v0.63, so v0.66 should have been enough time for affected users to make changes. Resolves #2247 Towards #4026 By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses. --------- Co-authored-by: Michael Tautschnig <mt@debian.org>
1 parent 22139f0 commit bffcd3f

File tree

2 files changed

+30
-53
lines changed

2 files changed

+30
-53
lines changed

kani-driver/src/args/mod.rs

Lines changed: 19 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -416,12 +416,26 @@ impl VerificationArgs {
416416
}
417417
}
418418

419-
/// Given an argument, warn if UnstableFeature::UnstableOptions is enabled.
419+
/// Given the string representation of an option, warn if it's enabled while
420+
/// UnstableFeature::UnstableOptions is also enabled.
420421
/// This is for cases where the option was previously unstable but has since been stabilized.
422+
/// Example invocation: self.check_unnecessary_unstable_option(self.jobs.is_some(), "jobs");
423+
#[allow(dead_code)]
421424
pub fn check_unnecessary_unstable_option(&self, enabled: bool, option: &str) {
425+
// Note that the body of this function is subject to change; an option
426+
// will only be here if it has been stabilized *recently*, such that we should still warn about unstable-options.
427+
// So a body of just `None` is fine, since that just means that no unstable options are currently in that in-between period.
428+
// Example of an appropriate body:
429+
// ```rust
430+
// match option {
431+
// "jobs" => Some("0.63.0".to_string()),
432+
// _ => None,
433+
// }
434+
// ```
435+
// for the unstable jobs option, which was stabilized in version 0.63.
436+
#[allow(clippy::match_single_binding)]
422437
fn stabilization_version(option: &str) -> Option<String> {
423438
match option {
424-
"jobs" => Some("0.63.0".to_string()),
425439
_ => None,
426440
}
427441
}
@@ -473,81 +487,39 @@ pub enum OutputFormat {
473487
#[derive(Debug, clap::Args)]
474488
#[clap(next_help_heading = "Memory Checks")]
475489
pub struct CheckArgs {
476-
// Rust argument parsers (/clap) don't have the convenient '--flag' and '--no-flag' boolean pairs, so approximate
477-
// We're put both here then create helper functions to "intepret"
478-
/// Turn on all default checks
479-
#[arg(long, hide = true)]
480-
pub default_checks: bool,
481490
/// Turn off all default checks
482491
#[arg(long)]
483492
pub no_default_checks: bool,
484493

485-
/// Turn on default memory safety checks
486-
#[arg(long, hide = true)]
487-
pub memory_safety_checks: bool,
488494
/// Turn off default memory safety checks
489495
#[arg(long)]
490496
pub no_memory_safety_checks: bool,
491497

492-
/// Turn on default overflow checks
493-
#[arg(long, hide = true)]
494-
pub overflow_checks: bool,
495498
/// Turn off default overflow checks
496499
#[arg(long)]
497500
pub no_overflow_checks: bool,
498501

499-
/// Turn on undefined function checks
500-
#[arg(long, hide = true)]
501-
pub undefined_function_checks: bool,
502502
/// Turn off undefined function checks
503503
#[arg(long)]
504504
pub no_undefined_function_checks: bool,
505505

506-
/// Turn on default unwinding checks
507-
#[arg(long, hide = true)]
508-
pub unwinding_checks: bool,
509506
/// Turn off default unwinding checks
510507
#[arg(long)]
511508
pub no_unwinding_checks: bool,
512509
}
513510

514511
impl CheckArgs {
515512
pub fn memory_safety_on(&self) -> bool {
516-
!self.no_default_checks && !self.no_memory_safety_checks || self.memory_safety_checks
513+
!self.no_default_checks && !self.no_memory_safety_checks
517514
}
518515
pub fn overflow_on(&self) -> bool {
519-
!self.no_default_checks && !self.no_overflow_checks || self.overflow_checks
516+
!self.no_default_checks && !self.no_overflow_checks
520517
}
521518
pub fn undefined_function_on(&self) -> bool {
522519
!self.no_default_checks && !self.no_undefined_function_checks
523-
|| self.undefined_function_checks
524520
}
525521
pub fn unwinding_on(&self) -> bool {
526-
!self.no_default_checks && !self.no_unwinding_checks || self.unwinding_checks
527-
}
528-
pub fn print_deprecated(&self, verbosity: &CommonArgs) {
529-
let deprecation_version = "0.63.0";
530-
let alternative = "omitting the argument, since this is already the default behavior";
531-
if self.default_checks {
532-
print_deprecated(verbosity, "--default-checks", deprecation_version, alternative);
533-
}
534-
if self.memory_safety_checks {
535-
print_deprecated(verbosity, "--memory-safety-checks", deprecation_version, alternative);
536-
}
537-
if self.overflow_checks {
538-
print_deprecated(verbosity, "--overflow-checks", deprecation_version, alternative);
539-
}
540-
if self.undefined_function_checks {
541-
print_deprecated(
542-
verbosity,
543-
"--undefined-function-checks",
544-
deprecation_version,
545-
alternative,
546-
);
547-
}
548-
if self.unwinding_checks {
549-
print_deprecated(verbosity, "--unwinding-checks", deprecation_version, alternative);
550-
}
522+
!self.no_default_checks && !self.no_unwinding_checks
551523
}
552524
}
553525

@@ -807,9 +779,6 @@ impl ValidateArgs for VerificationArgs {
807779

808780
// Check for any deprecated/obsolete options, or providing an unstable flag that has since been stabilized.
809781
let deprecated_stabilized_obsolete = || -> Result<(), Error> {
810-
self.checks.print_deprecated(&self.common_args);
811-
self.check_unnecessary_unstable_option(self.jobs.is_some(), "jobs");
812-
813782
if self.write_json_symtab {
814783
return Err(Error::raw(
815784
ErrorKind::ValueValidation,

kani_metadata/src/unstable.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,6 @@ pub enum UnstableFeature {
8585
GhostState,
8686
/// Enabled Lean backend (Aeneas/LLBC)
8787
Lean,
88-
/// The list subcommand [RFC 13](https://model-checking.github.io/kani/rfc/rfcs/0013-list.html)
89-
List,
9088
/// Enable loop contracts [RFC 12](https://model-checking.github.io/kani/rfc/rfcs/0012-loop-contracts.html)
9189
LoopContracts,
9290
/// Memory predicate APIs.
@@ -125,9 +123,19 @@ impl UnstableFeature {
125123

126124
/// If this unstable feature has been stabilized, return the version it was stabilized in.
127125
/// Use this function to produce warnings that the unstable flag is no longer necessary.
126+
/// Note that the body of this function is subject to change; a feature will only be here if it has been deprecated, but not yet removed.
127+
/// So a body of just `None` is fine, since that just means that no unstable features are currently in that in-between period.
128+
/// Example of an appropriate body:
129+
/// ```ignore
130+
/// match self {
131+
/// UnstableFeature::List => Some("0.63.0".to_string()),
132+
/// _ => None,
133+
/// }
134+
/// ```
135+
/// for the unstable list feature, which was stabilized in version 0.63 and removed permanently in v0.66.
136+
#[allow(clippy::match_single_binding)]
128137
pub fn stabilization_version(&self) -> Option<String> {
129138
match self {
130-
UnstableFeature::List => Some("0.63.0".to_string()),
131139
_ => None,
132140
}
133141
}

0 commit comments

Comments
 (0)