@@ -57,7 +57,7 @@ use hir_def::{
57
57
} ;
58
58
use hir_expand:: { name:: name, MacroCallKind } ;
59
59
use hir_ty:: {
60
- all_super_traits,
60
+ all_super_traits, autoderef ,
61
61
consteval:: { try_const_usize, unknown_const_as_generic, ConstEvalError , ConstExt } ,
62
62
diagnostics:: BodyValidationDiagnostic ,
63
63
display:: HexifiedConst ,
@@ -66,10 +66,9 @@ use hir_ty::{
66
66
mir:: { self , interpret_mir} ,
67
67
primitive:: UintTy ,
68
68
traits:: FnTrait ,
69
- AliasTy , Autoderef , CallableDefId , CallableSig , Canonical , CanonicalVarKinds , Cast , ClosureId ,
70
- GenericArgData , InferenceTable , Interner , ParamKind , QuantifiedWhereClause , Scalar ,
71
- Substitution , TraitEnvironment , TraitRefExt , Ty , TyBuilder , TyDefId , TyExt , TyKind ,
72
- WhereClause ,
69
+ AliasTy , CallableDefId , CallableSig , Canonical , CanonicalVarKinds , Cast , ClosureId ,
70
+ GenericArgData , Interner , ParamKind , QuantifiedWhereClause , Scalar , Substitution ,
71
+ TraitEnvironment , TraitRefExt , Ty , TyBuilder , TyDefId , TyExt , TyKind , WhereClause ,
73
72
} ;
74
73
use itertools:: Itertools ;
75
74
use nameres:: diagnostics:: DefDiagnosticKind ;
@@ -3518,15 +3517,7 @@ impl Type {
3518
3517
fn autoderef_ < ' a > ( & ' a self , db : & ' a dyn HirDatabase ) -> impl Iterator < Item = Ty > + ' a {
3519
3518
// There should be no inference vars in types passed here
3520
3519
let canonical = hir_ty:: replace_errors_with_variables ( & self . ty ) ;
3521
-
3522
- let mut table = InferenceTable :: new ( db, self . env . clone ( ) ) ;
3523
- let ty = table. instantiate_canonical ( canonical) ;
3524
- let mut autoderef = Autoderef :: new ( & mut table, ty) ;
3525
- let mut v = Vec :: new ( ) ;
3526
- while let Some ( ( ty, _steps) ) = autoderef. next ( ) {
3527
- v. push ( autoderef. table . canonicalize ( ty) . value ) ;
3528
- }
3529
- v. into_iter ( ) . map ( |canonical| canonical. value )
3520
+ autoderef ( db, self . env . clone ( ) , canonical) . map ( |canonical| canonical. value )
3530
3521
}
3531
3522
3532
3523
// This would be nicer if it just returned an iterator, but that runs into
0 commit comments