We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A trait impl on a reference can be used to violate lifetimes via trait objects. The following segfaults on my OSX machine:
trait Oops { fn expose<'b>(&'b self) -> &'b Vec<u8>; } impl<'a> Oops for &'a Vec<u8> { fn expose<'b>(&'b self) -> &'b Vec<u8> { *self } } fn hide(x: &Vec<u8>) -> Box<Oops> { box x as Box<Oops> } fn hidden_pointer_into_frame() -> Box<Oops> { let v = vec!(37); hide(&v) } fn main() { let hp: Box<Oops> = hidden_pointer_into_frame(); let p: &Vec<u8> = hp.expose(); println!("{}", *p) }
The text was updated successfully, but these errors were encountered:
Possibly an instance of #2203, but I'm not sure.
Sorry, something went wrong.
Actually, this is almost certainly a dupe of one of #11374, #5723, #11971 or #12781.
Closing.
No branches or pull requests
A trait impl on a reference can be used to violate lifetimes via trait objects. The following segfaults on my OSX machine:
The text was updated successfully, but these errors were encountered: