flowistry 0.3.2

Static analysis for program comprehension
docs.rs failed to build flowistry-0.3.2
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build: flowistry-0.5.39

Flowistry: Powerful IDE Tools for Rust

ci

Flowistry is a VSCode extension that helps you understand Rust programs. Flowistry uses dataflow analysis and pointer analysis to analyze Rust programs at a deeper level than just types can offer (e.g. as you can find in rust-analyzer).

Flowistry is alpha software (see Limitations) and only works on code compiled with nightly. I'm seeking early adopters to try it out and provide feedback!

Flowistry's capabilities are:

Backward slicing

A backward slice identifies every piece of code that affects a value of interest. For example, let's say you're debugging an assertion failure on x. Then you could compute the backward slice of x to rule out lines of code that don't influence its value, as shown here:

demo1

Forward slicing

A forward slice identifiers every piece of code that is affected by a value of interest. For example, let's say you have a program that times a calculation, and you want to comment out all the code related to timing. You could compute a forward slice of the timer:

demo2

Function effects

A function's effects are either inputs that it mutates, or values that it returns. The function effects panel helps identify lines of code that either mutate arguments or return values. Selecting an effect then shows the backward slice of that effect.

demo mp4

Installation

You can install Flowistry from the Visual Studio Marketplace.

  • Go to the Extensions pane by clicking this button in the left margin:
  • Search for "Flowistry" and then click "Install".
  • Open a Rust workspace and wait for the tool to finish installing.

Alternatively, you can install it from source:

# Install flowistry binaries
rustup toolchain install nightly -c rust-src,rustc-dev,llvm-tools-preview
git clone https://github.com/willcrichton/flowistry
cd flowistry
cargo +nightly install --path .

# Install vscode extension
cd ide
npm run install
npm run build
ln -s $(pwd) ~/.vscode/extensions/flowistry

Usage

Flowistry has four commands:

  • Flowistry: Backward Highlight: given a selected variable, this command highlights the backward slice of the variable.
  • Flowistry: Backward Select: same as above, but this puts the slice in your selection rather than highlighting it.
  • Flowistry: Forward Highlight and Flowistry: Forward Select: same as above, but for forward slices than backward slices.
  • Flowistry: Effects: given your cursor is within a particular function, this command opens the effects panel for that function.

You can invoke these commands either through the context menu, by right-clicking and opening the "Flowistry" sub-menu. Or you can open the Command Palette (⇧⌘P on Mac) and type the name of the command.

Limitations

Flowistry is early-stage software. It inevitably has bugs in both the UI and the analysis. The UI may be unintuitive. The analysis, even if correct, may also be unintuitive. Additionally, Flowistry only works on code compiled with the nightly Rust compiler.