diff options
author | Aleksey Kladov <[email protected]> | 2019-11-21 12:39:09 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-11-21 12:39:09 +0000 |
commit | 6d64798a2300858c74b1cc0a22f6d3df578288b3 (patch) | |
tree | cd22f6a6a743bf15dc671995c49904477b249604 /crates/ra_hir/src/ty/infer | |
parent | 00684d708b64fe81a0264795f27594d450a8d08d (diff) |
Move resolver to hir_def
Diffstat (limited to 'crates/ra_hir/src/ty/infer')
-rw-r--r-- | crates/ra_hir/src/ty/infer/coerce.rs | 6 | ||||
-rw-r--r-- | crates/ra_hir/src/ty/infer/expr.rs | 5 | ||||
-rw-r--r-- | crates/ra_hir/src/ty/infer/path.rs | 9 |
3 files changed, 12 insertions, 8 deletions
diff --git a/crates/ra_hir/src/ty/infer/coerce.rs b/crates/ra_hir/src/ty/infer/coerce.rs index 6d297c268..0772b9df5 100644 --- a/crates/ra_hir/src/ty/infer/coerce.rs +++ b/crates/ra_hir/src/ty/infer/coerce.rs | |||
@@ -4,19 +4,19 @@ | |||
4 | //! | 4 | //! |
5 | //! See: https://doc.rust-lang.org/nomicon/coercions.html | 5 | //! See: https://doc.rust-lang.org/nomicon/coercions.html |
6 | 6 | ||
7 | use hir_def::resolver::Resolver; | ||
7 | use rustc_hash::FxHashMap; | 8 | use rustc_hash::FxHashMap; |
8 | |||
9 | use test_utils::tested_by; | 9 | use test_utils::tested_by; |
10 | 10 | ||
11 | use super::{InferTy, InferenceContext, TypeVarValue}; | ||
12 | use crate::{ | 11 | use crate::{ |
13 | db::HirDatabase, | 12 | db::HirDatabase, |
14 | lang_item::LangItemTarget, | 13 | lang_item::LangItemTarget, |
15 | resolve::Resolver, | ||
16 | ty::{autoderef, Substs, Ty, TypeCtor, TypeWalk}, | 14 | ty::{autoderef, Substs, Ty, TypeCtor, TypeWalk}, |
17 | Adt, Mutability, | 15 | Adt, Mutability, |
18 | }; | 16 | }; |
19 | 17 | ||
18 | use super::{InferTy, InferenceContext, TypeVarValue}; | ||
19 | |||
20 | impl<'a, D: HirDatabase> InferenceContext<'a, D> { | 20 | impl<'a, D: HirDatabase> InferenceContext<'a, D> { |
21 | /// Unify two types, but may coerce the first one to the second one | 21 | /// Unify two types, but may coerce the first one to the second one |
22 | /// using "implicit coercion rules" if needed. | 22 | /// using "implicit coercion rules" if needed. |
diff --git a/crates/ra_hir/src/ty/infer/expr.rs b/crates/ra_hir/src/ty/infer/expr.rs index 1ac2709f5..ac570075f 100644 --- a/crates/ra_hir/src/ty/infer/expr.rs +++ b/crates/ra_hir/src/ty/infer/expr.rs | |||
@@ -6,15 +6,14 @@ use std::sync::Arc; | |||
6 | use hir_def::{ | 6 | use hir_def::{ |
7 | builtin_type::Signedness, | 7 | builtin_type::Signedness, |
8 | path::{GenericArg, GenericArgs}, | 8 | path::{GenericArg, GenericArgs}, |
9 | resolver::resolver_for_expr, | ||
9 | }; | 10 | }; |
10 | use hir_expand::name; | 11 | use hir_expand::name; |
11 | 12 | ||
12 | use super::{BindingMode, Expectation, InferenceContext, InferenceDiagnostic, TypeMismatch}; | ||
13 | use crate::{ | 13 | use crate::{ |
14 | db::HirDatabase, | 14 | db::HirDatabase, |
15 | expr::{Array, BinaryOp, Expr, ExprId, Literal, Statement, UnaryOp}, | 15 | expr::{Array, BinaryOp, Expr, ExprId, Literal, Statement, UnaryOp}, |
16 | generics::{GenericParams, HasGenericParams}, | 16 | generics::{GenericParams, HasGenericParams}, |
17 | resolve::resolver_for_expr, | ||
18 | ty::{ | 17 | ty::{ |
19 | autoderef, method_resolution, op, CallableDef, InferTy, IntTy, Mutability, Namespace, | 18 | autoderef, method_resolution, op, CallableDef, InferTy, IntTy, Mutability, Namespace, |
20 | Obligation, ProjectionPredicate, ProjectionTy, Substs, TraitRef, Ty, TypeCtor, TypeWalk, | 19 | Obligation, ProjectionPredicate, ProjectionTy, Substs, TraitRef, Ty, TypeCtor, TypeWalk, |
@@ -23,6 +22,8 @@ use crate::{ | |||
23 | Adt, Name, | 22 | Adt, Name, |
24 | }; | 23 | }; |
25 | 24 | ||
25 | use super::{BindingMode, Expectation, InferenceContext, InferenceDiagnostic, TypeMismatch}; | ||
26 | |||
26 | impl<'a, D: HirDatabase> InferenceContext<'a, D> { | 27 | impl<'a, D: HirDatabase> InferenceContext<'a, D> { |
27 | pub(super) fn infer_expr(&mut self, tgt_expr: ExprId, expected: &Expectation) -> Ty { | 28 | pub(super) fn infer_expr(&mut self, tgt_expr: ExprId, expected: &Expectation) -> Ty { |
28 | let ty = self.infer_expr_inner(tgt_expr, expected); | 29 | let ty = self.infer_expr_inner(tgt_expr, expected); |
diff --git a/crates/ra_hir/src/ty/infer/path.rs b/crates/ra_hir/src/ty/infer/path.rs index 55a5dbec7..70136e514 100644 --- a/crates/ra_hir/src/ty/infer/path.rs +++ b/crates/ra_hir/src/ty/infer/path.rs | |||
@@ -1,16 +1,19 @@ | |||
1 | //! Path expression resolution. | 1 | //! Path expression resolution. |
2 | 2 | ||
3 | use hir_def::path::PathSegment; | 3 | use hir_def::{ |
4 | path::PathSegment, | ||
5 | resolver::{ResolveValueResult, Resolver, TypeNs, ValueNs}, | ||
6 | }; | ||
4 | 7 | ||
5 | use super::{ExprOrPatId, InferenceContext, TraitRef}; | ||
6 | use crate::{ | 8 | use crate::{ |
7 | db::HirDatabase, | 9 | db::HirDatabase, |
8 | generics::HasGenericParams, | 10 | generics::HasGenericParams, |
9 | resolve::{ResolveValueResult, Resolver, TypeNs, ValueNs}, | ||
10 | ty::{method_resolution, Namespace, Substs, Ty, TypableDef, TypeWalk}, | 11 | ty::{method_resolution, Namespace, Substs, Ty, TypableDef, TypeWalk}, |
11 | AssocItem, Container, Function, Name, Path, | 12 | AssocItem, Container, Function, Name, Path, |
12 | }; | 13 | }; |
13 | 14 | ||
15 | use super::{ExprOrPatId, InferenceContext, TraitRef}; | ||
16 | |||
14 | impl<'a, D: HirDatabase> InferenceContext<'a, D> { | 17 | impl<'a, D: HirDatabase> InferenceContext<'a, D> { |
15 | pub(super) fn infer_path( | 18 | pub(super) fn infer_path( |
16 | &mut self, | 19 | &mut self, |