4 ms·
I believe you can actually name the lifetime of a block, via the same mechanism that makes labeled breaks and continues possible.
by webkike 8y ago
I believe you can actually name the lifetime of a block, via the same mechanism that makes labeled breaks and continues possible.
- bluejekyll 8y agoDo you have an example of what you mean?
- coolreader18 8y agoLike this: 'a: { let a_var: u32 = 42; let a_ref: &'a u32 = &a_var; } // ^^^^^ only valid in 'a: {}
- gpm 8y agoThat doesn't compile with "use of undeclared lifetime name `'a`"
- steveklabnik 8y agoYou can name loop labels like this, but you cannot use them to introduce actual lifetimes, that’s right.
- Retra 8y agoI think that was just a proposal that never got accepted? Never see it in real code either way.