@@ -5,8 +5,9 @@ use indexmap::{IndexMap, IndexSet};
55
66use crate :: generics_equivalence:: UnassignedIdGenerator ;
77use crate :: {
8- Array , FunctionPointer , Generic , GenericArgument , GenericLifetimeParameter , Lifetime ,
9- NamedLifetime , PathType , RawPointer , Slice , Tuple , Type , TypeReference ,
8+ Array , FunctionPointer , FunctionPointerInput , Generic , GenericArgument ,
9+ GenericLifetimeParameter , Lifetime , NamedLifetime , PathType , RawPointer , Slice , Tuple , Type ,
10+ TypeReference ,
1011} ;
1112
1213/// A `Type` with canonicalized names for lifetimes and unassigned generic type parameters.
@@ -115,7 +116,10 @@ impl Type {
115116 inputs : fp
116117 . inputs
117118 . iter ( )
118- . map ( |t| t. bind_generic_type_parameters ( bindings) )
119+ . map ( |input| FunctionPointerInput {
120+ name : input. name . clone ( ) ,
121+ type_ : input. type_ . bind_generic_type_parameters ( bindings) ,
122+ } )
119123 . collect ( ) ,
120124 output : fp
121125 . output
@@ -154,7 +158,7 @@ impl Type {
154158 Type :: Array ( a) => a. element_type . is_a_template ( ) ,
155159 Type :: RawPointer ( r) => r. inner . is_a_template ( ) ,
156160 Type :: FunctionPointer ( fp) => {
157- fp. inputs . iter ( ) . any ( |t| t . is_a_template ( ) )
161+ fp. inputs . iter ( ) . any ( |input| input . type_ . is_a_template ( ) )
158162 || fp. output . as_ref ( ) . is_some_and ( |t| t. is_a_template ( ) )
159163 }
160164 Type :: Generic ( _) => true ,
@@ -194,7 +198,7 @@ impl Type {
194198 Type :: RawPointer ( r) => r. inner . _unassigned_generic_type_parameters ( set) ,
195199 Type :: FunctionPointer ( fp) => {
196200 for input in & fp. inputs {
197- input. _unassigned_generic_type_parameters ( set) ;
201+ input. type_ . _unassigned_generic_type_parameters ( set) ;
198202 }
199203 if let Some ( output) = & fp. output {
200204 output. _unassigned_generic_type_parameters ( set) ;
@@ -283,7 +287,11 @@ impl Type {
283287 . inputs
284288 . iter ( )
285289 . zip ( templated_fp. inputs . iter ( ) )
286- . all ( |( concrete, templated) | templated. _is_a_template_for ( concrete, bindings) ) ;
290+ . all ( |( concrete, templated) | {
291+ templated
292+ . type_
293+ . _is_a_template_for ( & concrete. type_ , bindings)
294+ } ) ;
287295 if !inputs_match {
288296 return false ;
289297 }
@@ -385,11 +393,15 @@ impl Type {
385393 if self_fp. inputs . len ( ) != other_fp. inputs . len ( ) {
386394 return false ;
387395 }
388- let inputs_match = self_fp
389- . inputs
390- . iter ( )
391- . zip ( other_fp. inputs . iter ( ) )
392- . all ( |( s, o) | s. _is_equivalent_to ( o, self_id_gen, other_id_gen) ) ;
396+ let inputs_match =
397+ self_fp
398+ . inputs
399+ . iter ( )
400+ . zip ( other_fp. inputs . iter ( ) )
401+ . all ( |( s, o) | {
402+ s. type_
403+ . _is_equivalent_to ( & o. type_ , self_id_gen, other_id_gen)
404+ } ) ;
393405 if !inputs_match {
394406 return false ;
395407 }
@@ -445,7 +457,7 @@ impl Type {
445457 Type :: FunctionPointer ( fp) => {
446458 fp. inputs
447459 . iter ( )
448- . any ( |t| t . has_implicit_lifetime_parameters ( ) )
460+ . any ( |input| input . type_ . has_implicit_lifetime_parameters ( ) )
449461 || fp
450462 . output
451463 . as_ref ( )
@@ -495,7 +507,9 @@ impl Type {
495507 Type :: RawPointer ( r) => r. inner . set_implicit_lifetimes ( inferred_lifetime) ,
496508 Type :: FunctionPointer ( fp) => {
497509 for input in fp. inputs . iter_mut ( ) {
498- input. set_implicit_lifetimes ( inferred_lifetime. clone ( ) ) ;
510+ input
511+ . type_
512+ . set_implicit_lifetimes ( inferred_lifetime. clone ( ) ) ;
499513 }
500514 if let Some ( output) = fp. output . as_mut ( ) {
501515 output. set_implicit_lifetimes ( inferred_lifetime) ;
@@ -553,7 +567,7 @@ impl Type {
553567 }
554568 Type :: FunctionPointer ( fp) => {
555569 for input in fp. inputs . iter_mut ( ) {
556- input. rename_lifetime_parameters ( original2renamed) ;
570+ input. type_ . rename_lifetime_parameters ( original2renamed) ;
557571 }
558572 if let Some ( output) = fp. output . as_mut ( ) {
559573 output. rename_lifetime_parameters ( original2renamed) ;
@@ -598,7 +612,7 @@ impl Type {
598612 Type :: RawPointer ( r) => r. inner . _lifetime_parameters ( set) ,
599613 Type :: FunctionPointer ( fp) => {
600614 for input in & fp. inputs {
601- input. _lifetime_parameters ( set) ;
615+ input. type_ . _lifetime_parameters ( set) ;
602616 }
603617 if let Some ( output) = & fp. output {
604618 output. _lifetime_parameters ( set) ;
@@ -651,7 +665,7 @@ impl Type {
651665 Type :: RawPointer ( r) => r. inner . _named_lifetime_parameters ( set) ,
652666 Type :: FunctionPointer ( fp) => {
653667 for input in & fp. inputs {
654- input. _named_lifetime_parameters ( set) ;
668+ input. type_ . _named_lifetime_parameters ( set) ;
655669 }
656670 if let Some ( output) = & fp. output {
657671 output. _named_lifetime_parameters ( set) ;
@@ -810,7 +824,14 @@ impl Type {
810824 inputs : fp
811825 . inputs
812826 . iter ( )
813- . map ( |t| t. _canonicalize ( lifetime_counter, generic_counter, generic_name_map) )
827+ . map ( |input| FunctionPointerInput {
828+ name : None ,
829+ type_ : input. type_ . _canonicalize (
830+ lifetime_counter,
831+ generic_counter,
832+ generic_name_map,
833+ ) ,
834+ } )
814835 . collect ( ) ,
815836 output : fp. output . as_ref ( ) . map ( |t| {
816837 Box :: new ( t. _canonicalize ( lifetime_counter, generic_counter, generic_name_map) )
0 commit comments