diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-03-19 11:12:54 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2021-03-19 11:12:54 +0000 |
commit | 98d29d4f538899a8bd8caac7f4d2459438a1ae9a (patch) | |
tree | 49fc49a406fed5f239a5a8a7cee4cf52fb56e568 /crates/hir_ty/src/infer.rs | |
parent | 26fdd17cc6fc79b476977c2a40a90de7095e4b45 (diff) | |
parent | 8996b1a2353539cb9c264d0effbde80567de6586 (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.rs | 18 |
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; | |||
37 | use syntax::SmolStr; | 37 | use syntax::SmolStr; |
38 | 38 | ||
39 | use super::{ | 39 | use 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 | }; |
43 | use crate::{ | 43 | use 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 | ||
48 | pub(crate) use unify::unify; | 48 | pub(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 | } |