1+ use alloc:: { borrow:: Cow , vec:: Vec } ;
2+
13use anyhow:: { Context , Result } ;
2- use object:: { Object , ObjectSection } ;
4+ use object:: { Object as _ , ObjectSection as _ } ;
35use typed_arena:: Arena ;
46
57use crate :: obj:: { Section , SectionKind } ;
@@ -83,7 +85,7 @@ fn load_file_section<'input, 'arena, Endian: gimli::Endianity>(
8385 id : gimli:: SectionId ,
8486 file : & object:: File < ' input > ,
8587 endian : Endian ,
86- arena_data : & ' arena Arena < alloc :: borrow :: Cow < ' input , [ u8 ] > > ,
88+ arena_data : & ' arena Arena < Cow < ' input , [ u8 ] > > ,
8789 arena_relocations : & ' arena Arena < RelocationMap > ,
8890) -> Result < Relocate < ' arena , gimli:: EndianSlice < ' arena , Endian > > > {
8991 let mut relocations = RelocationMap :: default ( ) ;
@@ -93,14 +95,15 @@ fn load_file_section<'input, 'arena, Endian: gimli::Endianity>(
9395 section. uncompressed_data ( ) ?
9496 }
9597 // Use a non-zero capacity so that `ReaderOffsetId`s are unique.
96- None => alloc :: borrow :: Cow :: Owned ( Vec :: with_capacity ( 1 ) ) ,
98+ None => Cow :: Owned ( Vec :: with_capacity ( 1 ) ) ,
9799 } ;
98100 let data_ref = arena_data. alloc ( data) ;
99101 let section = gimli:: EndianSlice :: new ( data_ref, endian) ;
100102 let relocations = arena_relocations. alloc ( relocations) ;
101103 Ok ( Relocate :: new ( section, relocations) )
102104}
103105
106+ #[ inline]
104107fn gimli_error ( e : gimli:: Error , context : & str ) -> anyhow:: Error {
105108 anyhow:: anyhow!( "gimli error {context}: {e:?}" )
106109}
0 commit comments