diff options
Diffstat (limited to 'crates/ra_hir/src/ty')
-rw-r--r-- | crates/ra_hir/src/ty/autoderef.rs | 3 | ||||
-rw-r--r-- | crates/ra_hir/src/ty/infer.rs | 2 | ||||
-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 | ||||
-rw-r--r-- | crates/ra_hir/src/ty/lower.rs | 2 | ||||
-rw-r--r-- | crates/ra_hir/src/ty/method_resolution.rs | 2 |
7 files changed, 17 insertions, 12 deletions
diff --git a/crates/ra_hir/src/ty/autoderef.rs b/crates/ra_hir/src/ty/autoderef.rs index f77492170..5d8518041 100644 --- a/crates/ra_hir/src/ty/autoderef.rs +++ b/crates/ra_hir/src/ty/autoderef.rs | |||
@@ -5,11 +5,12 @@ | |||
5 | 5 | ||
6 | use std::iter::successors; | 6 | use std::iter::successors; |
7 | 7 | ||
8 | use hir_def::resolver::Resolver; | ||
8 | use hir_expand::name; | 9 | use hir_expand::name; |
9 | use log::{info, warn}; | 10 | use log::{info, warn}; |
10 | 11 | ||
11 | use super::{traits::Solution, Canonical, Substs, Ty, TypeWalk}; | 12 | use super::{traits::Solution, Canonical, Substs, Ty, TypeWalk}; |
12 | use crate::{db::HirDatabase, generics::HasGenericParams, Resolver}; | 13 | use crate::{db::HirDatabase, generics::HasGenericParams}; |
13 | 14 | ||
14 | const AUTODEREF_RECURSION_LIMIT: usize = 10; | 15 | const AUTODEREF_RECURSION_LIMIT: usize = 10; |
15 | 16 | ||
diff --git a/crates/ra_hir/src/ty/infer.rs b/crates/ra_hir/src/ty/infer.rs index c3d65afa6..69b13baef 100644 --- a/crates/ra_hir/src/ty/infer.rs +++ b/crates/ra_hir/src/ty/infer.rs | |||
@@ -23,6 +23,7 @@ use rustc_hash::FxHashMap; | |||
23 | 23 | ||
24 | use hir_def::{ | 24 | use hir_def::{ |
25 | path::known, | 25 | path::known, |
26 | resolver::{HasResolver, Resolver, TypeNs}, | ||
26 | type_ref::{Mutability, TypeRef}, | 27 | type_ref::{Mutability, TypeRef}, |
27 | AdtId, DefWithBodyId, | 28 | AdtId, DefWithBodyId, |
28 | }; | 29 | }; |
@@ -41,7 +42,6 @@ use crate::{ | |||
41 | code_model::TypeAlias, | 42 | code_model::TypeAlias, |
42 | db::HirDatabase, | 43 | db::HirDatabase, |
43 | expr::{BindingAnnotation, Body, ExprId, PatId}, | 44 | expr::{BindingAnnotation, Body, ExprId, PatId}, |
44 | resolve::{HasResolver, Resolver, TypeNs}, | ||
45 | ty::infer::diagnostics::InferenceDiagnostic, | 45 | ty::infer::diagnostics::InferenceDiagnostic, |
46 | Adt, AssocItem, ConstData, DefWithBody, FloatTy, FnData, Function, HasBody, IntTy, Path, | 46 | Adt, AssocItem, ConstData, DefWithBody, FloatTy, FnData, Function, HasBody, IntTy, Path, |
47 | StructField, Trait, VariantDef, | 47 | StructField, Trait, VariantDef, |
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, |
diff --git a/crates/ra_hir/src/ty/lower.rs b/crates/ra_hir/src/ty/lower.rs index e477b2439..c6ad0811b 100644 --- a/crates/ra_hir/src/ty/lower.rs +++ b/crates/ra_hir/src/ty/lower.rs | |||
@@ -11,6 +11,7 @@ use std::sync::Arc; | |||
11 | use hir_def::{ | 11 | use hir_def::{ |
12 | builtin_type::{BuiltinFloat, BuiltinInt, BuiltinType}, | 12 | builtin_type::{BuiltinFloat, BuiltinInt, BuiltinType}, |
13 | path::{GenericArg, PathSegment}, | 13 | path::{GenericArg, PathSegment}, |
14 | resolver::{HasResolver, Resolver, TypeNs}, | ||
14 | type_ref::{TypeBound, TypeRef}, | 15 | type_ref::{TypeBound, TypeRef}, |
15 | GenericDefId, | 16 | GenericDefId, |
16 | }; | 17 | }; |
@@ -23,7 +24,6 @@ use crate::{ | |||
23 | db::HirDatabase, | 24 | db::HirDatabase, |
24 | generics::HasGenericParams, | 25 | generics::HasGenericParams, |
25 | generics::{GenericDef, WherePredicate}, | 26 | generics::{GenericDef, WherePredicate}, |
26 | resolve::{HasResolver, Resolver, TypeNs}, | ||
27 | ty::{ | 27 | ty::{ |
28 | primitive::{FloatTy, IntTy, Uncertain}, | 28 | primitive::{FloatTy, IntTy, Uncertain}, |
29 | Adt, | 29 | Adt, |
diff --git a/crates/ra_hir/src/ty/method_resolution.rs b/crates/ra_hir/src/ty/method_resolution.rs index 5ad72ef9f..64adb814d 100644 --- a/crates/ra_hir/src/ty/method_resolution.rs +++ b/crates/ra_hir/src/ty/method_resolution.rs | |||
@@ -5,11 +5,11 @@ | |||
5 | use std::sync::Arc; | 5 | use std::sync::Arc; |
6 | 6 | ||
7 | use arrayvec::ArrayVec; | 7 | use arrayvec::ArrayVec; |
8 | use hir_def::resolver::Resolver; | ||
8 | use rustc_hash::FxHashMap; | 9 | use rustc_hash::FxHashMap; |
9 | 10 | ||
10 | use crate::{ | 11 | use crate::{ |
11 | db::HirDatabase, | 12 | db::HirDatabase, |
12 | resolve::Resolver, | ||
13 | ty::primitive::{FloatBitness, Uncertain}, | 13 | ty::primitive::{FloatBitness, Uncertain}, |
14 | ty::{Ty, TypeCtor}, | 14 | ty::{Ty, TypeCtor}, |
15 | AssocItem, Crate, Function, ImplBlock, Module, Mutability, Name, Trait, | 15 | AssocItem, Crate, Function, ImplBlock, Module, Mutability, Name, Trait, |