diff options
author | Florian Diebold <[email protected]> | 2021-03-20 10:23:59 +0000 |
---|---|---|
committer | Florian Diebold <[email protected]> | 2021-03-20 11:47:12 +0000 |
commit | 7ec3b66f7a3ac0a33cf435bc3596fdac542fc52a (patch) | |
tree | 70a77a26ca09d8d5cd843b1cd9d59af229cd0daf /crates/hir_ty/src/infer/path.rs | |
parent | 8e7e405f6ab0c1ee10bfdd3d55a97628fe4cd6dd (diff) |
Turn Obligation into something similar to chalk_ir::DomainGoal
This includes starting to make use of Chalk's `Cast` trait.
Diffstat (limited to 'crates/hir_ty/src/infer/path.rs')
-rw-r--r-- | crates/hir_ty/src/infer/path.rs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/crates/hir_ty/src/infer/path.rs b/crates/hir_ty/src/infer/path.rs index e15135fc1..58cce56ab 100644 --- a/crates/hir_ty/src/infer/path.rs +++ b/crates/hir_ty/src/infer/path.rs | |||
@@ -2,6 +2,7 @@ | |||
2 | 2 | ||
3 | use std::iter; | 3 | use std::iter; |
4 | 4 | ||
5 | use chalk_ir::cast::Cast; | ||
5 | use hir_def::{ | 6 | use hir_def::{ |
6 | path::{Path, PathSegment}, | 7 | path::{Path, PathSegment}, |
7 | resolver::{ResolveValueResult, Resolver, TypeNs, ValueNs}, | 8 | resolver::{ResolveValueResult, Resolver, TypeNs, ValueNs}, |
@@ -256,10 +257,13 @@ impl<'a> InferenceContext<'a> { | |||
256 | .push(ty.clone()) | 257 | .push(ty.clone()) |
257 | .fill(std::iter::repeat_with(|| self.table.new_type_var())) | 258 | .fill(std::iter::repeat_with(|| self.table.new_type_var())) |
258 | .build(); | 259 | .build(); |
259 | self.obligations.push(super::Obligation::Trait(TraitRef { | 260 | self.obligations.push( |
260 | trait_id: to_chalk_trait_id(trait_), | 261 | TraitRef { |
261 | substitution: trait_substs.clone(), | 262 | trait_id: to_chalk_trait_id(trait_), |
262 | })); | 263 | substitution: trait_substs.clone(), |
264 | } | ||
265 | .cast(&Interner), | ||
266 | ); | ||
263 | Some(trait_substs) | 267 | Some(trait_substs) |
264 | } | 268 | } |
265 | AssocContainerId::ModuleId(_) => None, | 269 | AssocContainerId::ModuleId(_) => None, |