@@ -14,8 +14,8 @@ use log::{info, warn};
14
14
15
15
use crate :: {
16
16
db:: HirDatabase , static_lifetime, AliasEq , AliasTy , BoundVar , Canonical , CanonicalVarKinds ,
17
- DebruijnIndex , Environment , InEnvironment , Interner , ProjectionTyExt , Solution , Substitution ,
18
- Ty , TyBuilder , TyKind ,
17
+ ConstrainedSubst , DebruijnIndex , Environment , Guidance , InEnvironment , Interner ,
18
+ ProjectionTyExt , Solution , Substitution , Ty , TyBuilder , TyKind ,
19
19
} ;
20
20
21
21
const AUTODEREF_RECURSION_LIMIT : Limit = Limit :: new ( 10 ) ;
@@ -187,7 +187,8 @@ fn deref_by_trait(
187
187
let solution = db. trait_solve ( krate, canonical) ?;
188
188
189
189
match & solution {
190
- Solution :: Unique ( vars) => {
190
+ Solution :: Unique ( Canonical { value : ConstrainedSubst { subst, .. } , binders } )
191
+ | Solution :: Ambig ( Guidance :: Definite ( Canonical { value : subst, binders } ) ) => {
191
192
// FIXME: vars may contain solutions for any inference variables
192
193
// that happened to be inside ty. To correctly handle these, we
193
194
// would have to pass the solution up to the inference context, but
@@ -203,8 +204,8 @@ fn deref_by_trait(
203
204
// assumptions will be broken. We would need to properly introduce
204
205
// new variables in that case
205
206
206
- for i in 1 ..vars . binders . len ( & Interner ) {
207
- if vars . value . subst . at ( & Interner , i - 1 ) . assert_ty_ref ( & Interner ) . kind ( & Interner )
207
+ for i in 1 ..binders. len ( & Interner ) {
208
+ if subst. at ( & Interner , i - 1 ) . assert_ty_ref ( & Interner ) . kind ( & Interner )
208
209
!= & TyKind :: BoundVar ( BoundVar :: new ( DebruijnIndex :: INNERMOST , i - 1 ) )
209
210
{
210
211
warn ! ( "complex solution for derefing {:?}: {:?}, ignoring" , ty. goal, solution) ;
@@ -214,13 +215,11 @@ fn deref_by_trait(
214
215
// FIXME: we remove lifetime variables here since they can confuse
215
216
// the method resolution code later
216
217
Some ( fixup_lifetime_variables ( Canonical {
217
- value : vars
218
- . value
219
- . subst
220
- . at ( & Interner , vars. value . subst . len ( & Interner ) - 1 )
218
+ value : subst
219
+ . at ( & Interner , subst. len ( & Interner ) - 1 )
221
220
. assert_ty_ref ( & Interner )
222
221
. clone ( ) ,
223
- binders : vars . binders . clone ( ) ,
222
+ binders : binders. clone ( ) ,
224
223
} ) )
225
224
}
226
225
Solution :: Ambig ( _) => {
0 commit comments