Skip to content

Commit 8c9ee58

Browse files
authored
[Lean] Rename user-facing options from Aeneas to Lean (#3630)
This is a follow-up on #3514. As @celinval suggested ([here](#3514 (comment))), renaming all user-facing options from "Aeneas" to Lean. Inside the Kani compiler which is only concerned with producing LLBC (and doesn't know about Lean/Aeneas), I'm renaming the relevant feature from `aeneas` to `llbc`, and the backend is now called the LLBC backend as opposed to the Aeneas backend. Towards #3585 By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.
1 parent 68aec41 commit 8c9ee58

File tree

9 files changed

+33
-34
lines changed

9 files changed

+33
-34
lines changed

kani-compiler/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ tracing-tree = "0.4.0"
3131

3232
# Future proofing: enable backend dependencies using feature.
3333
[features]
34-
default = ['aeneas', 'cprover']
35-
aeneas = ['charon']
34+
default = ['cprover', 'llbc']
35+
llbc = ['charon']
3636
cprover = ['cbmc', 'num', 'serde']
3737
write_json_symtab = []
3838

kani-compiler/src/args.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ use tracing_subscriber::filter::Directive;
77
#[derive(Debug, Default, Display, Clone, Copy, AsRefStr, EnumString, VariantNames, PartialEq, Eq)]
88
#[strum(serialize_all = "snake_case")]
99
pub enum BackendOption {
10-
/// Aeneas (LLBC) backend
11-
#[cfg(feature = "aeneas")]
12-
Aeneas,
13-
1410
/// CProver (Goto) backend
1511
#[cfg(feature = "cprover")]
1612
#[strum(serialize = "cprover")]
1713
#[default]
1814
CProver,
15+
16+
/// LLBC backend (Aeneas's IR)
17+
#[cfg(feature = "llbc")]
18+
Llbc,
1919
}
2020

2121
#[derive(Debug, Default, Clone, Copy, AsRefStr, EnumString, VariantNames, PartialEq, Eq)]
@@ -87,7 +87,7 @@ pub struct Arguments {
8787
/// Option name used to select which backend to use.
8888
#[clap(long = "backend", default_value_t = BackendOption::CProver)]
8989
pub backend: BackendOption,
90-
/// Print the final LLBC file to stdout. This requires `-Zaeneas`.
90+
/// Print the final LLBC file to stdout.
9191
#[clap(long)]
9292
pub print_llbc: bool,
9393
}

kani-compiler/src/kani_compiler.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
//! `-C llvm-args`.
1717
1818
use crate::args::{Arguments, BackendOption};
19-
#[cfg(feature = "aeneas")]
19+
#[cfg(feature = "llbc")]
2020
use crate::codegen_aeneas_llbc::LlbcCodegenBackend;
2121
#[cfg(feature = "cprover")]
2222
use crate::codegen_cprover_gotoc::GotocCodegenBackend;
@@ -44,11 +44,11 @@ pub fn run(args: Vec<String>) -> ExitCode {
4444
}
4545
}
4646

47-
/// Configure the Aeneas backend that generates LLBC.
48-
fn aeneas_backend(_queries: Arc<Mutex<QueryDb>>) -> Box<dyn CodegenBackend> {
49-
#[cfg(feature = "aeneas")]
47+
/// Configure the LLBC backend (Aeneas's IR).
48+
fn llbc_backend(_queries: Arc<Mutex<QueryDb>>) -> Box<dyn CodegenBackend> {
49+
#[cfg(feature = "llbc")]
5050
return Box::new(LlbcCodegenBackend::new(_queries));
51-
#[cfg(not(feature = "aeneas"))]
51+
#[cfg(not(feature = "llbc"))]
5252
unreachable!()
5353
}
5454

@@ -60,21 +60,21 @@ fn cprover_backend(_queries: Arc<Mutex<QueryDb>>) -> Box<dyn CodegenBackend> {
6060
unreachable!()
6161
}
6262

63-
#[cfg(any(feature = "aeneas", feature = "cprover"))]
63+
#[cfg(any(feature = "cprover", feature = "llbc"))]
6464
fn backend(queries: Arc<Mutex<QueryDb>>) -> Box<dyn CodegenBackend> {
6565
let backend = queries.lock().unwrap().args().backend;
6666
match backend {
67-
#[cfg(feature = "aeneas")]
68-
BackendOption::Aeneas => aeneas_backend(queries),
6967
#[cfg(feature = "cprover")]
7068
BackendOption::CProver => cprover_backend(queries),
69+
#[cfg(feature = "llbc")]
70+
BackendOption::Llbc => llbc_backend(queries),
7171
}
7272
}
7373

7474
/// Fallback backend. It will trigger an error if no backend has been enabled.
75-
#[cfg(not(any(feature = "aeneas", feature = "cprover")))]
75+
#[cfg(not(any(feature = "cprover", feature = "llbc")))]
7676
fn backend(queries: Arc<Mutex<QueryDb>>) -> Box<CodegenBackend> {
77-
compile_error!("No backend is available. Use `aeneas` or `cprover`.");
77+
compile_error!("No backend is available. Use `cprover` or `llbc`.");
7878
}
7979

8080
/// This object controls the compiler behavior.

kani-compiler/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ extern crate stable_mir;
3838
extern crate tempfile;
3939

4040
mod args;
41-
#[cfg(feature = "aeneas")]
41+
#[cfg(feature = "llbc")]
4242
mod codegen_aeneas_llbc;
4343
#[cfg(feature = "cprover")]
4444
mod codegen_cprover_gotoc;

kani-driver/src/args/mod.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ pub struct VerificationArgs {
277277
#[arg(long, hide_short_help = true)]
278278
pub coverage: bool,
279279

280-
/// Print final LLBC for Aeneas backend. This requires the `-Z aeneas` option.
280+
/// Print final LLBC for Lean backend. This requires the `-Z lean` option.
281281
#[arg(long, hide = true)]
282282
pub print_llbc: bool,
283283

@@ -621,21 +621,20 @@ impl ValidateArgs for VerificationArgs {
621621
));
622622
}
623623

624-
if self.print_llbc && !self.common_args.unstable_features.contains(UnstableFeature::Aeneas)
625-
{
624+
if self.print_llbc && !self.common_args.unstable_features.contains(UnstableFeature::Lean) {
626625
return Err(Error::raw(
627626
ErrorKind::MissingRequiredArgument,
628-
"The `--print-llbc` argument is unstable and requires `-Z aeneas` to be used.",
627+
"The `--print-llbc` argument is unstable and requires `-Z lean` to be used.",
629628
));
630629
}
631630

632631
// TODO: error out for other CBMC-backend-specific arguments
633-
if self.common_args.unstable_features.contains(UnstableFeature::Aeneas)
632+
if self.common_args.unstable_features.contains(UnstableFeature::Lean)
634633
&& !self.cbmc_args.is_empty()
635634
{
636635
return Err(Error::raw(
637636
ErrorKind::ArgumentConflict,
638-
"The `--cbmc-args` argument cannot be used with -Z aeneas.",
637+
"The `--cbmc-args` argument cannot be used with -Z lean.",
639638
));
640639
}
641640
Ok(())
@@ -930,8 +929,8 @@ mod tests {
930929
}
931930

932931
#[test]
933-
fn check_cbmc_args_aeneas_backend() {
934-
let args = "kani input.rs -Z aeneas --enable-unstable --cbmc-args --object-bits 10"
932+
fn check_cbmc_args_lean_backend() {
933+
let args = "kani input.rs -Z lean --enable-unstable --cbmc-args --object-bits 10"
935934
.split_whitespace();
936935
let err = StandaloneArgs::try_parse_from(args).unwrap().validate().unwrap_err();
937936
assert_eq!(err.kind(), ErrorKind::ArgumentConflict);

kani-driver/src/call_single_file.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ impl KaniSession {
5353
) -> Result<()> {
5454
let mut kani_args = self.kani_compiler_flags();
5555
kani_args.push(format!("--reachability={}", self.reachability_mode()));
56-
if self.args.common_args.unstable_features.contains(UnstableFeature::Aeneas) {
57-
kani_args.push("--backend=aeneas".into());
56+
if self.args.common_args.unstable_features.contains(UnstableFeature::Lean) {
57+
kani_args.push("--backend=llbc".into());
5858
}
5959

6060
let lib_path = lib_folder().unwrap();
@@ -99,8 +99,8 @@ impl KaniSession {
9999
}
100100

101101
pub fn backend_arg(&self) -> Option<String> {
102-
if self.args.common_args.unstable_features.contains(UnstableFeature::Aeneas) {
103-
Some(to_rustc_arg(vec!["--backend=aeneas".into()]))
102+
if self.args.common_args.unstable_features.contains(UnstableFeature::Lean) {
103+
Some(to_rustc_arg(vec!["--backend=llbc".into()]))
104104
} else {
105105
None
106106
}

kani_metadata/src/unstable.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ pub enum UnstableFeature {
9090
/// Automatically check that no invalid value is produced which is considered UB in Rust.
9191
/// Note that this does not include checking uninitialized value.
9292
ValidValueChecks,
93-
/// Aeneas/LLBC
94-
Aeneas,
93+
/// Enabled Lean backend (Aeneas/LLBC)
94+
Lean,
9595
/// Ghost state and shadow memory APIs.
9696
GhostState,
9797
/// Automatically check that uninitialized memory is not used.

tests/expected/llbc/basic0/test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Copyright Kani Contributors
22
// SPDX-License-Identifier: Apache-2.0 OR MIT
3-
// kani-flags: -Zaeneas --print-llbc
3+
// kani-flags: -Zlean --print-llbc
44

55
//! This test checks that Kani's LLBC backend handles basic expressions, in this
66
//! case an equality between a variable and a constant

tests/expected/llbc/basic1/test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Copyright Kani Contributors
22
// SPDX-License-Identifier: Apache-2.0 OR MIT
3-
// kani-flags: -Zaeneas --print-llbc
3+
// kani-flags: -Zlean --print-llbc
44

55
//! This test checks that Kani's LLBC backend handles basic expressions, in this
66
//! case an if condition

0 commit comments

Comments
 (0)