Closed
Description
It's possible to create a slice from another slice with a lifetime longer than the original without use of the "unsafe" keyword. This allows for accessing memory after the original contents of a slice have been free'd, among other bad things.
trait Tr<'a, T> {
fn renew<'b: 'a>(self) -> &'b mut [T];
}
impl<'a, T> Tr<'a, T> for &'a mut [T] {
fn renew<'b: 'a>(self) -> &'b mut [T] where 'a: 'b {
&mut self[..]
}
}
See this code for an example.
Metadata
Metadata
Assignees
Labels
No labels