@@ -87,8 +87,7 @@ use std::collections::{HashMap, HashSet};
87
87
use rustc_data_structures:: ivar;
88
88
use syntax:: abi;
89
89
use syntax:: ast:: { CrateNum , DefId , ItemImpl , ItemTrait , LOCAL_CRATE } ;
90
- use syntax:: ast:: { MutImmutable , MutMutable , Name , NamedField , NodeId } ;
91
- use syntax:: ast:: { StructField , UnnamedField , Visibility } ;
90
+ use syntax:: ast:: { MutImmutable , MutMutable , Name , NodeId , Visibility } ;
92
91
use syntax:: ast_util:: { self , is_local, local_def} ;
93
92
use syntax:: attr:: { self , AttrMetaMethods , SignedInt , UnsignedInt } ;
94
93
use syntax:: codemap:: Span ;
@@ -112,83 +111,6 @@ pub struct CrateAnalysis {
112
111
pub glob_map : Option < GlobMap > ,
113
112
}
114
113
115
- #[ derive( Copy , Clone , PartialEq , Eq , Hash ) ]
116
- pub struct Field < ' tcx > {
117
- pub name : ast:: Name ,
118
- pub mt : TypeAndMut < ' tcx >
119
- }
120
-
121
- // Enum information
122
- #[ derive( Clone ) ]
123
- pub struct VariantInfo < ' tcx > {
124
- pub args : Vec < Ty < ' tcx > > ,
125
- pub arg_names : Option < Vec < ast:: Name > > ,
126
- pub ctor_ty : Option < Ty < ' tcx > > ,
127
- pub name : ast:: Name ,
128
- pub id : ast:: DefId ,
129
- pub disr_val : Disr ,
130
- pub vis : Visibility
131
- }
132
-
133
- impl < ' tcx > VariantInfo < ' tcx > {
134
-
135
- /// Creates a new VariantInfo from the corresponding ast representation.
136
- ///
137
- /// Does not do any caching of the value in the type context.
138
- pub fn from_ast_variant ( cx : & ctxt < ' tcx > ,
139
- ast_variant : & ast:: Variant ,
140
- discriminant : Disr ) -> VariantInfo < ' tcx > {
141
- let ctor_ty = cx. node_id_to_type ( ast_variant. node . id ) ;
142
-
143
- match ast_variant. node . kind {
144
- ast:: TupleVariantKind ( ref args) => {
145
- let arg_tys = if !args. is_empty ( ) {
146
- // the regions in the argument types come from the
147
- // enum def'n, and hence will all be early bound
148
- cx. no_late_bound_regions ( & ctor_ty. fn_args ( ) ) . unwrap ( )
149
- } else {
150
- Vec :: new ( )
151
- } ;
152
-
153
- return VariantInfo {
154
- args : arg_tys,
155
- arg_names : None ,
156
- ctor_ty : Some ( ctor_ty) ,
157
- name : ast_variant. node . name . name ,
158
- id : ast_util:: local_def ( ast_variant. node . id ) ,
159
- disr_val : discriminant,
160
- vis : ast_variant. node . vis
161
- } ;
162
- } ,
163
- ast:: StructVariantKind ( ref struct_def) => {
164
- let fields: & [ StructField ] = & struct_def. fields ;
165
-
166
- assert ! ( !fields. is_empty( ) ) ;
167
-
168
- let arg_tys = struct_def. fields . iter ( )
169
- . map ( |field| cx. node_id_to_type ( field. node . id ) ) . collect ( ) ;
170
- let arg_names = fields. iter ( ) . map ( |field| {
171
- match field. node . kind {
172
- NamedField ( ident, _) => ident. name ,
173
- UnnamedField ( ..) => cx. sess . bug (
174
- "enum_variants: all fields in struct must have a name" )
175
- }
176
- } ) . collect ( ) ;
177
-
178
- return VariantInfo {
179
- args : arg_tys,
180
- arg_names : Some ( arg_names) ,
181
- ctor_ty : None ,
182
- name : ast_variant. node . name . name ,
183
- id : ast_util:: local_def ( ast_variant. node . id ) ,
184
- disr_val : discriminant,
185
- vis : ast_variant. node . vis
186
- } ;
187
- }
188
- }
189
- }
190
- }
191
-
192
114
#[ derive( Copy , Clone ) ]
193
115
pub enum DtorKind {
194
116
NoDtor ,
@@ -495,14 +417,6 @@ pub struct TypeAndMut<'tcx> {
495
417
pub mutbl : ast:: Mutability ,
496
418
}
497
419
498
- #[ derive( Clone , Copy , Debug ) ]
499
- pub struct FieldTy {
500
- pub name : Name ,
501
- pub id : DefId ,
502
- pub vis : ast:: Visibility ,
503
- pub origin : ast:: DefId , // The DefId of the struct in which the field is declared.
504
- }
505
-
506
420
#[ derive( Clone , PartialEq , RustcDecodable , RustcEncodable ) ]
507
421
pub struct ItemVariances {
508
422
pub types : VecPerParamSpace < Variance > ,
@@ -5668,18 +5582,6 @@ impl<'tcx> ctxt<'tcx> {
5668
5582
}
5669
5583
}
5670
5584
5671
- pub fn field_idx_strict ( & self , name : ast:: Name , fields : & [ Field < ' tcx > ] )
5672
- -> usize {
5673
- let mut i = 0 ;
5674
- for f in fields { if f. name == name { return i; } i += 1 ; }
5675
- self . sess . bug ( & format ! (
5676
- "no field named `{}` found in the list of fields `{:?}`" ,
5677
- name,
5678
- fields. iter( )
5679
- . map( |f| f. name. to_string( ) )
5680
- . collect:: <Vec <String >>( ) ) ) ;
5681
- }
5682
-
5683
5585
pub fn note_and_explain_type_err ( & self , err : & TypeError < ' tcx > , sp : Span ) {
5684
5586
use self :: TypeError :: * ;
5685
5587
@@ -7342,12 +7244,6 @@ impl<'tcx> HasTypeFlags for FnSig<'tcx> {
7342
7244
}
7343
7245
}
7344
7246
7345
- impl < ' tcx > HasTypeFlags for Field < ' tcx > {
7346
- fn has_type_flags ( & self , flags : TypeFlags ) -> bool {
7347
- self . mt . ty . has_type_flags ( flags)
7348
- }
7349
- }
7350
-
7351
7247
impl < ' tcx > HasTypeFlags for BareFnTy < ' tcx > {
7352
7248
fn has_type_flags ( & self , flags : TypeFlags ) -> bool {
7353
7249
self . sig . has_type_flags ( flags)
@@ -7378,12 +7274,6 @@ impl<'tcx> fmt::Debug for ClosureUpvar<'tcx> {
7378
7274
}
7379
7275
}
7380
7276
7381
- impl < ' tcx > fmt:: Debug for Field < ' tcx > {
7382
- fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
7383
- write ! ( f, "field({},{})" , self . name, self . mt)
7384
- }
7385
- }
7386
-
7387
7277
impl < ' a , ' tcx > fmt:: Debug for ParameterEnvironment < ' a , ' tcx > {
7388
7278
fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
7389
7279
write ! ( f, "ParameterEnvironment(\
0 commit comments