Skip to content

Commit d5e51bb

Browse files
committed
fix: sort proofs by file path and fn source code as callees do
close #23
1 parent f622349 commit d5e51bb

File tree

5 files changed

+475
-538
lines changed

5 files changed

+475
-538
lines changed

src/functions/mod.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,13 @@ pub fn analyze(tcx: TyCtxt, src_map: &SourceMap) -> Vec<SerFunction> {
3131
let (mono_items, callgraph) = collect_reachable_items(tcx, &entries);
3232

3333
// Filter out non kanitool functions.
34-
mono_items
34+
let mut proofs: Vec<_> = mono_items
3535
.iter()
36-
.filter_map(|item| Function::new(item, &callgraph, tcx, src_map, |x| !x.attrs.is_empty()))
37-
.map(|fun| SerFunction::new(fun, tcx, src_map))
38-
.collect()
36+
.filter_map(|f| Function::new(f, &callgraph, tcx, src_map, |x| !x.attrs.is_empty()))
37+
.collect();
38+
// Sort proofs by file path and source code.
39+
proofs.sort_by(|a, b| (&*a.file, &*a.func).cmp(&(&*b.file, &*b.func)));
40+
proofs.into_iter().map(|fun| SerFunction::new(fun, tcx, src_map)).collect()
3941
}
4042

4143
/// A Rust funtion with its file source, attributes, and raw function content.

tests/snapshots/contract1.json

Lines changed: 73 additions & 88 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)