Skip to content
Snippets Groups Projects
README.md 472 B
Newer Older
# Rust Snippets

This is the Rust snippet heap. All the Rust code I actually have to have in `.rs` files is found here.

## Creating MIR control-flow graphs

We create a CFG by running `rustc` on a file with some options to emit a `.dot` file instead of a compiled binary:

```bash
rustc --emit mir -Z dump-mir=F -Z dump-mir-dataflow -Z unpretty=mir-cfg path/to/file.rs > mir.dot
```

We can then convert it to SVG if we want to:

```bash
dot -T svg -o mir.svg mir.dot
```