diff options
Diffstat (limited to 'crates/hir_ty/src/infer/path.rs')
-rw-r--r-- | crates/hir_ty/src/infer/path.rs | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/crates/hir_ty/src/infer/path.rs b/crates/hir_ty/src/infer/path.rs index 1ba15f737..282dd499f 100644 --- a/crates/hir_ty/src/infer/path.rs +++ b/crates/hir_ty/src/infer/path.rs | |||
@@ -10,9 +10,7 @@ use hir_def::{ | |||
10 | }; | 10 | }; |
11 | use hir_expand::name::Name; | 11 | use hir_expand::name::Name; |
12 | 12 | ||
13 | use crate::{ | 13 | use crate::{method_resolution, Interner, Substitution, Ty, TyBuilder, TyKind, ValueTyDefId}; |
14 | method_resolution, to_chalk_trait_id, Interner, Substitution, Ty, TyKind, ValueTyDefId, | ||
15 | }; | ||
16 | 14 | ||
17 | use super::{ExprOrPatId, InferenceContext, TraitRef}; | 15 | use super::{ExprOrPatId, InferenceContext, TraitRef}; |
18 | 16 | ||
@@ -254,18 +252,12 @@ impl<'a> InferenceContext<'a> { | |||
254 | } | 252 | } |
255 | AssocContainerId::TraitId(trait_) => { | 253 | AssocContainerId::TraitId(trait_) => { |
256 | // we're picking this method | 254 | // we're picking this method |
257 | let trait_substs = Substitution::build_for_def(self.db, trait_) | 255 | let trait_ref = TyBuilder::trait_ref(self.db, trait_) |
258 | .push(ty.clone()) | 256 | .push(ty.clone()) |
259 | .fill(std::iter::repeat_with(|| self.table.new_type_var())) | 257 | .fill(std::iter::repeat_with(|| self.table.new_type_var())) |
260 | .build(); | 258 | .build(); |
261 | self.push_obligation( | 259 | self.push_obligation(trait_ref.clone().cast(&Interner)); |
262 | TraitRef { | 260 | Some(trait_ref.substitution) |
263 | trait_id: to_chalk_trait_id(trait_), | ||
264 | substitution: trait_substs.clone(), | ||
265 | } | ||
266 | .cast(&Interner), | ||
267 | ); | ||
268 | Some(trait_substs) | ||
269 | } | 261 | } |
270 | AssocContainerId::ModuleId(_) => None, | 262 | AssocContainerId::ModuleId(_) => None, |
271 | }; | 263 | }; |