@@ -15,9 +15,8 @@ import util::common;
15
15
import std:: ivec;
16
16
import std:: str;
17
17
import std:: vec;
18
- import std:: ebml;
19
18
import std:: fs;
20
- import std:: io ;
19
+ import std:: ioivec ;
21
20
import std:: option;
22
21
import std:: option:: none;
23
22
import std:: option:: some;
@@ -88,7 +87,7 @@ fn visit_item(env e, &@ast::item i) {
88
87
}
89
88
90
89
// A diagnostic function for dumping crate metadata to an output stream
91
- fn list_file_metadata( str path, io :: writer out) {
90
+ fn list_file_metadata( str path, ioivec :: writer out) {
92
91
alt ( get_metadata_section( path) ) {
93
92
case ( option:: some( ?bytes) ) {
94
93
decoder:: list_crate_metadata( bytes, out) ;
@@ -99,8 +98,7 @@ fn list_file_metadata(str path, io::writer out) {
99
98
}
100
99
}
101
100
102
- fn metadata_matches( & vec[ u8] crate_data,
103
- & ( @ast:: meta_item) [ ] metas) -> bool {
101
+ fn metadata_matches( & @u8 [ ] crate_data, & ( @ast:: meta_item) [ ] metas) -> bool {
104
102
auto attrs = decoder:: get_crate_attributes( crate_data) ;
105
103
auto linkage_metas = attr:: find_linkage_metas( attrs) ;
106
104
@@ -130,8 +128,8 @@ fn default_native_lib_naming(session::session sess, bool static) ->
130
128
131
129
fn find_library_crate( & session:: session sess, & ast:: ident ident,
132
130
& ( @ast:: meta_item) [ ] metas,
133
- & vec[ str] library_search_paths) ->
134
- option:: t[ tup( str, vec [ u8 ] ) ] {
131
+ & vec[ str] library_search_paths)
132
+ -> option:: t[ tup( str, @ u8 [ ] ) ] {
135
133
136
134
attr:: require_unique_names( sess, metas) ;
137
135
@@ -165,7 +163,7 @@ fn find_library_crate(&session::session sess, &ast::ident ident,
165
163
fn find_library_crate_aux( & rec( str prefix, str suffix) nn, str crate_name,
166
164
& ( @ast:: meta_item) [ ] metas,
167
165
& vec[ str] library_search_paths) ->
168
- option:: t[ tup( str, vec [ u8 ] ) ] {
166
+ option:: t[ tup( str, @ u8 [ ] ) ] {
169
167
let str prefix = nn. prefix + crate_name;
170
168
// FIXME: we could probably use a 'glob' function in std::fs but it will
171
169
// be much easier to write once the unsafe module knows more about FFI
@@ -200,10 +198,10 @@ fn find_library_crate_aux(&rec(str prefix, str suffix) nn, str crate_name,
200
198
ret none;
201
199
}
202
200
203
- fn get_metadata_section( str filename) -> option:: t[ vec [ u8 ] ] {
201
+ fn get_metadata_section( str filename) -> option:: t[ @ u8 [ ] ] {
204
202
auto b = str :: buf( filename) ;
205
203
auto mb = llvm:: LLVMRustCreateMemoryBufferWithContentsOfFile ( b) ;
206
- if ( mb as int == 0 ) { ret option:: none[ vec [ u8 ] ] ; }
204
+ if ( mb as int == 0 ) { ret option:: none[ @ u8 [ ] ] ; }
207
205
auto of = mk_object_file( mb) ;
208
206
auto si = mk_section_iter( of. llof) ;
209
207
while ( llvm:: LLVMIsSectionIteratorAtEnd ( of. llof, si. llsi) == False ) {
@@ -212,18 +210,17 @@ fn get_metadata_section(str filename) -> option::t[vec[u8]] {
212
210
if ( str :: eq( name, x86:: get_meta_sect_name( ) ) ) {
213
211
auto cbuf = llvm:: LLVMGetSectionContents ( si. llsi) ;
214
212
auto csz = llvm:: LLVMGetSectionSize ( si. llsi) ;
215
- auto cvbuf = cbuf as vec :: vbuf ;
216
- ret option:: some[ vec [ u8 ] ] ( vec :: vec_from_vbuf [ u8 ] ( cvbuf, csz) ) ;
213
+ let * u8 cvbuf = std :: unsafe :: reinterpret_cast ( cbuf ) ;
214
+ ret option:: some[ @ u8 [ ] ] ( @ivec :: unsafe :: from_buf ( cvbuf, csz) ) ;
217
215
}
218
216
llvm:: LLVMMoveToNextSection ( si. llsi) ;
219
217
}
220
- ret option:: none[ vec [ u8 ] ] ;
218
+ ret option:: none[ @ u8 [ ] ] ;
221
219
}
222
220
223
221
fn load_library_crate( & session:: session sess, span span,
224
222
& ast:: ident ident, & ( @ast:: meta_item) [ ] metas,
225
- & vec[ str] library_search_paths)
226
- -> tup( str, vec[ u8] ) {
223
+ & vec[ str ] library_search_paths) -> tup( str , @u8 [ ] ) {
227
224
228
225
alt ( find_library_crate( sess, ident, metas, library_search_paths) ) {
229
226
case ( some( ?t) ) {
@@ -266,7 +263,7 @@ fn resolve_crate(env e, ast::ident ident, (@ast::meta_item)[] metas,
266
263
}
267
264
268
265
// Go through the crate metadata and load any crates that it references
269
- fn resolve_crate_deps( env e, & vec [ u8 ] cdata) -> cstore:: cnum_map {
266
+ fn resolve_crate_deps( env e, & @ u8 [ ] cdata) -> cstore:: cnum_map {
270
267
log "resolving deps of external crate ";
271
268
// The map from crate numbers in the crate we're resolving to local crate
272
269
// numbers
0 commit comments