aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/infer.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-03-19 11:12:54 +0000
committerGitHub <[email protected]>2021-03-19 11:12:54 +0000
commit98d29d4f538899a8bd8caac7f4d2459438a1ae9a (patch)
tree49fc49a406fed5f239a5a8a7cee4cf52fb56e568 /crates/hir_ty/src/infer.rs
parent26fdd17cc6fc79b476977c2a40a90de7095e4b45 (diff)
parent8996b1a2353539cb9c264d0effbde80567de6586 (diff)
Merge #8101
8101: Replace Projection variant in GenericPredicate with AliasEq r=flodiebold a=Veykril Co-authored-by: Lukas Wirth <[email protected]>
Diffstat (limited to 'crates/hir_ty/src/infer.rs')
-rw-r--r--crates/hir_ty/src/infer.rs18
1 files changed, 9 insertions, 9 deletions
diff --git a/crates/hir_ty/src/infer.rs b/crates/hir_ty/src/infer.rs
index b6ae4fc65..82186979a 100644
--- a/crates/hir_ty/src/infer.rs
+++ b/crates/hir_ty/src/infer.rs
@@ -37,12 +37,12 @@ use stdx::impl_from;
37use syntax::SmolStr; 37use syntax::SmolStr;
38 38
39use super::{ 39use super::{
40 traits::{Guidance, Obligation, ProjectionPredicate, Solution}, 40 traits::{Guidance, Obligation, Solution},
41 InEnvironment, ProjectionTy, Substitution, TraitEnvironment, TraitRef, Ty, TypeWalk, 41 InEnvironment, ProjectionTy, Substitution, TraitEnvironment, TraitRef, Ty, TypeWalk,
42}; 42};
43use crate::{ 43use crate::{
44 db::HirDatabase, infer::diagnostics::InferenceDiagnostic, lower::ImplTraitLoweringMode, 44 db::HirDatabase, infer::diagnostics::InferenceDiagnostic, lower::ImplTraitLoweringMode,
45 to_assoc_type_id, to_chalk_trait_id, AliasTy, Interner, TyKind, 45 to_assoc_type_id, to_chalk_trait_id, AliasEq, AliasTy, Interner, TyKind,
46}; 46};
47 47
48pub(crate) use unify::unify; 48pub(crate) use unify::unify;
@@ -396,15 +396,15 @@ impl<'a> InferenceContext<'a> {
396 .build(); 396 .build();
397 let trait_ref = 397 let trait_ref =
398 TraitRef { trait_id: to_chalk_trait_id(trait_), substitution: substs.clone() }; 398 TraitRef { trait_id: to_chalk_trait_id(trait_), substitution: substs.clone() };
399 let projection = ProjectionPredicate { 399 let alias_eq = AliasEq {
400 ty: ty.clone(), 400 alias: AliasTy::Projection(ProjectionTy {
401 projection_ty: ProjectionTy {
402 associated_ty_id: to_assoc_type_id(res_assoc_ty), 401 associated_ty_id: to_assoc_type_id(res_assoc_ty),
403 substitution: substs, 402 substitution: substs,
404 }, 403 }),
404 ty: ty.clone(),
405 }; 405 };
406 self.obligations.push(Obligation::Trait(trait_ref)); 406 self.obligations.push(Obligation::Trait(trait_ref));
407 self.obligations.push(Obligation::Projection(projection)); 407 self.obligations.push(Obligation::AliasEq(alias_eq));
408 self.resolve_ty_as_possible(ty) 408 self.resolve_ty_as_possible(ty)
409 } 409 }
410 None => self.err_ty(), 410 None => self.err_ty(),
@@ -429,8 +429,8 @@ impl<'a> InferenceContext<'a> {
429 429
430 fn normalize_projection_ty(&mut self, proj_ty: ProjectionTy) -> Ty { 430 fn normalize_projection_ty(&mut self, proj_ty: ProjectionTy) -> Ty {
431 let var = self.table.new_type_var(); 431 let var = self.table.new_type_var();
432 let predicate = ProjectionPredicate { projection_ty: proj_ty, ty: var.clone() }; 432 let alias_eq = AliasEq { alias: AliasTy::Projection(proj_ty), ty: var.clone() };
433 let obligation = Obligation::Projection(predicate); 433 let obligation = Obligation::AliasEq(alias_eq);
434 self.obligations.push(obligation); 434 self.obligations.push(obligation);
435 var 435 var
436 } 436 }