1
+ use alloc:: { borrow:: Cow , vec:: Vec } ;
2
+
1
3
use anyhow:: { Context , Result } ;
2
- use object:: { Object , ObjectSection } ;
4
+ use object:: { Object as _ , ObjectSection as _ } ;
3
5
use typed_arena:: Arena ;
4
6
5
7
use crate :: obj:: { Section , SectionKind } ;
@@ -83,7 +85,7 @@ fn load_file_section<'input, 'arena, Endian: gimli::Endianity>(
83
85
id : gimli:: SectionId ,
84
86
file : & object:: File < ' input > ,
85
87
endian : Endian ,
86
- arena_data : & ' arena Arena < alloc :: borrow :: Cow < ' input , [ u8 ] > > ,
88
+ arena_data : & ' arena Arena < Cow < ' input , [ u8 ] > > ,
87
89
arena_relocations : & ' arena Arena < RelocationMap > ,
88
90
) -> Result < Relocate < ' arena , gimli:: EndianSlice < ' arena , Endian > > > {
89
91
let mut relocations = RelocationMap :: default ( ) ;
@@ -93,14 +95,15 @@ fn load_file_section<'input, 'arena, Endian: gimli::Endianity>(
93
95
section. uncompressed_data ( ) ?
94
96
}
95
97
// 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 ) ) ,
97
99
} ;
98
100
let data_ref = arena_data. alloc ( data) ;
99
101
let section = gimli:: EndianSlice :: new ( data_ref, endian) ;
100
102
let relocations = arena_relocations. alloc ( relocations) ;
101
103
Ok ( Relocate :: new ( section, relocations) )
102
104
}
103
105
106
+ #[ inline]
104
107
fn gimli_error ( e : gimli:: Error , context : & str ) -> anyhow:: Error {
105
108
anyhow:: anyhow!( "gimli error {context}: {e:?}" )
106
109
}
0 commit comments