Rust in the 6.2 kernel
Rust in the 6.2 kernel
Posted Nov 18, 2022 17:05 UTC (Fri) by farnz (subscriber, #17727)In reply to: Rust in the 6.2 kernel by ncm
Parent article: Rust in the 6.2 kernel
It does need to be kept track of - you need to ensure that the underlying string is not deallocated before the string view is deallocated.
For the very specific case of just passing a string view of a string you own down a call stack, there's no issues, but as soon as the string view relates to a string whose lifespan is not determined purely by the enclosing scope (e.g. because you put the string view in a heap-allocated data structure), you have a lifespan tracking issue to worry about.
