@@ -317,6 +317,7 @@ pub enum Type {
317317 Path ( GenericPath ) ,
318318 Primitive ( PrimitiveType ) ,
319319 Array ( Box < Type > , ConstExpr ) ,
320+ FlexibleArray ( Box < Type > ) ,
320321 FuncPtr {
321322 ret : Box < Type > ,
322323 args : Vec < ( Option < String > , Type ) > ,
@@ -583,7 +584,9 @@ impl Type {
583584
584585 fn visit_types ( & mut self , mut visitor : impl FnMut ( & mut Type ) ) {
585586 match * self {
586- Type :: Array ( ref mut ty, ..) | Type :: Ptr { ref mut ty, .. } => visitor ( ty) ,
587+ Type :: Array ( ref mut ty, ..)
588+ | Type :: FlexibleArray ( ref mut ty)
589+ | Type :: Ptr { ref mut ty, .. } => visitor ( ty) ,
587590 Type :: Path ( ref mut path) => {
588591 for generic in path. generics_mut ( ) {
589592 match * generic {
@@ -617,7 +620,7 @@ impl Type {
617620 Type :: Primitive ( ..) => {
618621 return None ;
619622 }
620- Type :: Array ( ..) => {
623+ Type :: Array ( ..) | Type :: FlexibleArray ( .. ) => {
621624 return None ;
622625 }
623626 Type :: FuncPtr { .. } => {
@@ -664,6 +667,7 @@ impl Type {
664667 Box :: new ( ty. specialize ( mappings) ) ,
665668 constant. specialize ( mappings) ,
666669 ) ,
670+ Type :: FlexibleArray ( ref ty) => Type :: FlexibleArray ( Box :: new ( ty. specialize ( mappings) ) ) ,
667671 Type :: FuncPtr {
668672 ref ret,
669673 ref args,
@@ -721,7 +725,7 @@ impl Type {
721725 }
722726 }
723727 Type :: Primitive ( _) => { }
724- Type :: Array ( ref ty, _) => {
728+ Type :: Array ( ref ty, _) | Type :: FlexibleArray ( ref ty ) => {
725729 ty. add_dependencies_ignoring_generics ( generic_params, library, out) ;
726730 }
727731 Type :: FuncPtr {
@@ -757,7 +761,7 @@ impl Type {
757761 }
758762 }
759763 Type :: Primitive ( _) => { }
760- Type :: Array ( ref ty, _) => {
764+ Type :: Array ( ref ty, _) | Type :: FlexibleArray ( ref ty ) => {
761765 ty. add_monomorphs ( library, out) ;
762766 }
763767 Type :: FuncPtr {
@@ -784,6 +788,9 @@ impl Type {
784788 ty. rename_for_config ( config, generic_params) ;
785789 len. rename_for_config ( config) ;
786790 }
791+ Type :: FlexibleArray ( ref mut ty) => {
792+ ty. rename_for_config ( config, generic_params) ;
793+ }
787794 Type :: FuncPtr {
788795 ref mut ret,
789796 ref mut args,
@@ -806,7 +813,7 @@ impl Type {
806813 generic_path. resolve_declaration_types ( resolver) ;
807814 }
808815 Type :: Primitive ( _) => { }
809- Type :: Array ( ref mut ty, _) => {
816+ Type :: Array ( ref mut ty, _) | Type :: FlexibleArray ( ref mut ty ) => {
810817 ty. resolve_declaration_types ( resolver) ;
811818 }
812819 Type :: FuncPtr {
@@ -843,7 +850,7 @@ impl Type {
843850 }
844851 }
845852 Type :: Primitive ( _) => { }
846- Type :: Array ( ref mut ty, _) => {
853+ Type :: Array ( ref mut ty, _) | Type :: FlexibleArray ( ref mut ty ) => {
847854 ty. mangle_paths ( monomorphs) ;
848855 }
849856 Type :: FuncPtr {
@@ -866,6 +873,7 @@ impl Type {
866873 Type :: Path ( ..) => true ,
867874 Type :: Primitive ( ref p) => p. can_cmp_order ( ) ,
868875 Type :: Array ( ..) => false ,
876+ Type :: FlexibleArray ( ..) => false ,
869877 Type :: FuncPtr { .. } => false ,
870878 }
871879 }
@@ -876,6 +884,7 @@ impl Type {
876884 Type :: Path ( ..) => true ,
877885 Type :: Primitive ( ref p) => p. can_cmp_eq ( ) ,
878886 Type :: Array ( ..) => false ,
887+ Type :: FlexibleArray ( ..) => false ,
879888 Type :: FuncPtr { .. } => true ,
880889 }
881890 }
0 commit comments