Found a bunch of problems within the MIR test suite
Key question: given a function that takes a reference it doesn’t use
fnfoo(x: &u32) { }
Does this have any effect on things it doesn’t use?
Validity based: yes
Accessed based: no
This effects the sorts of optimizations you can do
However, validity in Rust is somewhat temporal. References stop being valid when their lifetime ends. Therefore, validity models tend to give significance to the point where a borrow ends, which is undesirable.
Goal: Model doesn’t care about lifetimes
Rough details:
at beginning of fn, you go over all your arguments and check that they are valid
a reference must point to allocated, valid memory
mutable references cannot overlap with other things
no“type-based alias analysis”, so &f32 and &i32 could overlap etc
Agenda
Ralf’s model
fn foo(x: &u32) { }
Access vs Validity