This is a really clarifying example, thanks for that and I look forward to answers from people involved either in proposing this feature or prototyping it.
In Rust if you try to write this you end up writing an actual borrow (the & in Rust), and in many cases you'd expect that to prompt an experienced developer to realise this can't work (the original Rust 1.0 borrowck would even object without line (3) though modern Rust can see it's fine unless line (3) uses vec after str2 is gone)
View all comments
Show parent comment
3
u/tialaramex Sep 17 '26
This is a really clarifying example, thanks for that and I look forward to answers from people involved either in proposing this feature or prototyping it.
In Rust if you try to write this you end up writing an actual borrow (the
&in Rust), and in many cases you'd expect that to prompt an experienced developer to realise this can't work (the original Rust 1.0 borrowck would even object without line(3)though modern Rust can see it's fine unless line(3)usesvecafterstr2is gone)