@@ -80,7 +80,6 @@ use std::c_str::ToCStr;
8080use std:: cell:: { Cell , RefCell } ;
8181use std:: rc:: Rc ;
8282use std:: { i8, i16, i32, i64} ;
83- use std:: gc:: Gc ;
8483use syntax:: abi:: { X86 , X86_64 , Arm , Mips , Mipsel , Rust , RustCall } ;
8584use syntax:: abi:: { RustIntrinsic , Abi } ;
8685use syntax:: ast_util:: { local_def, is_local} ;
@@ -1815,31 +1814,6 @@ fn trans_enum_variant_or_tuple_like_struct(ccx: &CrateContext,
18151814 finish_fn( & fcx, bcx, result_ty) ;
18161815}
18171816
1818- fn trans_enum_def( ccx: & CrateContext , enum_definition: & ast:: EnumDef ,
1819- sp: Span , id: ast:: NodeId , vi: & [ Rc <ty:: VariantInfo >] ,
1820- i: & mut uint) {
1821- for variant in enum_definition. variants. iter( ) {
1822- let disr_val = vi[ * i] . disr_val;
1823- * i += 1 ;
1824-
1825- match variant. node. kind {
1826- ast:: TupleVariantKind ( ref args) if args. len( ) > 0 => {
1827- let llfn = get_item_val( ccx, variant. node. id) ;
1828- trans_enum_variant( ccx, id, & * * variant, args. as_slice( ) ,
1829- disr_val, & param_substs:: empty( ) , llfn) ;
1830- }
1831- ast:: TupleVariantKind ( _) => {
1832- // Nothing to do.
1833- }
1834- ast:: StructVariantKind ( struct_def) => {
1835- trans_struct_def( ccx, struct_def) ;
1836- }
1837- }
1838- }
1839-
1840- enum_variant_size_lint( ccx, enum_definition, sp, id) ;
1841- }
1842-
18431817fn enum_variant_size_lint( ccx: & CrateContext , enum_def: & ast:: EnumDef , sp: Span , id: ast:: NodeId ) {
18441818 let mut sizes = Vec :: new( ) ; // does no allocation if no pushes, thankfully
18451819
@@ -1932,12 +1906,8 @@ pub fn trans_item(ccx: &CrateContext, item: &ast::Item) {
19321906 ast:: ItemMod ( ref m) => {
19331907 trans_mod( ccx, m) ;
19341908 }
1935- ast:: ItemEnum ( ref enum_definition, ref generics) => {
1936- if !generics. is_type_parameterized( ) {
1937- let vi = ty:: enum_variants( ccx. tcx( ) , local_def( item. id) ) ;
1938- let mut i = 0 ;
1939- trans_enum_def( ccx, enum_definition, item. span, item. id, vi. as_slice( ) , & mut i) ;
1940- }
1909+ ast:: ItemEnum ( ref enum_definition, _) => {
1910+ enum_variant_size_lint( ccx, enum_definition, item. span, item. id) ;
19411911 }
19421912 ast:: ItemStatic ( _, m, ref expr) => {
19431913 // Recurse on the expression to catch items in blocks
@@ -1964,11 +1934,6 @@ pub fn trans_item(ccx: &CrateContext, item: &ast::Item) {
19641934 ast:: ItemForeignMod ( ref foreign_mod) => {
19651935 foreign:: trans_foreign_mod( ccx, foreign_mod) ;
19661936 }
1967- ast:: ItemStruct ( struct_def, ref generics) => {
1968- if !generics. is_type_parameterized( ) {
1969- trans_struct_def( ccx, struct_def) ;
1970- }
1971- }
19721937 ast:: ItemTrait ( ..) => {
19731938 // Inside of this trait definition, we won't be actually translating any
19741939 // functions, but the trait still needs to be walked. Otherwise default
@@ -1981,20 +1946,6 @@ pub fn trans_item(ccx: &CrateContext, item: &ast::Item) {
19811946 }
19821947}
19831948
1984- pub fn trans_struct_def( ccx: & CrateContext , struct_def: Gc <ast:: StructDef >) {
1985- // If this is a tuple-like struct, translate the constructor.
1986- match struct_def. ctor_id {
1987- // We only need to translate a constructor if there are fields;
1988- // otherwise this is a unit-like struct.
1989- Some ( ctor_id) if struct_def. fields. len( ) > 0 => {
1990- let llfndecl = get_item_val( ccx, ctor_id) ;
1991- trans_tuple_struct( ccx, struct_def. fields. as_slice( ) ,
1992- ctor_id, & param_substs:: empty( ) , llfndecl) ;
1993- }
1994- Some ( _) | None => { }
1995- }
1996- }
1997-
19981949// Translate a module. Doing this amounts to translating the items in the
19991950// module; there ends up being no artifact (aside from linkage names) of
20001951// separate modules in the compiled program. That's because modules exist
0 commit comments