From 7104916e2e48058aa4f0e0dd2887c3156617c619 Mon Sep 17 00:00:00 2001 From: Jan Teske Date: Thu, 13 Jul 2023 14:34:10 +0200 Subject: [PATCH] Fix the lifetime of `progam_iter` items The `ProgramHeader` objects produced by `ElfFile::program_iter` should have the same lifetime as the `ElfFile`, i.e. the lifetime of the input data. Prior to this commit, they instead had the shorter of a) the `ElfFile` lifetime and b) the `&self` reference lifetime, making code dealing with these `ProgramHeader`s awkward to write. This commit fixes the lifetime issue by making the lifetime annotations the same as for `ElfFile::section_iter`. --- src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 75dc8fe..fda68ed 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -65,7 +65,7 @@ impl<'a> ElfFile<'a> { program::parse_program_header(self.input, self.header, index) } - pub fn program_iter(&self) -> impl Iterator> { + pub fn program_iter(&self) -> impl Iterator> + '_ { ProgramIter { file: self, next_index: 0,