@@ -89,13 +89,34 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> {
8989            ty:: FloatTy :: F128  => self . type_f128 ( ) , 
9090        } 
9191    } 
92- } 
9392
94- impl < ' gcc ,  ' tcx >  BaseTypeMethods < ' tcx >  for  CodegenCx < ' gcc ,  ' tcx >  { 
95-     fn  type_i1 ( & self )  -> Type < ' gcc >  { 
93+     pub  fn  type_i1 ( & self )  -> Type < ' gcc >  { 
9694        self . bool_type 
9795    } 
9896
97+     pub  fn  type_struct ( & self ,  fields :  & [ Type < ' gcc > ] ,  packed :  bool )  -> Type < ' gcc >  { 
98+         let  types = fields. to_vec ( ) ; 
99+         if  let  Some ( typ)  = self . struct_types . borrow ( ) . get ( fields)  { 
100+             return  * typ; 
101+         } 
102+         let  fields:  Vec < _ >  = fields
103+             . iter ( ) 
104+             . enumerate ( ) 
105+             . map ( |( index,  field) | { 
106+                 self . context . new_field ( None ,  * field,  format ! ( "field{}_TODO" ,  index) ) 
107+             } ) 
108+             . collect ( ) ; 
109+         let  typ = self . context . new_struct_type ( None ,  "struct" ,  & fields) . as_type ( ) ; 
110+         if  packed { 
111+             #[ cfg( feature = "master" ) ]  
112+             typ. set_packed ( ) ; 
113+         } 
114+         self . struct_types . borrow_mut ( ) . insert ( types,  typ) ; 
115+         typ
116+     } 
117+ } 
118+ 
119+ impl < ' gcc ,  ' tcx >  BaseTypeMethods < ' tcx >  for  CodegenCx < ' gcc ,  ' tcx >  { 
99120    fn  type_i8 ( & self )  -> Type < ' gcc >  { 
100121        self . i8_type 
101122    } 
@@ -131,7 +152,7 @@ impl<'gcc, 'tcx> BaseTypeMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
131152    fn  type_f64 ( & self )  -> Type < ' gcc >  { 
132153        self . double_type 
133154    } 
134-      
155+ 
135156    fn  type_f128 ( & self )  -> Type < ' gcc >  { 
136157        unimplemented ! ( "f16_f128" ) 
137158    } 
@@ -140,27 +161,6 @@ impl<'gcc, 'tcx> BaseTypeMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
140161        self . context . new_function_pointer_type ( None ,  return_type,  params,  false ) 
141162    } 
142163
143-     fn  type_struct ( & self ,  fields :  & [ Type < ' gcc > ] ,  packed :  bool )  -> Type < ' gcc >  { 
144-         let  types = fields. to_vec ( ) ; 
145-         if  let  Some ( typ)  = self . struct_types . borrow ( ) . get ( fields)  { 
146-             return  * typ; 
147-         } 
148-         let  fields:  Vec < _ >  = fields
149-             . iter ( ) 
150-             . enumerate ( ) 
151-             . map ( |( index,  field) | { 
152-                 self . context . new_field ( None ,  * field,  format ! ( "field{}_TODO" ,  index) ) 
153-             } ) 
154-             . collect ( ) ; 
155-         let  typ = self . context . new_struct_type ( None ,  "struct" ,  & fields) . as_type ( ) ; 
156-         if  packed { 
157-             #[ cfg( feature = "master" ) ]  
158-             typ. set_packed ( ) ; 
159-         } 
160-         self . struct_types . borrow_mut ( ) . insert ( types,  typ) ; 
161-         typ
162-     } 
163- 
164164    fn  type_kind ( & self ,  typ :  Type < ' gcc > )  -> TypeKind  { 
165165        if  self . is_int_type_or_bool ( typ)  { 
166166            TypeKind :: Integer 
0 commit comments