diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-03-20 11:47:50 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2021-03-20 11:47:50 +0000 |
commit | 4d67032bbb3e1f97ee7af43cb6f056d01f791ca2 (patch) | |
tree | 70a77a26ca09d8d5cd843b1cd9d59af229cd0daf /crates/hir_ty/src/infer.rs | |
parent | 5ac0290f533eed295c6e92564d7530d41cf45d6e (diff) | |
parent | 7ec3b66f7a3ac0a33cf435bc3596fdac542fc52a (diff) |
Merge #8117
8117: Turn Obligation into something similar to chalk_ir::DomainGoal r=flodiebold a=flodiebold
This includes starting to make use of Chalk's `Cast` trait.
Co-authored-by: Florian Diebold <[email protected]>
Diffstat (limited to 'crates/hir_ty/src/infer.rs')
-rw-r--r-- | crates/hir_ty/src/infer.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/crates/hir_ty/src/infer.rs b/crates/hir_ty/src/infer.rs index 82186979a..b9e434c78 100644 --- a/crates/hir_ty/src/infer.rs +++ b/crates/hir_ty/src/infer.rs | |||
@@ -18,7 +18,7 @@ use std::mem; | |||
18 | use std::ops::Index; | 18 | use std::ops::Index; |
19 | use std::sync::Arc; | 19 | use std::sync::Arc; |
20 | 20 | ||
21 | use chalk_ir::Mutability; | 21 | use chalk_ir::{cast::Cast, Mutability}; |
22 | use hir_def::{ | 22 | use hir_def::{ |
23 | body::Body, | 23 | body::Body, |
24 | data::{ConstData, FunctionData, StaticData}, | 24 | data::{ConstData, FunctionData, StaticData}, |
@@ -37,7 +37,7 @@ use stdx::impl_from; | |||
37 | use syntax::SmolStr; | 37 | use syntax::SmolStr; |
38 | 38 | ||
39 | use super::{ | 39 | use super::{ |
40 | traits::{Guidance, Obligation, Solution}, | 40 | traits::{DomainGoal, Guidance, 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::{ |
@@ -204,7 +204,7 @@ struct InferenceContext<'a> { | |||
204 | resolver: Resolver, | 204 | resolver: Resolver, |
205 | table: unify::InferenceTable, | 205 | table: unify::InferenceTable, |
206 | trait_env: Arc<TraitEnvironment>, | 206 | trait_env: Arc<TraitEnvironment>, |
207 | obligations: Vec<Obligation>, | 207 | obligations: Vec<DomainGoal>, |
208 | result: InferenceResult, | 208 | result: InferenceResult, |
209 | /// The return type of the function being inferred, or the closure if we're | 209 | /// The return type of the function being inferred, or the closure if we're |
210 | /// currently within one. | 210 | /// currently within one. |
@@ -403,8 +403,8 @@ impl<'a> InferenceContext<'a> { | |||
403 | }), | 403 | }), |
404 | ty: ty.clone(), | 404 | ty: ty.clone(), |
405 | }; | 405 | }; |
406 | self.obligations.push(Obligation::Trait(trait_ref)); | 406 | self.obligations.push(trait_ref.cast(&Interner)); |
407 | self.obligations.push(Obligation::AliasEq(alias_eq)); | 407 | self.obligations.push(alias_eq.cast(&Interner)); |
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(), |
@@ -430,7 +430,7 @@ impl<'a> InferenceContext<'a> { | |||
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 alias_eq = AliasEq { alias: AliasTy::Projection(proj_ty), ty: var.clone() }; | 432 | let alias_eq = AliasEq { alias: AliasTy::Projection(proj_ty), ty: var.clone() }; |
433 | let obligation = Obligation::AliasEq(alias_eq); | 433 | let obligation = alias_eq.cast(&Interner); |
434 | self.obligations.push(obligation); | 434 | self.obligations.push(obligation); |
435 | var | 435 | var |
436 | } | 436 | } |