Polonius Overview 2019.02.19

Relevant links

  • Polonius blog posts:

  • Polonius and datafrog repositories:

Overview

  • Key concepts of Polonius
  • Possible rule variants and why they don’t work:
  • removing transitive subset rule
  • SSA-like renaming variants
  • Optimized rules, how they work
  • Integration with rustc

Context

Start with the program:

let mut x = 22;
let p: &u32 = &x;
x += 1;
drop(p);

Construct the MIR:

let vec: Vec<usize>;
let tmp0: &mut Vec<usize>;
let tmp1: usize;

vec.push(22)
// desugars to:
tmp0 = &mut vec;
tmp1 = 22;
Vec::push(tmp0, tmp1)

Region renumbering:

let vec: Vec<usize>;
let tmp0: &'a mut Vec<usize>;
let tmp1: usize;

vec.push(22)
// desugars to:
tmp0 = &'b mut vec;
tmp1 = 22;
Vec::push(tmp0, tmp1)

Go back to original example:

let mut x = 22;