@@ -57,7 +57,7 @@ use hir_def::{
5757} ;
5858use hir_expand:: { name:: name, MacroCallKind } ;
5959use hir_ty:: {
60- all_super_traits,
60+ all_super_traits, autoderef ,
6161 consteval:: { try_const_usize, unknown_const_as_generic, ConstEvalError , ConstExt } ,
6262 diagnostics:: BodyValidationDiagnostic ,
6363 display:: HexifiedConst ,
@@ -66,10 +66,9 @@ use hir_ty::{
6666 mir:: { self , interpret_mir} ,
6767 primitive:: UintTy ,
6868 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 ,
7372} ;
7473use itertools:: Itertools ;
7574use nameres:: diagnostics:: DefDiagnosticKind ;
@@ -3518,15 +3517,7 @@ impl Type {
35183517 fn autoderef_ < ' a > ( & ' a self , db : & ' a dyn HirDatabase ) -> impl Iterator < Item = Ty > + ' a {
35193518 // There should be no inference vars in types passed here
35203519 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 )
35303521 }
35313522
35323523 // This would be nicer if it just returned an iterator, but that runs into
0 commit comments