Mercurial > hg
changeset 50413:c101e7757ed7
rust-revlog: fix lifetime problem for RevlogEntry parent entries accessors
Without this, the lifetime of the result is equated to the lifetime of the
`self` reference, preventing callers, e.g., to take a `RevlogEntry` and
return its `p1_entry()`, as it looks like returning something that does not
outlive the *reference to* the `RevlogEntry`.
author | Georges Racinet <georges.racinet@octobus.net> |
---|---|
date | Thu, 30 Mar 2023 12:20:53 +0200 |
parents | 7ef51fff2c4f |
children | 071a6c1d291e |
files | rust/hg-core/src/revlog/mod.rs |
diffstat | 1 files changed, 6 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/rust/hg-core/src/revlog/mod.rs Thu Mar 30 12:14:57 2023 +0200 +++ b/rust/hg-core/src/revlog/mod.rs Thu Mar 30 12:20:53 2023 +0200 @@ -430,7 +430,9 @@ self.p1 != NULL_REVISION } - pub fn p1_entry(&self) -> Result<Option<RevlogEntry>, RevlogError> { + pub fn p1_entry( + &self, + ) -> Result<Option<RevlogEntry<'revlog>>, RevlogError> { if self.p1 == NULL_REVISION { Ok(None) } else { @@ -438,7 +440,9 @@ } } - pub fn p2_entry(&self) -> Result<Option<RevlogEntry>, RevlogError> { + pub fn p2_entry( + &self, + ) -> Result<Option<RevlogEntry<'revlog>>, RevlogError> { if self.p2 == NULL_REVISION { Ok(None) } else {