Its not that hard: { let txn = Transaction::new() } In this case the compiler knows when it will be deconstructed. If note holds a reference to this beyond this scope then it is easily caught by the compiler. The ‘a parameter links the two references and can catch when one outlives the other.