Skip to content

Commit d0a4d9b

Browse files
authored
Address missed comments from rust-lang#2088 (rust-lang#2200)
1 parent 4dfff36 commit d0a4d9b

File tree

12 files changed

+33
-33
lines changed

12 files changed

+33
-33
lines changed

kani-compiler/src/codegen_cprover_gotoc/codegen/function.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ impl<'tcx> GotocCtx<'tcx> {
469469
let invalid_arg_err = |attr: &Attribute| {
470470
self.tcx.sess.span_err(
471471
attr.span,
472-
format!("invalid argument for `{ATTRIBUTE}` attribute, expected one of the supported solvers (e.g. `kissat`) or a SAT solver binary (e.g. `custom=\"<SAT_SOLVER_BINARY>\"`)")
472+
format!("invalid argument for `{ATTRIBUTE}` attribute, expected one of the supported solvers (e.g. `kissat`) or a SAT solver binary (e.g. `bin=\"<SAT_SOLVER_BINARY>\"`)")
473473
)
474474
};
475475

@@ -504,8 +504,8 @@ impl<'tcx> GotocCtx<'tcx> {
504504
}
505505
}
506506
}
507-
MetaItemKind::NameValue(lit) if ident_str == "custom" && lit.kind.is_str() => {
508-
Some(CbmcSolver::Custom(lit.token_lit.symbol.to_string()))
507+
MetaItemKind::NameValue(lit) if ident_str == "bin" && lit.kind.is_str() => {
508+
Some(CbmcSolver::Binary(lit.token_lit.symbol.to_string()))
509509
}
510510
_ => {
511511
invalid_arg_err(attr);

kani-driver/src/args.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -579,18 +579,18 @@ impl TypedValueParser for CbmcSolverValueParser {
579579
value: &std::ffi::OsStr,
580580
) -> Result<Self::Value, clap::error::Error> {
581581
let value = value.to_str().unwrap();
582-
// `value` is one of the possible `CbmcSolver` values or `custom=<binary>`
582+
// `value` is one of the possible `CbmcSolver` values or `bin=<binary>`
583583
let segments: Vec<&str> = value.split('=').collect();
584584

585585
let mut err = clap::Error::new(ErrorKind::InvalidValue).with_cmd(cmd);
586586
err.insert(ContextKind::InvalidArg, ContextValue::String(arg.unwrap().to_string()));
587587
err.insert(ContextKind::InvalidValue, ContextValue::String(value.to_string()));
588588

589589
if segments.len() == 2 {
590-
if segments[0] != "custom" {
590+
if segments[0] != "bin" {
591591
return Err(err);
592592
}
593-
return Ok(CbmcSolver::Custom(segments[1].into()));
593+
return Ok(CbmcSolver::Binary(segments[1].into()));
594594
} else if segments.len() == 1 {
595595
let solver = CbmcSolver::from_str(value);
596596
return solver.map_err(|_| err);

kani-driver/src/call_cbmc.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -213,13 +213,13 @@ impl KaniSession {
213213
// Minisat is currently CBMC's default solver, so no need to
214214
// pass any arguments
215215
}
216-
CbmcSolver::Custom(custom_solver) => {
216+
CbmcSolver::Binary(solver_binary) => {
217217
// Check if the specified binary exists in path
218-
if which::which(custom_solver).is_err() {
219-
bail!("the specified solver \"{custom_solver}\" was not found in path")
218+
if which::which(solver_binary).is_err() {
219+
bail!("the specified solver \"{solver_binary}\" was not found in path")
220220
}
221221
args.push("--external-sat-solver".into());
222-
args.push(custom_solver.into());
222+
args.push(solver_binary.into());
223223
}
224224
}
225225
Ok(())

kani_metadata/src/cbmc_solver.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use serde::{Deserialize, Serialize};
55
use strum_macros::{AsRefStr, EnumString, EnumVariantNames};
66

77
/// An enum for CBMC solver options. All variants are handled by Kani, except for
8-
/// the `Custom` one, which it passes as is to CBMC's `--external-sat-solver`
8+
/// the `Binary` one, which it passes as is to CBMC's `--external-sat-solver`
99
/// option.
1010
#[derive(
1111
Debug,
@@ -26,8 +26,8 @@ pub enum CbmcSolver {
2626
/// MiniSAT (CBMC's default solver)
2727
Minisat,
2828

29-
/// A custom solver variant whose argument gets passed to
29+
/// A solver binary variant whose argument gets passed to
3030
/// `--external-sat-solver`. The specified binary must exist in path.
31-
#[strum(disabled, serialize = "custom=<SAT_SOLVER_BINARY>")]
32-
Custom(String),
31+
#[strum(disabled, serialize = "bin=<SAT_SOLVER_BINARY>")]
32+
Binary(String),
3333
}
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
error: invalid argument for `#[kani::solver]` attribute, expected one of the supported solvers (e.g. `kissat`) or a SAT solver binary (e.g. `custom="<SAT_SOLVER_BINARY>"`)\
1+
error: invalid argument for `#[kani::solver]` attribute, expected one of the supported solvers (e.g. `kissat`) or a SAT solver binary (e.g. `bin="<SAT_SOLVER_BINARY>"`)\
22
test.rs:\
3-
|\
4-
5 | #[kani::solver(123)]\
5-
| ^^^^^^^^^^^^^^^^^^^^
3+
|\
4+
| #[kani::solver(123)]\
5+
| ^^^^^^^^^^^^^^^^^^^^
66
error: aborting due to previous error
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
error: the `#[kani::solver]` attribute expects a single argument. Got 2 arguments.\
22
test.rs:\
3-
|\
4-
5 | #[kani::solver(kissat, minisat)]\
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3+
|\
4+
| #[kani::solver(kissat, minisat)]\
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66
error: aborting due to previous error
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
error: only one '#[kani::solver]' attribute is allowed per harness\
22
test.rs:\
3-
|\
4-
5 | #[kani::solver(kissat)]\
5-
| ^^^^^^^^^^^^^^^^^^^^^^^
3+
|\
4+
| #[kani::solver(kissat)]\
5+
| ^^^^^^^^^^^^^^^^^^^^^^^
66
error: aborting due to previous error
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
error: the `#[kani::solver]` attribute expects a single argument. Got 0 arguments.\
22
test.rs:\
3-
|\
4-
5 | #[kani::solver]\
5-
| ^^^^^^^^^^^^^^^
3+
|\
4+
| #[kani::solver]\
5+
| ^^^^^^^^^^^^^^^
66
error: aborting due to previous error

tests/ui/solver-attribute/not-found/test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
//! Checks that Kani errors out if specified solver binary is not found
55
66
#[kani::proof]
7-
#[kani::solver(custom = "non_existing_solver")]
7+
#[kani::solver(bin = "non_existing_solver")]
88
fn check() {}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
error: unknown solver `foo`\
22
test.rs:\
3-
|\
4-
5 | #[kani::solver(foo)]\
5-
| ^^^^^^^^^^^^^^^^^^^^
3+
|\
4+
| #[kani::solver(foo)]\
5+
| ^^^^^^^^^^^^^^^^^^^^
66
error: aborting due to previous error

tests/ui/solver-option/custom/test.rs renamed to tests/ui/solver-option/bin/test.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// Copyright Kani Contributors
22
// SPDX-License-Identifier: Apache-2.0 OR MIT
3-
// kani-flags: --solver custom=kissat
3+
// kani-flags: --solver bin=kissat
44

5-
//! Checks that `--solver` accepts `custom=<binary>`
5+
//! Checks that `--solver` accepts `bin=<binary>`
66
77
#[kani::proof]
88
fn check_solver_option() {

0 commit comments

Comments
 (0)