Our implementation requires a custom version of Rust that instructs Polonius to dump additional data. The version is available here: https://github.com/zgrannan/rust/tree/pcs
To setup the toolchain correctly, do the following in other directory (e.g. $HOME):
git clone -b pcs https://github.com/zgrannan/rust.git
cd rust
./x.py build --stage 2
- Confirm that the folder
build/PLATFORM/stage2
exists ( wherePLATFORM
is e.g.aarch64-apple-darwin
) rustup toolchain link NAME build/PLATFORM/stage2
, wherePLATFORM
is the platform above and NAME is some name you've decided- Modify the
rust-toolchain
file in this directory with the new name by settingchannel = "NAME"
At this point you can compile this crate by running cargo build
from this
directory. If cargo complains that the toolchain doesn't have THING installed,
then run ./x.py build --stage 2 THING
from the rust
directory and try again.
To run:
cargo run [FILENAME].rs
To view the visualization
PCS_VISUALIZATION=true cargo run [FILENAME.rs]
cd visualization && ./serve
- Go to http://localhost:8080 and select the function you wish to view
Once the server is running, you can keep it running and analyze other files
(e.g. cargo run [FILENAME2].rs
). Just refresh the page to see updated results.
To run on the top crates use:
cargo test --package pcs --test top_crates -- top_crates --exact --show-output