File tree 1 file changed +12
-3
lines changed
1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -95,9 +95,13 @@ pub fn call_callee(
95
95
continue ;
96
96
} ;
97
97
98
- // NOTE: PERFORMANCE: TODO: This could probably be optimized
98
+ // TODO: PERFORMANCE: Optimize this and remove unnecessary cloning.
99
+ // We should really change `match_type` and friends to produce a type match solution
100
+ // instead of modifying the poly catalog.
99
101
let from_env = caller. impl_params . params . iter ( ) . filter ( |( _, param_trait) | {
100
- if catalog
102
+ let mut catalog_plus_match = catalog. clone ( ) ;
103
+
104
+ if catalog_plus_match
101
105
. match_types ( ctx, & expected_trait. args , & param_trait. args )
102
106
. is_err ( )
103
107
{
@@ -108,7 +112,12 @@ pub fn call_callee(
108
112
. resolver ( )
109
113
. resolve_trait ( expected_trait)
110
114
. map_or ( false , |expected_trait| {
111
- param_trait. trait_ref == expected_trait. trait_ref
115
+ if param_trait. trait_ref == expected_trait. trait_ref {
116
+ catalog = catalog_plus_match;
117
+ true
118
+ } else {
119
+ false
120
+ }
112
121
} )
113
122
} ) ;
114
123
You can’t perform that action at this time.
0 commit comments