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 @@ -1647,16 +1647,16 @@ impl Type {
1647
1647
}
1648
1648
}
1649
1649
1650
- pub ( crate ) fn generics ( & self ) -> Option < Vec < & Type > > {
1650
+ pub ( crate ) fn generic_args ( & self ) -> Option < & GenericArgs > {
1651
1651
match self {
1652
- Type :: Path { path, .. } => path. generics ( ) ,
1652
+ Type :: Path { path, .. } => path. generic_args ( ) ,
1653
1653
_ => None ,
1654
1654
}
1655
1655
}
1656
1656
1657
- pub ( crate ) fn bindings ( & self ) -> Option < & [ TypeBinding ] > {
1657
+ pub ( crate ) fn generics ( & self ) -> Option < Vec < & Type > > {
1658
1658
match self {
1659
- Type :: Path { path, .. } => path. bindings ( ) ,
1659
+ Type :: Path { path, .. } => path. generics ( ) ,
1660
1660
_ => None ,
1661
1661
}
1662
1662
}
@@ -2194,6 +2194,10 @@ impl Path {
2194
2194
}
2195
2195
}
2196
2196
2197
+ pub ( crate ) fn generic_args ( & self ) -> Option < & GenericArgs > {
2198
+ self . segments . last ( ) . map ( |seg| & seg. args )
2199
+ }
2200
+
2197
2201
pub ( crate ) fn generics ( & self ) -> Option < Vec < & Type > > {
2198
2202
self . segments . last ( ) . and_then ( |seg| {
2199
2203
if let GenericArgs :: AngleBracketed { ref args, .. } = seg. args {
Original file line number Diff line number Diff line change @@ -805,25 +805,15 @@ fn simplify_fn_type<'tcx, 'a>(
805
805
// we will look for them but not for `T`).
806
806
let mut ty_generics = Vec :: new ( ) ;
807
807
let mut ty_bindings = Vec :: new ( ) ;
808
- for binding in arg. bindings ( ) . unwrap_or_default ( ) {
809
- simplify_fn_binding (
810
- self_,
811
- generics,
812
- binding,
813
- tcx,
814
- recurse + 1 ,
815
- & mut ty_bindings,
816
- rgen,
817
- is_return,
818
- cache,
819
- ) ;
820
- }
821
- if let Some ( arg_generics) = arg. generics ( ) {
822
- for gen in arg_generics. iter ( ) {
808
+ if let Some ( arg_generics) = arg. generic_args ( ) {
809
+ for ty in arg_generics. into_iter ( ) . filter_map ( |gen| match gen {
810
+ clean:: GenericArg :: Type ( ty) => Some ( ty) ,
811
+ _ => None ,
812
+ } ) {
823
813
simplify_fn_type (
824
814
self_,
825
815
generics,
826
- gen ,
816
+ & ty ,
827
817
tcx,
828
818
recurse + 1 ,
829
819
& mut ty_generics,
@@ -832,6 +822,19 @@ fn simplify_fn_type<'tcx, 'a>(
832
822
cache,
833
823
) ;
834
824
}
825
+ for binding in arg_generics. bindings ( ) {
826
+ simplify_fn_binding (
827
+ self_,
828
+ generics,
829
+ & binding,
830
+ tcx,
831
+ recurse + 1 ,
832
+ & mut ty_bindings,
833
+ rgen,
834
+ is_return,
835
+ cache,
836
+ ) ;
837
+ }
835
838
}
836
839
// Every trait associated type on self gets assigned to a type parameter index
837
840
// this same one is used later for any appearances of these types
You can’t perform that action at this time.
0 commit comments