@@ -278,3 +278,130 @@ pub fn validate_crate_name(sess: Option<&Session>, s: &str, sp: Option<Span>) {
278
278
None => { }
279
279
}
280
280
}
281
+
282
+ /// A dummy crate store that does not support any non-local crates,
283
+ /// for test purposes.
284
+ pub struct DummyCrateStore ;
285
+ #[ allow( unused_variables) ]
286
+ impl < ' tcx > CrateStore < ' tcx > for DummyCrateStore {
287
+ // item info
288
+ fn stability ( & self , def : DefId ) -> Option < attr:: Stability > { unimplemented ! ( ) }
289
+ fn closure_kind ( & self , tcx : & ty:: ctxt < ' tcx > , def_id : DefId )
290
+ -> ty:: ClosureKind { unimplemented ! ( ) }
291
+ fn closure_ty ( & self , tcx : & ty:: ctxt < ' tcx > , def_id : DefId )
292
+ -> ty:: ClosureTy < ' tcx > { unimplemented ! ( ) }
293
+ fn item_variances ( & self , def : DefId ) -> ty:: ItemVariances { unimplemented ! ( ) }
294
+ fn repr_attrs ( & self , def : DefId ) -> Vec < attr:: ReprAttr > { unimplemented ! ( ) }
295
+ fn item_type ( & self , tcx : & ty:: ctxt < ' tcx > , def : DefId )
296
+ -> ty:: TypeScheme < ' tcx > { unimplemented ! ( ) }
297
+ fn item_path ( & self , def : DefId ) -> Vec < hir_map:: PathElem > { unimplemented ! ( ) }
298
+ fn item_name ( & self , def : DefId ) -> ast:: Name { unimplemented ! ( ) }
299
+ fn item_predicates ( & self , tcx : & ty:: ctxt < ' tcx > , def : DefId )
300
+ -> ty:: GenericPredicates < ' tcx > { unimplemented ! ( ) }
301
+ fn item_super_predicates ( & self , tcx : & ty:: ctxt < ' tcx > , def : DefId )
302
+ -> ty:: GenericPredicates < ' tcx > { unimplemented ! ( ) }
303
+ fn item_attrs ( & self , def_id : DefId ) -> Vec < ast:: Attribute > { unimplemented ! ( ) }
304
+ fn item_symbol ( & self , def : DefId ) -> String { unimplemented ! ( ) }
305
+ fn trait_def ( & self , tcx : & ty:: ctxt < ' tcx > , def : DefId ) -> ty:: TraitDef < ' tcx >
306
+ { unimplemented ! ( ) }
307
+ fn adt_def ( & self , tcx : & ty:: ctxt < ' tcx > , def : DefId ) -> ty:: AdtDefMaster < ' tcx >
308
+ { unimplemented ! ( ) }
309
+ fn method_arg_names ( & self , did : DefId ) -> Vec < String > { unimplemented ! ( ) }
310
+ fn inherent_implementations_for_type ( & self , def_id : DefId ) -> Vec < DefId > { vec ! [ ] }
311
+
312
+ // trait info
313
+ fn implementations_of_trait ( & self , def_id : DefId ) -> Vec < DefId > { vec ! [ ] }
314
+ fn provided_trait_methods ( & self , tcx : & ty:: ctxt < ' tcx > , def : DefId )
315
+ -> Vec < Rc < ty:: Method < ' tcx > > > { unimplemented ! ( ) }
316
+ fn trait_item_def_ids ( & self , def : DefId )
317
+ -> Vec < ty:: ImplOrTraitItemId > { unimplemented ! ( ) }
318
+
319
+ // impl info
320
+ fn impl_items ( & self , impl_def_id : DefId ) -> Vec < ty:: ImplOrTraitItemId >
321
+ { unimplemented ! ( ) }
322
+ fn impl_trait_ref ( & self , tcx : & ty:: ctxt < ' tcx > , def : DefId )
323
+ -> Option < ty:: TraitRef < ' tcx > > { unimplemented ! ( ) }
324
+ fn impl_polarity ( & self , def : DefId ) -> Option < hir:: ImplPolarity > { unimplemented ! ( ) }
325
+ fn custom_coerce_unsized_kind ( & self , def : DefId )
326
+ -> Option < ty:: adjustment:: CustomCoerceUnsized >
327
+ { unimplemented ! ( ) }
328
+ fn associated_consts ( & self , tcx : & ty:: ctxt < ' tcx > , def : DefId )
329
+ -> Vec < Rc < ty:: AssociatedConst < ' tcx > > > { unimplemented ! ( ) }
330
+
331
+ // trait/impl-item info
332
+ fn trait_of_item ( & self , tcx : & ty:: ctxt < ' tcx > , def_id : DefId )
333
+ -> Option < DefId > { unimplemented ! ( ) }
334
+ fn impl_or_trait_item ( & self , tcx : & ty:: ctxt < ' tcx > , def : DefId )
335
+ -> ty:: ImplOrTraitItem < ' tcx > { unimplemented ! ( ) }
336
+
337
+ // flags
338
+ fn is_const_fn ( & self , did : DefId ) -> bool { unimplemented ! ( ) }
339
+ fn is_defaulted_trait ( & self , did : DefId ) -> bool { unimplemented ! ( ) }
340
+ fn is_impl ( & self , did : DefId ) -> bool { unimplemented ! ( ) }
341
+ fn is_default_impl ( & self , impl_did : DefId ) -> bool { unimplemented ! ( ) }
342
+ fn is_extern_fn ( & self , tcx : & ty:: ctxt < ' tcx > , did : DefId ) -> bool { unimplemented ! ( ) }
343
+ fn is_static ( & self , did : DefId ) -> bool { unimplemented ! ( ) }
344
+ fn is_static_method ( & self , did : DefId ) -> bool { unimplemented ! ( ) }
345
+ fn is_statically_included_foreign_item ( & self , id : ast:: NodeId ) -> bool { false }
346
+ fn is_typedef ( & self , did : DefId ) -> bool { unimplemented ! ( ) }
347
+
348
+ // crate metadata
349
+ fn dylib_dependency_formats ( & self , cnum : ast:: CrateNum )
350
+ -> Vec < ( ast:: CrateNum , LinkagePreference ) >
351
+ { unimplemented ! ( ) }
352
+ fn lang_items ( & self , cnum : ast:: CrateNum ) -> Vec < ( DefIndex , usize ) >
353
+ { unimplemented ! ( ) }
354
+ fn missing_lang_items ( & self , cnum : ast:: CrateNum ) -> Vec < lang_items:: LangItem >
355
+ { unimplemented ! ( ) }
356
+ fn is_staged_api ( & self , cnum : ast:: CrateNum ) -> bool { unimplemented ! ( ) }
357
+ fn is_explicitly_linked ( & self , cnum : ast:: CrateNum ) -> bool { unimplemented ! ( ) }
358
+ fn is_allocator ( & self , cnum : ast:: CrateNum ) -> bool { unimplemented ! ( ) }
359
+ fn crate_attrs ( & self , cnum : ast:: CrateNum ) -> Vec < ast:: Attribute >
360
+ { unimplemented ! ( ) }
361
+ fn crate_name ( & self , cnum : ast:: CrateNum ) -> String { unimplemented ! ( ) }
362
+ fn crate_hash ( & self , cnum : ast:: CrateNum ) -> Svh { unimplemented ! ( ) }
363
+ fn crate_struct_field_attrs ( & self , cnum : ast:: CrateNum )
364
+ -> FnvHashMap < DefId , Vec < ast:: Attribute > >
365
+ { unimplemented ! ( ) }
366
+ fn plugin_registrar_fn ( & self , cnum : ast:: CrateNum ) -> Option < DefId >
367
+ { unimplemented ! ( ) }
368
+ fn native_libraries ( & self , cnum : ast:: CrateNum ) -> Vec < ( NativeLibraryKind , String ) >
369
+ { unimplemented ! ( ) }
370
+ fn reachable_ids ( & self , cnum : ast:: CrateNum ) -> Vec < DefId > { unimplemented ! ( ) }
371
+
372
+ // resolve
373
+ fn def_path ( & self , def : DefId ) -> hir_map:: DefPath { unimplemented ! ( ) }
374
+ fn tuple_struct_definition_if_ctor ( & self , did : DefId ) -> Option < DefId >
375
+ { unimplemented ! ( ) }
376
+ fn struct_field_names ( & self , def : DefId ) -> Vec < ast:: Name > { unimplemented ! ( ) }
377
+ fn item_children ( & self , did : DefId ) -> Vec < ChildItem > { unimplemented ! ( ) }
378
+ fn crate_top_level_items ( & self , cnum : ast:: CrateNum ) -> Vec < ChildItem >
379
+ { unimplemented ! ( ) }
380
+
381
+ // misc. metadata
382
+ fn maybe_get_item_ast ( & ' tcx self , tcx : & ty:: ctxt < ' tcx > , def : DefId )
383
+ -> FoundAst < ' tcx > { unimplemented ! ( ) }
384
+ // This is basically a 1-based range of ints, which is a little
385
+ // silly - I may fix that.
386
+ fn crates ( & self ) -> Vec < ast:: CrateNum > { vec ! [ ] }
387
+ fn used_libraries ( & self ) -> Vec < ( String , NativeLibraryKind ) > { vec ! [ ] }
388
+ fn used_link_args ( & self ) -> Vec < String > { vec ! [ ] }
389
+
390
+ // utility functions
391
+ fn metadata_filename ( & self ) -> & str { unimplemented ! ( ) }
392
+ fn metadata_section_name ( & self , target : & Target ) -> & str { unimplemented ! ( ) }
393
+ fn encode_type ( & self , tcx : & ty:: ctxt < ' tcx > , ty : Ty < ' tcx > ) -> Vec < u8 >
394
+ { unimplemented ! ( ) }
395
+ fn used_crates ( & self , prefer : LinkagePreference ) -> Vec < ( ast:: CrateNum , Option < PathBuf > ) >
396
+ { vec ! [ ] }
397
+ fn used_crate_source ( & self , cnum : ast:: CrateNum ) -> CrateSource { unimplemented ! ( ) }
398
+ fn extern_mod_stmt_cnum ( & self , emod_id : ast:: NodeId ) -> Option < ast:: CrateNum > { None }
399
+ fn encode_metadata ( & self ,
400
+ tcx : & ty:: ctxt < ' tcx > ,
401
+ reexports : & def:: ExportMap ,
402
+ item_symbols : & RefCell < NodeMap < String > > ,
403
+ link_meta : & LinkMeta ,
404
+ reachable : & NodeSet ,
405
+ krate : & hir:: Crate ) -> Vec < u8 > { vec ! [ ] }
406
+ fn metadata_encoding_version ( & self ) -> & [ u8 ] { unimplemented ! ( ) }
407
+ }
0 commit comments