Tool for exploring lifetimes?

I find the Rustonomicon’s way of making lifetimes explicit, extremely helpful for learning them – for example:

Implicit lifetimes:

let x = 0;
let y = &x;
let z = &y;

Explicit lifetimes:

// NOTE: `'a: {` and `&'b x` is not valid syntax!
'a: {
    let x: i32 = 0;
    'b: {
        // lifetime used is 'b because that's good enough.
        let y: &'b i32 = &'b x;
        'c: {
            // ditto on 'c
            let z: &'c &'b i32 = &'c y; // "a reference to a reference to an i32" (with lifetimes annotated)
        }
    }
}

Is there a tool that does either of the following two things?

  • Convert the former representation to the latter
  • Check that the latter representation is consistent
1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.