From daaf46177e5dc63e20e5a1ec5692e53cc8f7bc34 Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Thu, 26 Sep 2019 21:37:03 +0200 Subject: Add SubstsBuilder + further refactoring. --- crates/ra_hir/src/ty/infer/path.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'crates/ra_hir/src/ty/infer/path.rs') diff --git a/crates/ra_hir/src/ty/infer/path.rs b/crates/ra_hir/src/ty/infer/path.rs index feb7481b2..db979353a 100644 --- a/crates/ra_hir/src/ty/infer/path.rs +++ b/crates/ra_hir/src/ty/infer/path.rs @@ -158,13 +158,13 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { AssocItem::Const(c) => ValueNs::Const(c), AssocItem::TypeAlias(_) => unreachable!(), }; - let generics = item.generic_params(self.db); - let mut substs = Vec::with_capacity(generics.count_params_including_parent()); - substs.extend(trait_ref.substs.iter().cloned()); - substs.extend(std::iter::repeat(Ty::Unknown).take(generics.params.len())); + let substs = Substs::build_for_def(self.db, item) + .use_parent_substs(&trait_ref.substs) + .fill_with_unknown() + .build(); self.write_assoc_resolution(id, item); - Some((def, Some(substs.into()))) + Some((def, Some(substs))) } fn resolve_ty_assoc_item( -- cgit v1.2.3