Re:Rust lifetimes: Getting away with things that would be re...
by seabee on Saturday September 20, 2014 @06:48AM
(#8344225)
Using string_view in this example doesn't solve the use-after-free bug.
If you are concerned about memory safety, the only appropriate choices are to copy the string and have the string_view objects share ownership, or to use the primitive index range idea and punt the problem back to the programmer.
If you are concerned about memory safety, the only appropriate choices are to copy the string and have the string_view objects share ownership, or to use the primitive index range idea and punt the problem back to the programmer.