@@ -2624,61 +2624,6 @@ pub fn type_is_machine(ty: t) -> bool {
2624
2624
}
2625
2625
}
2626
2626
2627
- // Whether a type is Plain Old Data -- meaning it does not contain pointers
2628
- // that the cycle collector might care about.
2629
- pub fn type_is_pod ( cx : ctxt , ty : t ) -> bool {
2630
- let mut result = true ;
2631
- match get ( ty) . sty {
2632
- // Scalar types
2633
- ty_nil | ty_bot | ty_bool | ty_char | ty_int( _) | ty_float( _) | ty_uint( _) |
2634
- ty_ptr( _) | ty_bare_fn( _) => result = true ,
2635
- // Boxed types
2636
- ty_box( _) | ty_uniq( _) | ty_closure( _) |
2637
- ty_str( vstore_uniq) |
2638
- ty_vec( _, vstore_uniq) |
2639
- ty_trait( _, _, _, _, _) | ty_rptr( _, _) => result = false ,
2640
- // Structural types
2641
- ty_enum( did, ref substs) => {
2642
- let variants = enum_variants ( cx, did) ;
2643
- for variant in ( * variants) . iter ( ) {
2644
- // FIXME(pcwalton): This is an inefficient way to do this. Don't
2645
- // synthesize a tuple!
2646
- //
2647
- // Perform any type parameter substitutions.
2648
- let tup_ty = mk_tup ( cx, variant. args . clone ( ) ) ;
2649
- let tup_ty = subst ( cx, substs, tup_ty) ;
2650
- if !type_is_pod ( cx, tup_ty) { result = false ; }
2651
- }
2652
- }
2653
- ty_tup( ref elts) => {
2654
- for elt in elts. iter ( ) { if !type_is_pod ( cx, * elt) { result = false ; } }
2655
- }
2656
- ty_str( vstore_fixed( _) ) => result = true ,
2657
- ty_vec( ref mt, vstore_fixed( _) ) | ty_unboxed_vec( ref mt) => {
2658
- result = type_is_pod ( cx, mt. ty ) ;
2659
- }
2660
- ty_param( _) => result = false ,
2661
- ty_struct( did, ref substs) => {
2662
- let fields = lookup_struct_fields ( cx, did) ;
2663
- result = fields. iter ( ) . all ( |f| {
2664
- let fty = ty:: lookup_item_type ( cx, f. id ) ;
2665
- let sty = subst ( cx, substs, fty. ty ) ;
2666
- type_is_pod ( cx, sty)
2667
- } ) ;
2668
- }
2669
-
2670
- ty_str( vstore_slice( ..) ) | ty_vec( _, vstore_slice( ..) ) => {
2671
- result = false ;
2672
- }
2673
-
2674
- ty_infer( ..) | ty_self( ..) | ty_err => {
2675
- cx. sess . bug ( "non concrete type in type_is_pod" ) ;
2676
- }
2677
- }
2678
-
2679
- return result;
2680
- }
2681
-
2682
2627
pub fn type_is_enum ( ty : t ) -> bool {
2683
2628
match get ( ty) . sty {
2684
2629
ty_enum( _, _) => return true ,
0 commit comments