15
15
use llvm;
16
16
use llvm:: { ValueRef , ContextRef , TypeKind } ;
17
17
use llvm:: { True , False , Bool , OperandBundleDef } ;
18
- use rustc:: hir:: def:: Def ;
19
18
use rustc:: hir:: def_id:: DefId ;
20
19
use rustc:: hir:: map:: DefPathData ;
21
20
use rustc:: util:: common:: MemoizationMap ;
@@ -38,7 +37,7 @@ use std::borrow::Cow;
38
37
use std:: iter;
39
38
40
39
use syntax:: ast;
41
- use syntax:: symbol:: { Symbol , InternedString } ;
40
+ use syntax:: symbol:: InternedString ;
42
41
use syntax_pos:: Span ;
43
42
44
43
use rustc_i128:: u128;
@@ -169,55 +168,6 @@ pub fn type_is_zero_size<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, ty: Ty<'tcx>) -
169
168
*
170
169
*/
171
170
172
- use Disr ;
173
-
174
- /// The concrete version of ty::FieldDef. The name is the field index if
175
- /// the field is numeric.
176
- pub struct Field < ' tcx > ( pub ast:: Name , pub Ty < ' tcx > ) ;
177
-
178
- /// The concrete version of ty::VariantDef
179
- pub struct VariantInfo < ' tcx > {
180
- pub discr : Disr ,
181
- pub fields : Vec < Field < ' tcx > >
182
- }
183
-
184
- impl < ' a , ' tcx > VariantInfo < ' tcx > {
185
- pub fn from_ty ( tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
186
- ty : Ty < ' tcx > ,
187
- opt_def : Option < Def > )
188
- -> Self
189
- {
190
- match ty. sty {
191
- ty:: TyAdt ( adt, substs) => {
192
- let variant = match opt_def {
193
- None => adt. struct_variant ( ) ,
194
- Some ( def) => adt. variant_of_def ( def)
195
- } ;
196
-
197
- VariantInfo {
198
- discr : Disr :: from ( variant. disr_val ) ,
199
- fields : variant. fields . iter ( ) . map ( |f| {
200
- Field ( f. name , monomorphize:: field_ty ( tcx, substs, f) )
201
- } ) . collect ( )
202
- }
203
- }
204
-
205
- ty:: TyTuple ( ref v) => {
206
- VariantInfo {
207
- discr : Disr ( 0 ) ,
208
- fields : v. iter ( ) . enumerate ( ) . map ( |( i, & t) | {
209
- Field ( Symbol :: intern ( & i. to_string ( ) ) , t)
210
- } ) . collect ( )
211
- }
212
- }
213
-
214
- _ => {
215
- bug ! ( "cannot get field types from the type {:?}" , ty) ;
216
- }
217
- }
218
- }
219
- }
220
-
221
171
/// A structure representing an active landing pad for the duration of a basic
222
172
/// block.
223
173
///
0 commit comments