indexing 0.4.1

Sound unchecked indexing using “generativity”; a type system approach to indices, pointers and ranges that are trusted to be in bounds.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
extern crate indexing;

use indexing::scope;

fn main() {
    let arr1 = [1, 2, 3, 4, 5];

    // The .first() ptr is not dereferenceable when we don't have a length proof
    let _a = scope(&arr1[..], |arr| {
        let r = arr.pointer_range();
        println!("{}", &arr[r.first()]); //~ ERROR cannot be indexed by
    });
}