File tree 2 files changed +27
-20
lines changed
2 files changed +27
-20
lines changed Original file line number Diff line number Diff line change @@ -1625,16 +1625,16 @@ impl Type {
1625
1625
}
1626
1626
}
1627
1627
1628
- pub ( crate ) fn generics ( & self ) -> Option < Vec < & Type > > {
1628
+ pub ( crate ) fn generic_args ( & self ) -> Option < & GenericArgs > {
1629
1629
match self {
1630
- Type :: Path { path, .. } => path. generics ( ) ,
1630
+ Type :: Path { path, .. } => path. generic_args ( ) ,
1631
1631
_ => None ,
1632
1632
}
1633
1633
}
1634
1634
1635
- pub ( crate ) fn bindings ( & self ) -> Option < & [ TypeBinding ] > {
1635
+ pub ( crate ) fn generics ( & self ) -> Option < Vec < & Type > > {
1636
1636
match self {
1637
- Type :: Path { path, .. } => path. bindings ( ) ,
1637
+ Type :: Path { path, .. } => path. generics ( ) ,
1638
1638
_ => None ,
1639
1639
}
1640
1640
}
@@ -2173,6 +2173,10 @@ impl Path {
2173
2173
}
2174
2174
}
2175
2175
2176
+ pub ( crate ) fn generic_args ( & self ) -> Option < & GenericArgs > {
2177
+ self . segments . last ( ) . map ( |seg| & seg. args )
2178
+ }
2179
+
2176
2180
pub ( crate ) fn generics ( & self ) -> Option < Vec < & Type > > {
2177
2181
self . segments . last ( ) . and_then ( |seg| {
2178
2182
if let GenericArgs :: AngleBracketed { ref args, .. } = seg. args {
Original file line number Diff line number Diff line change @@ -776,25 +776,15 @@ fn simplify_fn_type<'tcx, 'a>(
776
776
// we will look for them but not for `T`).
777
777
let mut ty_generics = Vec :: new ( ) ;
778
778
let mut ty_bindings = Vec :: new ( ) ;
779
- for binding in arg. bindings ( ) . unwrap_or_default ( ) {
780
- simplify_fn_binding (
781
- self_,
782
- generics,
783
- binding,
784
- tcx,
785
- recurse + 1 ,
786
- & mut ty_bindings,
787
- rgen,
788
- is_return,
789
- cache,
790
- ) ;
791
- }
792
- if let Some ( arg_generics) = arg. generics ( ) {
793
- for gen in arg_generics. iter ( ) {
779
+ if let Some ( arg_generics) = arg. generic_args ( ) {
780
+ for ty in arg_generics. into_iter ( ) . filter_map ( |gen| match gen {
781
+ clean:: GenericArg :: Type ( ty) => Some ( ty) ,
782
+ _ => None ,
783
+ } ) {
794
784
simplify_fn_type (
795
785
self_,
796
786
generics,
797
- gen ,
787
+ & ty ,
798
788
tcx,
799
789
recurse + 1 ,
800
790
& mut ty_generics,
@@ -803,6 +793,19 @@ fn simplify_fn_type<'tcx, 'a>(
803
793
cache,
804
794
) ;
805
795
}
796
+ for binding in arg_generics. bindings ( ) {
797
+ simplify_fn_binding (
798
+ self_,
799
+ generics,
800
+ & binding,
801
+ tcx,
802
+ recurse + 1 ,
803
+ & mut ty_bindings,
804
+ rgen,
805
+ is_return,
806
+ cache,
807
+ ) ;
808
+ }
806
809
}
807
810
// Every trait associated type on self gets assigned to a type parameter index
808
811
// this same one is used later for any appearances of these types
You can’t perform that action at this time.
0 commit comments