@@ -28,14 +28,13 @@ use hir::map as hir_map;
28
28
use hir:: map:: definitions:: DefKey ;
29
29
use hir:: svh:: Svh ;
30
30
use middle:: lang_items;
31
- use ty:: { self , Ty , TyCtxt , VariantKind } ;
31
+ use ty:: { self , Ty , TyCtxt } ;
32
32
use mir:: repr:: Mir ;
33
33
use mir:: mir_map:: MirMap ;
34
34
use session:: Session ;
35
35
use session:: config:: PanicStrategy ;
36
36
use session:: search_paths:: PathKind ;
37
- use util:: nodemap:: { FnvHashMap , NodeSet , DefIdMap } ;
38
- use std:: rc:: Rc ;
37
+ use util:: nodemap:: { NodeSet , DefIdMap } ;
39
38
use std:: path:: PathBuf ;
40
39
use syntax:: ast;
41
40
use syntax:: attr;
@@ -47,7 +46,6 @@ use rustc_back::target::Target;
47
46
use hir;
48
47
use hir:: intravisit:: Visitor ;
49
48
50
- pub use self :: DefLike :: { DlDef , DlField , DlImpl } ;
51
49
pub use self :: NativeLibraryKind :: { NativeStatic , NativeFramework , NativeUnknown } ;
52
50
53
51
// lonely orphan structs and enums looking for a better home
@@ -67,27 +65,17 @@ pub struct CrateSource {
67
65
pub cnum : CrateNum ,
68
66
}
69
67
70
- #[ derive( Copy , Debug , PartialEq , Clone ) ]
68
+ #[ derive( Copy , Debug , PartialEq , Clone , RustcEncodable , RustcDecodable ) ]
71
69
pub enum LinkagePreference {
72
70
RequireDynamic ,
73
71
RequireStatic ,
74
72
}
75
73
76
- enum_from_u32 ! {
77
- #[ derive( Copy , Clone , PartialEq , Eq , PartialOrd , Ord , Hash ) ]
78
- pub enum NativeLibraryKind {
79
- NativeStatic , // native static library (.a archive)
80
- NativeFramework , // OSX-specific
81
- NativeUnknown , // default way to specify a dynamic library
82
- }
83
- }
84
-
85
- // Something that a name can resolve to.
86
- #[ derive( Copy , Clone , Debug ) ]
87
- pub enum DefLike {
88
- DlDef ( Def ) ,
89
- DlImpl ( DefId ) ,
90
- DlField
74
+ #[ derive( Copy , Clone , PartialEq , Eq , PartialOrd , Ord , Hash , RustcEncodable , RustcDecodable ) ]
75
+ pub enum NativeLibraryKind {
76
+ NativeStatic , // native static library (.a archive)
77
+ NativeFramework , // OSX-specific
78
+ NativeUnknown , // default way to specify a dynamic library
91
79
}
92
80
93
81
/// The data we save and restore about an inlined item or method. This is not
@@ -110,7 +98,7 @@ pub enum InlinedItemRef<'a> {
110
98
111
99
#[ derive( Copy , Clone ) ]
112
100
pub struct ChildItem {
113
- pub def : DefLike ,
101
+ pub def : Def ,
114
102
pub name : ast:: Name ,
115
103
pub vis : ty:: Visibility ,
116
104
}
@@ -166,21 +154,15 @@ pub trait CrateStore<'tcx> {
166
154
fn inherent_implementations_for_type ( & self , def_id : DefId ) -> Vec < DefId > ;
167
155
168
156
// trait info
169
- fn implementations_of_trait ( & self , def_id : DefId ) -> Vec < DefId > ;
170
- fn provided_trait_methods < ' a > ( & self , tcx : TyCtxt < ' a , ' tcx , ' tcx > , def : DefId )
171
- -> Vec < Rc < ty:: Method < ' tcx > > > ;
172
- fn trait_item_def_ids ( & self , def : DefId )
173
- -> Vec < ty:: ImplOrTraitItemId > ;
157
+ fn implementations_of_trait ( & self , filter : Option < DefId > ) -> Vec < DefId > ;
174
158
175
159
// impl info
176
- fn impl_items ( & self , impl_def_id : DefId ) -> Vec < ty:: ImplOrTraitItemId > ;
160
+ fn impl_or_trait_items ( & self , def_id : DefId ) -> Vec < ty:: ImplOrTraitItemId > ;
177
161
fn impl_trait_ref < ' a > ( & self , tcx : TyCtxt < ' a , ' tcx , ' tcx > , def : DefId )
178
162
-> Option < ty:: TraitRef < ' tcx > > ;
179
- fn impl_polarity ( & self , def : DefId ) -> Option < hir:: ImplPolarity > ;
163
+ fn impl_polarity ( & self , def : DefId ) -> hir:: ImplPolarity ;
180
164
fn custom_coerce_unsized_kind ( & self , def : DefId )
181
165
-> Option < ty:: adjustment:: CustomCoerceUnsized > ;
182
- fn associated_consts < ' a > ( & self , tcx : TyCtxt < ' a , ' tcx , ' tcx > , def : DefId )
183
- -> Vec < Rc < ty:: AssociatedConst < ' tcx > > > ;
184
166
fn impl_parent ( & self , impl_def_id : DefId ) -> Option < DefId > ;
185
167
186
168
// trait/impl-item info
@@ -191,12 +173,10 @@ pub trait CrateStore<'tcx> {
191
173
// flags
192
174
fn is_const_fn ( & self , did : DefId ) -> bool ;
193
175
fn is_defaulted_trait ( & self , did : DefId ) -> bool ;
194
- fn is_impl ( & self , did : DefId ) -> bool ;
195
176
fn is_default_impl ( & self , impl_did : DefId ) -> bool ;
196
177
fn is_extern_item < ' a > ( & self , tcx : TyCtxt < ' a , ' tcx , ' tcx > , did : DefId ) -> bool ;
197
178
fn is_foreign_item ( & self , did : DefId ) -> bool ;
198
179
fn is_statically_included_foreign_item ( & self , id : ast:: NodeId ) -> bool ;
199
- fn is_typedef ( & self , did : DefId ) -> bool ;
200
180
201
181
// crate metadata
202
182
fn dylib_dependency_formats ( & self , cnum : CrateNum )
@@ -218,8 +198,6 @@ pub trait CrateStore<'tcx> {
218
198
fn original_crate_name ( & self , cnum : CrateNum ) -> InternedString ;
219
199
fn crate_hash ( & self , cnum : CrateNum ) -> Svh ;
220
200
fn crate_disambiguator ( & self , cnum : CrateNum ) -> InternedString ;
221
- fn crate_struct_field_attrs ( & self , cnum : CrateNum )
222
- -> FnvHashMap < DefId , Vec < ast:: Attribute > > ;
223
201
fn plugin_registrar_fn ( & self , cnum : CrateNum ) -> Option < DefId > ;
224
202
fn native_libraries ( & self , cnum : CrateNum ) -> Vec < ( NativeLibraryKind , String ) > ;
225
203
fn reachable_ids ( & self , cnum : CrateNum ) -> Vec < DefId > ;
@@ -232,12 +210,10 @@ pub trait CrateStore<'tcx> {
232
210
-> Option < DefIndex > ;
233
211
fn def_key ( & self , def : DefId ) -> hir_map:: DefKey ;
234
212
fn relative_def_path ( & self , def : DefId ) -> Option < hir_map:: DefPath > ;
235
- fn variant_kind ( & self , def_id : DefId ) -> Option < VariantKind > ;
236
213
fn struct_ctor_def_id ( & self , struct_def_id : DefId ) -> Option < DefId > ;
237
214
fn tuple_struct_definition_if_ctor ( & self , did : DefId ) -> Option < DefId > ;
238
215
fn struct_field_names ( & self , def : DefId ) -> Vec < ast:: Name > ;
239
216
fn item_children ( & self , did : DefId ) -> Vec < ChildItem > ;
240
- fn crate_top_level_items ( & self , cnum : CrateNum ) -> Vec < ChildItem > ;
241
217
242
218
// misc. metadata
243
219
fn maybe_get_item_ast < ' a > ( & ' tcx self , tcx : TyCtxt < ' a , ' tcx , ' tcx > , def : DefId )
@@ -344,11 +320,7 @@ impl<'tcx> CrateStore<'tcx> for DummyCrateStore {
344
320
fn inherent_implementations_for_type ( & self , def_id : DefId ) -> Vec < DefId > { vec ! [ ] }
345
321
346
322
// trait info
347
- fn implementations_of_trait ( & self , def_id : DefId ) -> Vec < DefId > { vec ! [ ] }
348
- fn provided_trait_methods < ' a > ( & self , tcx : TyCtxt < ' a , ' tcx , ' tcx > , def : DefId )
349
- -> Vec < Rc < ty:: Method < ' tcx > > > { bug ! ( "provided_trait_methods" ) }
350
- fn trait_item_def_ids ( & self , def : DefId )
351
- -> Vec < ty:: ImplOrTraitItemId > { bug ! ( "trait_item_def_ids" ) }
323
+ fn implementations_of_trait ( & self , filter : Option < DefId > ) -> Vec < DefId > { vec ! [ ] }
352
324
fn def_index_for_def_key ( & self ,
353
325
cnum : CrateNum ,
354
326
def : DefKey )
@@ -357,16 +329,14 @@ impl<'tcx> CrateStore<'tcx> for DummyCrateStore {
357
329
}
358
330
359
331
// impl info
360
- fn impl_items ( & self , impl_def_id : DefId ) -> Vec < ty:: ImplOrTraitItemId >
361
- { bug ! ( "impl_items " ) }
332
+ fn impl_or_trait_items ( & self , def_id : DefId ) -> Vec < ty:: ImplOrTraitItemId >
333
+ { bug ! ( "impl_or_trait_items " ) }
362
334
fn impl_trait_ref < ' a > ( & self , tcx : TyCtxt < ' a , ' tcx , ' tcx > , def : DefId )
363
335
-> Option < ty:: TraitRef < ' tcx > > { bug ! ( "impl_trait_ref" ) }
364
- fn impl_polarity ( & self , def : DefId ) -> Option < hir:: ImplPolarity > { bug ! ( "impl_polarity" ) }
336
+ fn impl_polarity ( & self , def : DefId ) -> hir:: ImplPolarity { bug ! ( "impl_polarity" ) }
365
337
fn custom_coerce_unsized_kind ( & self , def : DefId )
366
338
-> Option < ty:: adjustment:: CustomCoerceUnsized >
367
339
{ bug ! ( "custom_coerce_unsized_kind" ) }
368
- fn associated_consts < ' a > ( & self , tcx : TyCtxt < ' a , ' tcx , ' tcx > , def : DefId )
369
- -> Vec < Rc < ty:: AssociatedConst < ' tcx > > > { bug ! ( "associated_consts" ) }
370
340
fn impl_parent ( & self , def : DefId ) -> Option < DefId > { bug ! ( "impl_parent" ) }
371
341
372
342
// trait/impl-item info
@@ -377,13 +347,11 @@ impl<'tcx> CrateStore<'tcx> for DummyCrateStore {
377
347
// flags
378
348
fn is_const_fn ( & self , did : DefId ) -> bool { bug ! ( "is_const_fn" ) }
379
349
fn is_defaulted_trait ( & self , did : DefId ) -> bool { bug ! ( "is_defaulted_trait" ) }
380
- fn is_impl ( & self , did : DefId ) -> bool { bug ! ( "is_impl" ) }
381
350
fn is_default_impl ( & self , impl_did : DefId ) -> bool { bug ! ( "is_default_impl" ) }
382
351
fn is_extern_item < ' a > ( & self , tcx : TyCtxt < ' a , ' tcx , ' tcx > , did : DefId ) -> bool
383
352
{ bug ! ( "is_extern_item" ) }
384
353
fn is_foreign_item ( & self , did : DefId ) -> bool { bug ! ( "is_foreign_item" ) }
385
354
fn is_statically_included_foreign_item ( & self , id : ast:: NodeId ) -> bool { false }
386
- fn is_typedef ( & self , did : DefId ) -> bool { bug ! ( "is_typedef" ) }
387
355
388
356
// crate metadata
389
357
fn dylib_dependency_formats ( & self , cnum : CrateNum )
@@ -411,9 +379,6 @@ impl<'tcx> CrateStore<'tcx> for DummyCrateStore {
411
379
fn crate_hash ( & self , cnum : CrateNum ) -> Svh { bug ! ( "crate_hash" ) }
412
380
fn crate_disambiguator ( & self , cnum : CrateNum )
413
381
-> InternedString { bug ! ( "crate_disambiguator" ) }
414
- fn crate_struct_field_attrs ( & self , cnum : CrateNum )
415
- -> FnvHashMap < DefId , Vec < ast:: Attribute > >
416
- { bug ! ( "crate_struct_field_attrs" ) }
417
382
fn plugin_registrar_fn ( & self , cnum : CrateNum ) -> Option < DefId >
418
383
{ bug ! ( "plugin_registrar_fn" ) }
419
384
fn native_libraries ( & self , cnum : CrateNum ) -> Vec < ( NativeLibraryKind , String ) >
@@ -426,15 +391,12 @@ impl<'tcx> CrateStore<'tcx> for DummyCrateStore {
426
391
fn relative_def_path ( & self , def : DefId ) -> Option < hir_map:: DefPath > {
427
392
bug ! ( "relative_def_path" )
428
393
}
429
- fn variant_kind ( & self , def_id : DefId ) -> Option < VariantKind > { bug ! ( "variant_kind" ) }
430
394
fn struct_ctor_def_id ( & self , struct_def_id : DefId ) -> Option < DefId >
431
395
{ bug ! ( "struct_ctor_def_id" ) }
432
396
fn tuple_struct_definition_if_ctor ( & self , did : DefId ) -> Option < DefId >
433
397
{ bug ! ( "tuple_struct_definition_if_ctor" ) }
434
398
fn struct_field_names ( & self , def : DefId ) -> Vec < ast:: Name > { bug ! ( "struct_field_names" ) }
435
399
fn item_children ( & self , did : DefId ) -> Vec < ChildItem > { bug ! ( "item_children" ) }
436
- fn crate_top_level_items ( & self , cnum : CrateNum ) -> Vec < ChildItem >
437
- { bug ! ( "crate_top_level_items" ) }
438
400
439
401
// misc. metadata
440
402
fn maybe_get_item_ast < ' a > ( & ' tcx self , tcx : TyCtxt < ' a , ' tcx , ' tcx > , def : DefId )
0 commit comments