diff options
Diffstat (limited to 'crates/hir_ty/src/method_resolution.rs')
-rw-r--r-- | crates/hir_ty/src/method_resolution.rs | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/crates/hir_ty/src/method_resolution.rs b/crates/hir_ty/src/method_resolution.rs index 7e09a1539..be3e4f09a 100644 --- a/crates/hir_ty/src/method_resolution.rs +++ b/crates/hir_ty/src/method_resolution.rs | |||
@@ -23,7 +23,7 @@ use crate::{ | |||
23 | utils::all_super_traits, | 23 | utils::all_super_traits, |
24 | AdtId, Canonical, CanonicalVarKinds, DebruijnIndex, FnPointer, FnSig, ForeignDefId, | 24 | AdtId, Canonical, CanonicalVarKinds, DebruijnIndex, FnPointer, FnSig, ForeignDefId, |
25 | InEnvironment, Interner, Scalar, Substitution, TraitEnvironment, TraitRefExt, Ty, TyBuilder, | 25 | InEnvironment, Interner, Scalar, Substitution, TraitEnvironment, TraitRefExt, Ty, TyBuilder, |
26 | TyExt, TyKind, TypeWalk, | 26 | TyExt, TyKind, |
27 | }; | 27 | }; |
28 | 28 | ||
29 | /// This is used as a key for indexing impls. | 29 | /// This is used as a key for indexing impls. |
@@ -757,20 +757,13 @@ pub(crate) fn inherent_impl_substs( | |||
757 | /// This replaces any 'free' Bound vars in `s` (i.e. those with indices past | 757 | /// This replaces any 'free' Bound vars in `s` (i.e. those with indices past |
758 | /// num_vars_to_keep) by `TyKind::Unknown`. | 758 | /// num_vars_to_keep) by `TyKind::Unknown`. |
759 | fn fallback_bound_vars(s: Substitution, num_vars_to_keep: usize) -> Substitution { | 759 | fn fallback_bound_vars(s: Substitution, num_vars_to_keep: usize) -> Substitution { |
760 | s.fold_binders( | 760 | crate::fold_free_vars(s, |bound, binders| { |
761 | &mut |ty, binders| { | 761 | if bound.index >= num_vars_to_keep && bound.debruijn == DebruijnIndex::INNERMOST { |
762 | if let TyKind::BoundVar(bound) = ty.kind(&Interner) { | 762 | TyKind::Error.intern(&Interner) |
763 | if bound.index >= num_vars_to_keep && bound.debruijn >= binders { | 763 | } else { |
764 | TyKind::Error.intern(&Interner) | 764 | bound.shifted_in_from(binders).to_ty(&Interner) |
765 | } else { | 765 | } |
766 | ty | 766 | }) |
767 | } | ||
768 | } else { | ||
769 | ty | ||
770 | } | ||
771 | }, | ||
772 | DebruijnIndex::INNERMOST, | ||
773 | ) | ||
774 | } | 767 | } |
775 | 768 | ||
776 | fn transform_receiver_ty( | 769 | fn transform_receiver_ty( |