diff options
author | Florian Diebold <[email protected]> | 2021-04-01 20:04:02 +0100 |
---|---|---|
committer | Florian Diebold <[email protected]> | 2021-04-03 10:17:13 +0100 |
commit | e480d81988fc0c0e4f80f1c54058b95b9aaf1ebf (patch) | |
tree | 079dabc4e0de72e30d2bd04bd50427ff6950b348 /crates/hir_ty/src/method_resolution.rs | |
parent | 327f3a0a3017e047be58b8312f8bf3ac690db3fd (diff) |
Introduce `GenericArg` like in Chalk
Plus some more adaptations to Substitution.
Lots of `assert_ty_ref` that we should revisit when introducing
lifetime/const parameters.
Diffstat (limited to 'crates/hir_ty/src/method_resolution.rs')
-rw-r--r-- | crates/hir_ty/src/method_resolution.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/crates/hir_ty/src/method_resolution.rs b/crates/hir_ty/src/method_resolution.rs index bf7d5eded..054896475 100644 --- a/crates/hir_ty/src/method_resolution.rs +++ b/crates/hir_ty/src/method_resolution.rs | |||
@@ -720,7 +720,7 @@ pub(crate) fn inherent_impl_substs( | |||
720 | chalk_ir::VariableKind::Ty(chalk_ir::TyVariableKind::General), | 720 | chalk_ir::VariableKind::Ty(chalk_ir::TyVariableKind::General), |
721 | UniverseIndex::ROOT, | 721 | UniverseIndex::ROOT, |
722 | )) | 722 | )) |
723 | .take(vars.len()), | 723 | .take(vars.len(&Interner)), |
724 | ); | 724 | ); |
725 | let tys = Canonical { | 725 | let tys = Canonical { |
726 | binders: CanonicalVarKinds::from_iter(&Interner, kinds), | 726 | binders: CanonicalVarKinds::from_iter(&Interner, kinds), |
@@ -732,7 +732,8 @@ pub(crate) fn inherent_impl_substs( | |||
732 | // Unknown. I think this can only really happen if self_ty contained | 732 | // Unknown. I think this can only really happen if self_ty contained |
733 | // Unknown, and in that case we want the result to contain Unknown in those | 733 | // Unknown, and in that case we want the result to contain Unknown in those |
734 | // places again. | 734 | // places again. |
735 | substs.map(|s| fallback_bound_vars(s.suffix(vars.len()), self_ty.binders.len(&Interner))) | 735 | substs |
736 | .map(|s| fallback_bound_vars(s.suffix(vars.len(&Interner)), self_ty.binders.len(&Interner))) | ||
736 | } | 737 | } |
737 | 738 | ||
738 | /// This replaces any 'free' Bound vars in `s` (i.e. those with indices past | 739 | /// This replaces any 'free' Bound vars in `s` (i.e. those with indices past |
@@ -821,7 +822,7 @@ fn generic_implements_goal( | |||
821 | chalk_ir::VariableKind::Ty(chalk_ir::TyVariableKind::General), | 822 | chalk_ir::VariableKind::Ty(chalk_ir::TyVariableKind::General), |
822 | UniverseIndex::ROOT, | 823 | UniverseIndex::ROOT, |
823 | )) | 824 | )) |
824 | .take(substs.len() - 1), | 825 | .take(substs.len(&Interner) - 1), |
825 | ); | 826 | ); |
826 | let trait_ref = TraitRef { trait_id: to_chalk_trait_id(trait_), substitution: substs }; | 827 | let trait_ref = TraitRef { trait_id: to_chalk_trait_id(trait_), substitution: substs }; |
827 | let obligation = trait_ref.cast(&Interner); | 828 | let obligation = trait_ref.cast(&Interner); |