Skip to content

Commit f51a097

Browse files
authored
Fix LLBC regressions (#4338)
Since the upgrade to the 2025-07-04 toolchain, which removed the `let_chains` unstable feature, the LLBC regressions have been broken. This was caused by the removal of the `let_chains` feature (which is used in the Charon submodule) and requiring the 2024 edition to use let chains. The edition used in Charon was upgraded to 2024 since AeneasVerif/charon@59b8ad6, but the attempt to update Kani to use that commit ran into AeneasVerif/charon#806. So, in the meantime, apply a minimal patch to the Charon code after cloning it to allow it to build. 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 79763ce commit f51a097

File tree

3 files changed

+35
-1
lines changed

3 files changed

+35
-1
lines changed

.github/workflows/kani.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,13 @@ jobs:
108108
with:
109109
os: ubuntu-24.04
110110

111+
# Patch Charon so that it compiles. This is temporary until we're able to
112+
# upgrade the pinned commit which requires fixing
113+
# https://github.com/AeneasVerif/charon/issues/806 and updating the
114+
# mir-to-ullbc code
115+
- name: Patch Charon
116+
run: cd charon && git apply ../scripts/charon-patch.diff
117+
111118
- name: Build Kani with Charon
112119
run: cargo build-dev -- --features cprover --features llbc
113120

kani-compiler/src/codegen_aeneas_llbc/mir_to_ullbc/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ use rustc_public::ty::{
6969
Ty, TyConst, TyConstKind, TyKind, UintTy,
7070
};
7171
use rustc_public::{CrateDef, CrateDefType, DefId};
72+
use rustc_public_bridge::IndexedVal;
7273
use std::collections::HashMap;
7374
use std::iter::zip;
7475
use std::path::PathBuf;
@@ -1009,7 +1010,7 @@ impl<'a, 'tcx> Context<'a, 'tcx> {
10091010
name.push(CharonPathElem::Ident(crate_name, CharonDisambiguator::new(0)));
10101011
}
10111012

1012-
if let Some(impl_defid_internal) = self.tcx.impl_of_method(def_id) {
1013+
if let Some(impl_defid_internal) = self.tcx.impl_of_assoc(def_id) {
10131014
let traitref = self
10141015
.tcx
10151016
.impl_trait_ref(impl_defid_internal)

scripts/charon-patch.diff

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
diff --git a/charon/Cargo.toml b/charon/Cargo.toml
2+
index 20f8a9df..a1bf1ee6 100644
3+
--- a/charon/Cargo.toml
4+
+++ b/charon/Cargo.toml
5+
@@ -2,7 +2,7 @@
6+
name = "charon"
7+
version = "0.1.62"
8+
authors = ["Son Ho <hosonmarc@gmail.com>"]
9+
-edition = "2021"
10+
+edition = "2024"
11+
license = "Apache-2.0"
12+
13+
[lib]
14+
diff --git a/charon/src/ids/vector.rs b/charon/src/ids/vector.rs
15+
index 59f7eaab..21508e19 100644
16+
--- a/charon/src/ids/vector.rs
17+
+++ b/charon/src/ids/vector.rs
18+
@@ -217,7 +217,7 @@ where
19+
self.iter_indexed().map(|(id, _)| id)
20+
}
21+
22+
- pub fn all_indices(&self) -> impl Iterator<Item = I> {
23+
+ pub fn all_indices(&self) -> impl Iterator<Item = I> + use<I, T> {
24+
self.vector.indices()
25+
}
26+

0 commit comments

Comments
 (0)