Hmm, the examples given show local analysis, within a single function. Where this sort of analysis really shines is with global analysis where you can trace dataflow across functions, and even across abstract interfaces. I have only seen this previously with Java code in intellij. I assume this is not yet supported by flowistry, otherwise it would be loudly advertised?
Yes, Flowistry only supports single-function analysis right now. Interprocedural analysis is my next goal.
FWIW, part of the technical contribution of Flowistry is being able to analyze influence (or really effects / mutation) locally. With Rust, I can use the type of a function (as opposed to its definition) to soundly approximate what variables it will mutate, and how it affects what references point-to.
One of the authors (Vastraukas) was also an author on “ Using Lightweight Formal Methods to Validate a Key-Value Storage Node in Amazon S3” which seems relevant (Rust code base), but does not mention this tool. I wonder if there is any relation.
Nice. Dataflow analysis is really quite useful, this is making me think I should take a good look at Rust. I used to work in SPARK and I miss the analysis tools we had. The insights that flow analysis could give you in a tight loop was so useful.
This kind of analysis is not quite possible to perform with all languages. With some languages doing this kind of data flow analysis basically requires you to run the code and as soon as you perform IO you're out of luck.
This is right -- the analysis here uses aspects of Rust which don't exist in other languages. Specifically, transitive mutability markers (&T vs. &mut T) and lifetime-based alias-analysis.
There are many cases where such analysis quickly becomes exponentially expensive (e.g. nested loops or ifs) and/or requires analyzing whole program at once (to know whether anything anywhere might be holding a reference to the value you're checking), and there are patterns of code that are provably impossible to analyze (halting problem).
There are static analyzers that try their best getting this data, but with arbitrary references without clearly annotated lifetimes that can very often become a stack of "well, it depends" to the point the analysis has to give up.
Deduction of lifetimes in statically-typed languages without a borrow checker is very similar to deduction of types in dynamically-typed programs.