@@ -80,7 +80,6 @@ use std::c_str::ToCStr;
80
80
use std:: cell:: { Cell , RefCell } ;
81
81
use std:: rc:: Rc ;
82
82
use std:: { i8, i16, i32, i64} ;
83
- use std:: gc:: Gc ;
84
83
use syntax:: abi:: { X86 , X86_64 , Arm , Mips , Mipsel , Rust , RustCall } ;
85
84
use syntax:: abi:: { RustIntrinsic , Abi } ;
86
85
use syntax:: ast_util:: { local_def, is_local} ;
@@ -1815,31 +1814,6 @@ fn trans_enum_variant_or_tuple_like_struct(ccx: &CrateContext,
1815
1814
finish_fn( & fcx, bcx, result_ty) ;
1816
1815
}
1817
1816
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
-
1843
1817
fn enum_variant_size_lint( ccx: & CrateContext , enum_def: & ast:: EnumDef , sp: Span , id: ast:: NodeId ) {
1844
1818
let mut sizes = Vec :: new( ) ; // does no allocation if no pushes, thankfully
1845
1819
@@ -1932,12 +1906,8 @@ pub fn trans_item(ccx: &CrateContext, item: &ast::Item) {
1932
1906
ast:: ItemMod ( ref m) => {
1933
1907
trans_mod( ccx, m) ;
1934
1908
}
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) ;
1941
1911
}
1942
1912
ast:: ItemStatic ( _, m, ref expr) => {
1943
1913
// Recurse on the expression to catch items in blocks
@@ -1964,11 +1934,6 @@ pub fn trans_item(ccx: &CrateContext, item: &ast::Item) {
1964
1934
ast:: ItemForeignMod ( ref foreign_mod) => {
1965
1935
foreign:: trans_foreign_mod( ccx, foreign_mod) ;
1966
1936
}
1967
- ast:: ItemStruct ( struct_def, ref generics) => {
1968
- if !generics. is_type_parameterized( ) {
1969
- trans_struct_def( ccx, struct_def) ;
1970
- }
1971
- }
1972
1937
ast:: ItemTrait ( ..) => {
1973
1938
// Inside of this trait definition, we won't be actually translating any
1974
1939
// functions, but the trait still needs to be walked. Otherwise default
@@ -1981,20 +1946,6 @@ pub fn trans_item(ccx: &CrateContext, item: &ast::Item) {
1981
1946
}
1982
1947
}
1983
1948
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
-
1998
1949
// Translate a module. Doing this amounts to translating the items in the
1999
1950
// module; there ends up being no artifact (aside from linkage names) of
2000
1951
// separate modules in the compiled program. That's because modules exist
0 commit comments