1 // Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 // Copyright 2015 The Rust Project Developers. See the COPYRIGHT
12 // file at the top-level directory of this distribution and at
13 // http://rust-lang.org/COPYRIGHT.
15 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
16 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
17 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
18 // option. This file may not be copied, modified, or distributed
19 // except according to those terms.
21 // the rustc crate store interface. This also includes types that
22 // are *mostly* used as a part of that interface, but these should
23 // probably get a better home if someone can find one.
25 use hir::def::{self, Def};
26 use hir::def_id::{CrateNum, DefId, DefIndex};
27 use hir::map as hir_map;
28 use hir::map::definitions::{Definitions, DefKey, DisambiguatedDefPathData};
30 use middle::lang_items;
31 use ty::{self, Ty, TyCtxt};
34 use session::search_paths::PathKind;
35 use util::nodemap::{NodeSet, DefIdMap};
36 use std::path::PathBuf;
40 use syntax::ext::base::SyntaxExtension;
41 use syntax::symbol::Symbol;
43 use rustc_back::target::Target;
45 use hir::intravisit::Visitor;
46 use rustc_back::PanicStrategy;
48 pub use self::NativeLibraryKind::{NativeStatic, NativeFramework, NativeUnknown};
50 // lonely orphan structs and enums looking for a better home
52 #[derive(Clone, Debug)]
54 pub crate_name: Symbol,
58 // Where a crate came from on the local filesystem. One of these three options
60 #[derive(PartialEq, Clone, Debug)]
61 pub struct CrateSource {
62 pub dylib: Option<(PathBuf, PathKind)>,
63 pub rlib: Option<(PathBuf, PathKind)>,
64 pub rmeta: Option<(PathBuf, PathKind)>,
67 #[derive(RustcEncodable, RustcDecodable, Copy, Clone, Ord, PartialOrd, Eq, PartialEq, Debug)]
69 /// A dependency that is only used for its macros, none of which are visible from other crates.
70 /// These are included in the metadata only as placeholders and are ignored when decoding.
72 /// A dependency that is only used for its macros.
74 /// A dependency that is always injected into the dependency list and so
75 /// doesn't need to be linked to an rlib, e.g. the injected allocator.
77 /// A dependency that is required by an rlib version of this crate.
78 /// Ordinary `extern crate`s result in `Explicit` dependencies.
83 pub fn macros_only(self) -> bool {
85 DepKind::UnexportedMacrosOnly | DepKind::MacrosOnly => true,
86 DepKind::Implicit | DepKind::Explicit => false,
91 #[derive(PartialEq, Clone, Debug)]
99 pub fn is_some(&self) -> bool {
100 if let LibSource::Some(_) = *self {
107 pub fn option(&self) -> Option<PathBuf> {
109 LibSource::Some(ref p) => Some(p.clone()),
110 LibSource::MetadataOnly | LibSource::None => None,
115 #[derive(Copy, Debug, PartialEq, Clone, RustcEncodable, RustcDecodable)]
116 pub enum LinkagePreference {
121 #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, RustcEncodable, RustcDecodable)]
122 pub enum NativeLibraryKind {
123 NativeStatic, // native static library (.a archive)
124 NativeFramework, // OSX-specific
125 NativeUnknown, // default way to specify a dynamic library
128 #[derive(Clone, Hash, RustcEncodable, RustcDecodable)]
129 pub struct NativeLibrary {
130 pub kind: NativeLibraryKind,
132 pub cfg: Option<ast::MetaItem>,
133 pub foreign_items: Vec<DefIndex>,
136 /// The data we save and restore about an inlined item or method. This is not
137 /// part of the AST that we parse from a file, but it becomes part of the tree
139 #[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
140 pub struct InlinedItem {
145 /// A borrowed version of `hir::InlinedItem`. This is what's encoded when saving
146 /// a crate; it then gets read as an InlinedItem.
147 #[derive(Clone, PartialEq, Eq, RustcEncodable, Hash, Debug)]
148 pub struct InlinedItemRef<'a> {
150 pub body: &'a hir::Body,
153 impl<'a, 'tcx> InlinedItemRef<'tcx> {
154 pub fn from_item(def_id: DefId,
156 tcx: TyCtxt<'a, 'tcx, 'tcx>)
157 -> InlinedItemRef<'tcx> {
158 let body_id = match item.node {
159 hir::ItemFn(.., body_id) |
160 hir::ItemConst(_, body_id) => body_id,
161 _ => bug!("InlinedItemRef::from_item wrong kind")
165 body: tcx.map.body(body_id),
169 pub fn from_trait_item(def_id: DefId,
170 item: &hir::TraitItem,
171 tcx: TyCtxt<'a, 'tcx, 'tcx>)
172 -> InlinedItemRef<'tcx> {
173 let body_id = match item.node {
174 hir::TraitItemKind::Const(_, Some(body_id)) => body_id,
175 hir::TraitItemKind::Const(_, None) => {
176 bug!("InlinedItemRef::from_trait_item called for const without body")
178 _ => bug!("InlinedItemRef::from_trait_item wrong kind")
182 body: tcx.map.body(body_id),
186 pub fn from_impl_item(def_id: DefId,
187 item: &hir::ImplItem,
188 tcx: TyCtxt<'a, 'tcx, 'tcx>)
189 -> InlinedItemRef<'tcx> {
190 let body_id = match item.node {
191 hir::ImplItemKind::Method(_, body_id) |
192 hir::ImplItemKind::Const(_, body_id) => body_id,
193 _ => bug!("InlinedItemRef::from_impl_item wrong kind")
197 body: tcx.map.body(body_id),
201 pub fn visit<V>(&self, visitor: &mut V)
202 where V: Visitor<'tcx>
204 visitor.visit_body(self.body);
209 pub fn visit<'ast,V>(&'ast self, visitor: &mut V)
210 where V: Visitor<'ast>
212 visitor.visit_body(&self.body);
216 pub enum LoadedMacro {
217 MacroRules(ast::MacroDef),
218 ProcMacro(Rc<SyntaxExtension>),
221 #[derive(Copy, Clone, Debug)]
222 pub struct ExternCrate {
223 /// def_id of an `extern crate` in the current crate that caused
224 /// this crate to be loaded; note that there could be multiple
228 /// span of the extern crate that caused this to be loaded
231 /// If true, then this crate is the crate named by the extern
232 /// crate referenced above. If false, then this crate is a dep
236 /// Number of links to reach the extern crate `def_id`
237 /// declaration; used to select the extern crate with the shortest
242 /// A store of Rust crates, through with their metadata
244 pub trait CrateStore<'tcx> {
246 fn describe_def(&self, def: DefId) -> Option<Def>;
247 fn def_span(&self, sess: &Session, def: DefId) -> Span;
248 fn stability(&self, def: DefId) -> Option<attr::Stability>;
249 fn deprecation(&self, def: DefId) -> Option<attr::Deprecation>;
250 fn visibility(&self, def: DefId) -> ty::Visibility;
251 fn closure_kind(&self, def_id: DefId) -> ty::ClosureKind;
252 fn closure_ty<'a>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId)
253 -> ty::ClosureTy<'tcx>;
254 fn item_variances(&self, def: DefId) -> Vec<ty::Variance>;
255 fn item_type<'a>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>, def: DefId)
257 fn visible_parent_map<'a>(&'a self) -> ::std::cell::RefMut<'a, DefIdMap<DefId>>;
258 fn item_predicates<'a>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>, def: DefId)
259 -> ty::GenericPredicates<'tcx>;
260 fn item_super_predicates<'a>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>, def: DefId)
261 -> ty::GenericPredicates<'tcx>;
262 fn item_generics<'a>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>, def: DefId)
263 -> ty::Generics<'tcx>;
264 fn item_attrs(&self, def_id: DefId) -> Vec<ast::Attribute>;
265 fn trait_def<'a>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>, def: DefId)-> ty::TraitDef;
266 fn adt_def<'a>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>, def: DefId) -> &'tcx ty::AdtDef;
267 fn fn_arg_names(&self, did: DefId) -> Vec<ast::Name>;
268 fn inherent_implementations_for_type(&self, def_id: DefId) -> Vec<DefId>;
271 fn implementations_of_trait(&self, filter: Option<DefId>) -> Vec<DefId>;
274 fn associated_item_def_ids(&self, def_id: DefId) -> Vec<DefId>;
275 fn impl_trait_ref<'a>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>, def: DefId)
276 -> Option<ty::TraitRef<'tcx>>;
277 fn impl_polarity(&self, def: DefId) -> hir::ImplPolarity;
278 fn custom_coerce_unsized_kind(&self, def: DefId)
279 -> Option<ty::adjustment::CustomCoerceUnsized>;
280 fn impl_parent(&self, impl_def_id: DefId) -> Option<DefId>;
282 // trait/impl-item info
283 fn trait_of_item(&self, def_id: DefId) -> Option<DefId>;
284 fn associated_item(&self, def: DefId) -> Option<ty::AssociatedItem>;
287 fn is_const_fn(&self, did: DefId) -> bool;
288 fn is_defaulted_trait(&self, did: DefId) -> bool;
289 fn is_default_impl(&self, impl_did: DefId) -> bool;
290 fn is_foreign_item(&self, did: DefId) -> bool;
291 fn is_dllimport_foreign_item(&self, def: DefId) -> bool;
292 fn is_statically_included_foreign_item(&self, def_id: DefId) -> bool;
295 fn dylib_dependency_formats(&self, cnum: CrateNum)
296 -> Vec<(CrateNum, LinkagePreference)>;
297 fn dep_kind(&self, cnum: CrateNum) -> DepKind;
298 fn export_macros(&self, cnum: CrateNum);
299 fn lang_items(&self, cnum: CrateNum) -> Vec<(DefIndex, usize)>;
300 fn missing_lang_items(&self, cnum: CrateNum) -> Vec<lang_items::LangItem>;
301 fn is_staged_api(&self, cnum: CrateNum) -> bool;
302 fn is_allocator(&self, cnum: CrateNum) -> bool;
303 fn is_panic_runtime(&self, cnum: CrateNum) -> bool;
304 fn is_compiler_builtins(&self, cnum: CrateNum) -> bool;
305 fn panic_strategy(&self, cnum: CrateNum) -> PanicStrategy;
306 fn extern_crate(&self, cnum: CrateNum) -> Option<ExternCrate>;
307 /// The name of the crate as it is referred to in source code of the current
309 fn crate_name(&self, cnum: CrateNum) -> Symbol;
310 /// The name of the crate as it is stored in the crate's metadata.
311 fn original_crate_name(&self, cnum: CrateNum) -> Symbol;
312 fn crate_hash(&self, cnum: CrateNum) -> Svh;
313 fn crate_disambiguator(&self, cnum: CrateNum) -> Symbol;
314 fn plugin_registrar_fn(&self, cnum: CrateNum) -> Option<DefId>;
315 fn derive_registrar_fn(&self, cnum: CrateNum) -> Option<DefId>;
316 fn native_libraries(&self, cnum: CrateNum) -> Vec<NativeLibrary>;
317 fn exported_symbols(&self, cnum: CrateNum) -> Vec<DefId>;
318 fn is_no_builtins(&self, cnum: CrateNum) -> bool;
321 fn retrace_path(&self,
323 path_data: &[DisambiguatedDefPathData])
325 fn def_key(&self, def: DefId) -> DefKey;
326 fn def_path(&self, def: DefId) -> hir_map::DefPath;
327 fn struct_field_names(&self, def: DefId) -> Vec<ast::Name>;
328 fn item_children(&self, did: DefId) -> Vec<def::Export>;
329 fn load_macro(&self, did: DefId, sess: &Session) -> LoadedMacro;
332 fn maybe_get_item_ast<'a>(&'tcx self, tcx: TyCtxt<'a, 'tcx, 'tcx>, def: DefId)
333 -> Option<(&'tcx InlinedItem, ast::NodeId)>;
334 fn local_node_for_inlined_defid(&'tcx self, def_id: DefId) -> Option<ast::NodeId>;
335 fn defid_for_inlined_node(&'tcx self, node_id: ast::NodeId) -> Option<DefId>;
337 fn get_item_mir<'a>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>, def: DefId) -> Mir<'tcx>;
338 fn is_item_mir_available(&self, def: DefId) -> bool;
340 /// Take a look if we need to inline or monomorphize this. If so, we
341 /// will emit code for this item in the local crate, and thus
342 /// create a translation item for it.
343 fn can_have_local_instance<'a>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>, def: DefId) -> bool;
345 // This is basically a 1-based range of ints, which is a little
346 // silly - I may fix that.
347 fn crates(&self) -> Vec<CrateNum>;
348 fn used_libraries(&self) -> Vec<NativeLibrary>;
349 fn used_link_args(&self) -> Vec<String>;
352 fn metadata_filename(&self) -> &str;
353 fn metadata_section_name(&self, target: &Target) -> &str;
354 fn used_crates(&self, prefer: LinkagePreference) -> Vec<(CrateNum, LibSource)>;
355 fn used_crate_source(&self, cnum: CrateNum) -> CrateSource;
356 fn extern_mod_stmt_cnum(&self, emod_id: ast::NodeId) -> Option<CrateNum>;
357 fn encode_metadata<'a>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>,
358 reexports: &def::ExportMap,
359 link_meta: &LinkMeta,
360 reachable: &NodeSet) -> Vec<u8>;
361 fn metadata_encoding_version(&self) -> &[u8];
364 // FIXME: find a better place for this?
365 pub fn validate_crate_name(sess: Option<&Session>, s: &str, sp: Option<Span>) {
366 let mut err_count = 0;
368 let mut say = |s: &str| {
370 (_, None) => bug!("{}", s),
371 (Some(sp), Some(sess)) => sess.span_err(sp, s),
372 (None, Some(sess)) => sess.err(s),
377 say("crate name must not be empty");
380 if c.is_alphanumeric() { continue }
381 if c == '_' { continue }
382 say(&format!("invalid character `{}` in crate name: `{}`", c, s));
387 sess.unwrap().abort_if_errors();
391 /// A dummy crate store that does not support any non-local crates,
392 /// for test purposes.
393 pub struct DummyCrateStore;
394 #[allow(unused_variables)]
395 impl<'tcx> CrateStore<'tcx> for DummyCrateStore {
397 fn describe_def(&self, def: DefId) -> Option<Def> { bug!("describe_def") }
398 fn def_span(&self, sess: &Session, def: DefId) -> Span { bug!("def_span") }
399 fn stability(&self, def: DefId) -> Option<attr::Stability> { bug!("stability") }
400 fn deprecation(&self, def: DefId) -> Option<attr::Deprecation> { bug!("deprecation") }
401 fn visibility(&self, def: DefId) -> ty::Visibility { bug!("visibility") }
402 fn closure_kind(&self, def_id: DefId) -> ty::ClosureKind { bug!("closure_kind") }
403 fn closure_ty<'a>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId)
404 -> ty::ClosureTy<'tcx> { bug!("closure_ty") }
405 fn item_variances(&self, def: DefId) -> Vec<ty::Variance> { bug!("item_variances") }
406 fn item_type<'a>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>, def: DefId)
407 -> Ty<'tcx> { bug!("item_type") }
408 fn visible_parent_map<'a>(&'a self) -> ::std::cell::RefMut<'a, DefIdMap<DefId>> {
409 bug!("visible_parent_map")
411 fn item_predicates<'a>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>, def: DefId)
412 -> ty::GenericPredicates<'tcx> { bug!("item_predicates") }
413 fn item_super_predicates<'a>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>, def: DefId)
414 -> ty::GenericPredicates<'tcx> { bug!("item_super_predicates") }
415 fn item_generics<'a>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>, def: DefId)
416 -> ty::Generics<'tcx> { bug!("item_generics") }
417 fn item_attrs(&self, def_id: DefId) -> Vec<ast::Attribute> { bug!("item_attrs") }
418 fn trait_def<'a>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>, def: DefId)-> ty::TraitDef
419 { bug!("trait_def") }
420 fn adt_def<'a>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>, def: DefId) -> &'tcx ty::AdtDef
422 fn fn_arg_names(&self, did: DefId) -> Vec<ast::Name> { bug!("fn_arg_names") }
423 fn inherent_implementations_for_type(&self, def_id: DefId) -> Vec<DefId> { vec![] }
426 fn implementations_of_trait(&self, filter: Option<DefId>) -> Vec<DefId> { vec![] }
429 fn associated_item_def_ids(&self, def_id: DefId) -> Vec<DefId>
430 { bug!("associated_items") }
431 fn impl_trait_ref<'a>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>, def: DefId)
432 -> Option<ty::TraitRef<'tcx>> { bug!("impl_trait_ref") }
433 fn impl_polarity(&self, def: DefId) -> hir::ImplPolarity { bug!("impl_polarity") }
434 fn custom_coerce_unsized_kind(&self, def: DefId)
435 -> Option<ty::adjustment::CustomCoerceUnsized>
436 { bug!("custom_coerce_unsized_kind") }
437 fn impl_parent(&self, def: DefId) -> Option<DefId> { bug!("impl_parent") }
439 // trait/impl-item info
440 fn trait_of_item(&self, def_id: DefId) -> Option<DefId> { bug!("trait_of_item") }
441 fn associated_item(&self, def: DefId) -> Option<ty::AssociatedItem> { bug!("associated_item") }
444 fn is_const_fn(&self, did: DefId) -> bool { bug!("is_const_fn") }
445 fn is_defaulted_trait(&self, did: DefId) -> bool { bug!("is_defaulted_trait") }
446 fn is_default_impl(&self, impl_did: DefId) -> bool { bug!("is_default_impl") }
447 fn is_foreign_item(&self, did: DefId) -> bool { bug!("is_foreign_item") }
448 fn is_dllimport_foreign_item(&self, id: DefId) -> bool { false }
449 fn is_statically_included_foreign_item(&self, def_id: DefId) -> bool { false }
452 fn dylib_dependency_formats(&self, cnum: CrateNum)
453 -> Vec<(CrateNum, LinkagePreference)>
454 { bug!("dylib_dependency_formats") }
455 fn lang_items(&self, cnum: CrateNum) -> Vec<(DefIndex, usize)>
456 { bug!("lang_items") }
457 fn missing_lang_items(&self, cnum: CrateNum) -> Vec<lang_items::LangItem>
458 { bug!("missing_lang_items") }
459 fn is_staged_api(&self, cnum: CrateNum) -> bool { bug!("is_staged_api") }
460 fn dep_kind(&self, cnum: CrateNum) -> DepKind { bug!("is_explicitly_linked") }
461 fn export_macros(&self, cnum: CrateNum) { bug!("export_macros") }
462 fn is_allocator(&self, cnum: CrateNum) -> bool { bug!("is_allocator") }
463 fn is_panic_runtime(&self, cnum: CrateNum) -> bool { bug!("is_panic_runtime") }
464 fn is_compiler_builtins(&self, cnum: CrateNum) -> bool { bug!("is_compiler_builtins") }
465 fn panic_strategy(&self, cnum: CrateNum) -> PanicStrategy {
466 bug!("panic_strategy")
468 fn extern_crate(&self, cnum: CrateNum) -> Option<ExternCrate> { bug!("extern_crate") }
469 fn crate_name(&self, cnum: CrateNum) -> Symbol { bug!("crate_name") }
470 fn original_crate_name(&self, cnum: CrateNum) -> Symbol {
471 bug!("original_crate_name")
473 fn crate_hash(&self, cnum: CrateNum) -> Svh { bug!("crate_hash") }
474 fn crate_disambiguator(&self, cnum: CrateNum)
475 -> Symbol { bug!("crate_disambiguator") }
476 fn plugin_registrar_fn(&self, cnum: CrateNum) -> Option<DefId>
477 { bug!("plugin_registrar_fn") }
478 fn derive_registrar_fn(&self, cnum: CrateNum) -> Option<DefId>
479 { bug!("derive_registrar_fn") }
480 fn native_libraries(&self, cnum: CrateNum) -> Vec<NativeLibrary>
481 { bug!("native_libraries") }
482 fn exported_symbols(&self, cnum: CrateNum) -> Vec<DefId> { bug!("exported_symbols") }
483 fn is_no_builtins(&self, cnum: CrateNum) -> bool { bug!("is_no_builtins") }
486 fn retrace_path(&self,
488 path_data: &[DisambiguatedDefPathData])
493 fn def_key(&self, def: DefId) -> DefKey { bug!("def_key") }
494 fn def_path(&self, def: DefId) -> hir_map::DefPath {
495 bug!("relative_def_path")
497 fn struct_field_names(&self, def: DefId) -> Vec<ast::Name> { bug!("struct_field_names") }
498 fn item_children(&self, did: DefId) -> Vec<def::Export> { bug!("item_children") }
499 fn load_macro(&self, did: DefId, sess: &Session) -> LoadedMacro { bug!("load_macro") }
502 fn maybe_get_item_ast<'a>(&'tcx self, tcx: TyCtxt<'a, 'tcx, 'tcx>, def: DefId)
503 -> Option<(&'tcx InlinedItem, ast::NodeId)> {
504 bug!("maybe_get_item_ast")
506 fn local_node_for_inlined_defid(&'tcx self, def_id: DefId) -> Option<ast::NodeId> {
507 bug!("local_node_for_inlined_defid")
509 fn defid_for_inlined_node(&'tcx self, node_id: ast::NodeId) -> Option<DefId> {
510 bug!("defid_for_inlined_node")
513 fn get_item_mir<'a>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>, def: DefId)
514 -> Mir<'tcx> { bug!("get_item_mir") }
515 fn is_item_mir_available(&self, def: DefId) -> bool {
516 bug!("is_item_mir_available")
518 fn can_have_local_instance<'a>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>, def: DefId) -> bool {
519 bug!("can_have_local_instance")
522 // This is basically a 1-based range of ints, which is a little
523 // silly - I may fix that.
524 fn crates(&self) -> Vec<CrateNum> { vec![] }
525 fn used_libraries(&self) -> Vec<NativeLibrary> { vec![] }
526 fn used_link_args(&self) -> Vec<String> { vec![] }
529 fn metadata_filename(&self) -> &str { bug!("metadata_filename") }
530 fn metadata_section_name(&self, target: &Target) -> &str { bug!("metadata_section_name") }
531 fn used_crates(&self, prefer: LinkagePreference) -> Vec<(CrateNum, LibSource)>
533 fn used_crate_source(&self, cnum: CrateNum) -> CrateSource { bug!("used_crate_source") }
534 fn extern_mod_stmt_cnum(&self, emod_id: ast::NodeId) -> Option<CrateNum> { None }
535 fn encode_metadata<'a>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>,
536 reexports: &def::ExportMap,
537 link_meta: &LinkMeta,
538 reachable: &NodeSet) -> Vec<u8> { vec![] }
539 fn metadata_encoding_version(&self) -> &[u8] { bug!("metadata_encoding_version") }
542 pub trait CrateLoader {
543 fn process_item(&mut self, item: &ast::Item, defs: &Definitions);
544 fn postprocess(&mut self, krate: &ast::Crate);