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 | 8 | ||||
-rw-r--r-- | crates/ra_hir/src/ty/infer/coerce.rs | 3 | ||||
-rw-r--r-- | crates/ra_hir/src/ty/infer/expr.rs | 5 | ||||
-rw-r--r-- | crates/ra_hir/src/ty/infer/path.rs | 6 | ||||
-rw-r--r-- | crates/ra_hir/src/ty/lower.rs | 7 | ||||
-rw-r--r-- | crates/ra_hir/src/ty/method_resolution.rs | 3 | ||||
-rw-r--r-- | crates/ra_hir/src/ty/traits/chalk.rs | 4 |
8 files changed, 24 insertions, 15 deletions
diff --git a/crates/ra_hir/src/ty/autoderef.rs b/crates/ra_hir/src/ty/autoderef.rs index 02492ca14..3645ee831 100644 --- a/crates/ra_hir/src/ty/autoderef.rs +++ b/crates/ra_hir/src/ty/autoderef.rs | |||
@@ -5,10 +5,11 @@ | |||
5 | 5 | ||
6 | use std::iter::successors; | 6 | use std::iter::successors; |
7 | 7 | ||
8 | use hir_expand::name; | ||
8 | use log::{info, warn}; | 9 | use log::{info, warn}; |
9 | 10 | ||
10 | use super::{traits::Solution, Canonical, Substs, Ty, TypeWalk}; | 11 | use super::{traits::Solution, Canonical, Substs, Ty, TypeWalk}; |
11 | use crate::{db::HirDatabase, name, HasGenericParams, Resolver}; | 12 | use crate::{db::HirDatabase, HasGenericParams, Resolver}; |
12 | 13 | ||
13 | const AUTODEREF_RECURSION_LIMIT: usize = 10; | 14 | const AUTODEREF_RECURSION_LIMIT: usize = 10; |
14 | 15 | ||
diff --git a/crates/ra_hir/src/ty/infer.rs b/crates/ra_hir/src/ty/infer.rs index ebaff998e..6694467a3 100644 --- a/crates/ra_hir/src/ty/infer.rs +++ b/crates/ra_hir/src/ty/infer.rs | |||
@@ -21,6 +21,11 @@ use std::sync::Arc; | |||
21 | use ena::unify::{InPlaceUnificationTable, NoError, UnifyKey, UnifyValue}; | 21 | use ena::unify::{InPlaceUnificationTable, NoError, UnifyKey, UnifyValue}; |
22 | use rustc_hash::FxHashMap; | 22 | use rustc_hash::FxHashMap; |
23 | 23 | ||
24 | use hir_def::{ | ||
25 | path::known, | ||
26 | type_ref::{Mutability, TypeRef}, | ||
27 | }; | ||
28 | use hir_expand::name; | ||
24 | use ra_arena::map::ArenaMap; | 29 | use ra_arena::map::ArenaMap; |
25 | use ra_prof::profile; | 30 | use ra_prof::profile; |
26 | use test_utils::tested_by; | 31 | use test_utils::tested_by; |
@@ -37,11 +42,8 @@ use crate::{ | |||
37 | db::HirDatabase, | 42 | db::HirDatabase, |
38 | diagnostics::DiagnosticSink, | 43 | diagnostics::DiagnosticSink, |
39 | expr::{BindingAnnotation, Body, ExprId, PatId}, | 44 | expr::{BindingAnnotation, Body, ExprId, PatId}, |
40 | name, | ||
41 | path::known, | ||
42 | resolve::{Resolver, TypeNs}, | 45 | resolve::{Resolver, TypeNs}, |
43 | ty::infer::diagnostics::InferenceDiagnostic, | 46 | ty::infer::diagnostics::InferenceDiagnostic, |
44 | type_ref::{Mutability, TypeRef}, | ||
45 | Adt, AssocItem, ConstData, DefWithBody, FnData, Function, HasBody, Path, StructField, | 47 | Adt, AssocItem, ConstData, DefWithBody, FnData, Function, HasBody, Path, StructField, |
46 | }; | 48 | }; |
47 | 49 | ||
diff --git a/crates/ra_hir/src/ty/infer/coerce.rs b/crates/ra_hir/src/ty/infer/coerce.rs index 0429a9866..6ea135126 100644 --- a/crates/ra_hir/src/ty/infer/coerce.rs +++ b/crates/ra_hir/src/ty/infer/coerce.rs | |||
@@ -14,8 +14,7 @@ use crate::{ | |||
14 | lang_item::LangItemTarget, | 14 | lang_item::LangItemTarget, |
15 | resolve::Resolver, | 15 | resolve::Resolver, |
16 | ty::{autoderef, Substs, Ty, TypeCtor, TypeWalk}, | 16 | ty::{autoderef, Substs, Ty, TypeCtor, TypeWalk}, |
17 | type_ref::Mutability, | 17 | Adt, Mutability, |
18 | Adt, | ||
19 | }; | 18 | }; |
20 | 19 | ||
21 | impl<'a, D: HirDatabase> InferenceContext<'a, D> { | 20 | impl<'a, D: HirDatabase> InferenceContext<'a, D> { |
diff --git a/crates/ra_hir/src/ty/infer/expr.rs b/crates/ra_hir/src/ty/infer/expr.rs index f8807c742..fed52df39 100644 --- a/crates/ra_hir/src/ty/infer/expr.rs +++ b/crates/ra_hir/src/ty/infer/expr.rs | |||
@@ -3,14 +3,15 @@ | |||
3 | use std::iter::{repeat, repeat_with}; | 3 | use std::iter::{repeat, repeat_with}; |
4 | use std::sync::Arc; | 4 | use std::sync::Arc; |
5 | 5 | ||
6 | use hir_def::path::{GenericArg, GenericArgs}; | ||
7 | use hir_expand::name; | ||
8 | |||
6 | use super::{BindingMode, Expectation, InferenceContext, InferenceDiagnostic, TypeMismatch}; | 9 | use super::{BindingMode, Expectation, InferenceContext, InferenceDiagnostic, TypeMismatch}; |
7 | use crate::{ | 10 | use crate::{ |
8 | db::HirDatabase, | 11 | db::HirDatabase, |
9 | expr::{self, Array, BinaryOp, Expr, ExprId, Literal, Statement, UnaryOp}, | 12 | expr::{self, Array, BinaryOp, Expr, ExprId, Literal, Statement, UnaryOp}, |
10 | generics::{GenericParams, HasGenericParams}, | 13 | generics::{GenericParams, HasGenericParams}, |
11 | name, | ||
12 | nameres::Namespace, | 14 | nameres::Namespace, |
13 | path::{GenericArg, GenericArgs}, | ||
14 | ty::{ | 15 | ty::{ |
15 | autoderef, method_resolution, op, primitive, CallableDef, InferTy, Mutability, Obligation, | 16 | autoderef, method_resolution, op, primitive, CallableDef, InferTy, Mutability, Obligation, |
16 | ProjectionPredicate, ProjectionTy, Substs, TraitRef, Ty, TypeCtor, TypeWalk, | 17 | ProjectionPredicate, ProjectionTy, Substs, TraitRef, Ty, TypeCtor, TypeWalk, |
diff --git a/crates/ra_hir/src/ty/infer/path.rs b/crates/ra_hir/src/ty/infer/path.rs index db979353a..77aa35ce1 100644 --- a/crates/ra_hir/src/ty/infer/path.rs +++ b/crates/ra_hir/src/ty/infer/path.rs | |||
@@ -1,5 +1,7 @@ | |||
1 | //! Path expression resolution. | 1 | //! Path expression resolution. |
2 | 2 | ||
3 | use hir_def::path::PathSegment; | ||
4 | |||
3 | use super::{ExprOrPatId, InferenceContext, TraitRef}; | 5 | use super::{ExprOrPatId, InferenceContext, TraitRef}; |
4 | use crate::{ | 6 | use crate::{ |
5 | db::HirDatabase, | 7 | db::HirDatabase, |
@@ -131,7 +133,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { | |||
131 | fn resolve_trait_assoc_item( | 133 | fn resolve_trait_assoc_item( |
132 | &mut self, | 134 | &mut self, |
133 | trait_ref: TraitRef, | 135 | trait_ref: TraitRef, |
134 | segment: &crate::path::PathSegment, | 136 | segment: &PathSegment, |
135 | id: ExprOrPatId, | 137 | id: ExprOrPatId, |
136 | ) -> Option<(ValueNs, Option<Substs>)> { | 138 | ) -> Option<(ValueNs, Option<Substs>)> { |
137 | let trait_ = trait_ref.trait_; | 139 | let trait_ = trait_ref.trait_; |
@@ -170,7 +172,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { | |||
170 | fn resolve_ty_assoc_item( | 172 | fn resolve_ty_assoc_item( |
171 | &mut self, | 173 | &mut self, |
172 | ty: Ty, | 174 | ty: Ty, |
173 | segment: &crate::path::PathSegment, | 175 | segment: &PathSegment, |
174 | id: ExprOrPatId, | 176 | id: ExprOrPatId, |
175 | ) -> Option<(ValueNs, Option<Substs>)> { | 177 | ) -> Option<(ValueNs, Option<Substs>)> { |
176 | if let Ty::Unknown = ty { | 178 | if let Ty::Unknown = ty { |
diff --git a/crates/ra_hir/src/ty/lower.rs b/crates/ra_hir/src/ty/lower.rs index 366556134..0f49a0e54 100644 --- a/crates/ra_hir/src/ty/lower.rs +++ b/crates/ra_hir/src/ty/lower.rs | |||
@@ -8,6 +8,11 @@ | |||
8 | use std::iter; | 8 | use std::iter; |
9 | use std::sync::Arc; | 9 | use std::sync::Arc; |
10 | 10 | ||
11 | use hir_def::{ | ||
12 | path::{GenericArg, PathSegment}, | ||
13 | type_ref::{TypeBound, TypeRef}, | ||
14 | }; | ||
15 | |||
11 | use super::{ | 16 | use super::{ |
12 | FnSig, GenericPredicate, ProjectionPredicate, ProjectionTy, Substs, TraitRef, Ty, TypeCtor, | 17 | FnSig, GenericPredicate, ProjectionPredicate, ProjectionTy, Substs, TraitRef, Ty, TypeCtor, |
13 | TypeWalk, | 18 | TypeWalk, |
@@ -18,10 +23,8 @@ use crate::{ | |||
18 | generics::HasGenericParams, | 23 | generics::HasGenericParams, |
19 | generics::{GenericDef, WherePredicate}, | 24 | generics::{GenericDef, WherePredicate}, |
20 | nameres::Namespace, | 25 | nameres::Namespace, |
21 | path::{GenericArg, PathSegment}, | ||
22 | resolve::{Resolver, TypeNs}, | 26 | resolve::{Resolver, TypeNs}, |
23 | ty::Adt, | 27 | ty::Adt, |
24 | type_ref::{TypeBound, TypeRef}, | ||
25 | util::make_mut_slice, | 28 | util::make_mut_slice, |
26 | BuiltinType, Const, Enum, EnumVariant, Function, ModuleDef, Path, Static, Struct, StructField, | 29 | BuiltinType, Const, Enum, EnumVariant, Function, ModuleDef, Path, Static, Struct, StructField, |
27 | Trait, TypeAlias, Union, | 30 | Trait, TypeAlias, Union, |
diff --git a/crates/ra_hir/src/ty/method_resolution.rs b/crates/ra_hir/src/ty/method_resolution.rs index 50583a142..eb69344f6 100644 --- a/crates/ra_hir/src/ty/method_resolution.rs +++ b/crates/ra_hir/src/ty/method_resolution.rs | |||
@@ -15,8 +15,7 @@ use crate::{ | |||
15 | resolve::Resolver, | 15 | resolve::Resolver, |
16 | ty::primitive::{FloatBitness, UncertainFloatTy, UncertainIntTy}, | 16 | ty::primitive::{FloatBitness, UncertainFloatTy, UncertainIntTy}, |
17 | ty::{Ty, TypeCtor}, | 17 | ty::{Ty, TypeCtor}, |
18 | type_ref::Mutability, | 18 | AssocItem, Crate, Function, Module, Mutability, Name, Trait, |
19 | AssocItem, Crate, Function, Module, Name, Trait, | ||
20 | }; | 19 | }; |
21 | 20 | ||
22 | /// This is used as a key for indexing impls. | 21 | /// This is used as a key for indexing impls. |
diff --git a/crates/ra_hir/src/ty/traits/chalk.rs b/crates/ra_hir/src/ty/traits/chalk.rs index ab66515be..39ef92182 100644 --- a/crates/ra_hir/src/ty/traits/chalk.rs +++ b/crates/ra_hir/src/ty/traits/chalk.rs | |||
@@ -9,6 +9,8 @@ use chalk_ir::{ | |||
9 | }; | 9 | }; |
10 | use chalk_rust_ir::{AssociatedTyDatum, ImplDatum, StructDatum, TraitDatum}; | 10 | use chalk_rust_ir::{AssociatedTyDatum, ImplDatum, StructDatum, TraitDatum}; |
11 | 11 | ||
12 | use hir_expand::name; | ||
13 | |||
12 | use ra_db::salsa::{InternId, InternKey}; | 14 | use ra_db::salsa::{InternId, InternKey}; |
13 | 15 | ||
14 | use super::{Canonical, ChalkContext, Impl, Obligation}; | 16 | use super::{Canonical, ChalkContext, Impl, Obligation}; |
@@ -734,7 +736,7 @@ fn closure_fn_trait_impl_datum( | |||
734 | substs: Substs::build_for_def(db, trait_).push(self_ty).push(arg_ty).build(), | 736 | substs: Substs::build_for_def(db, trait_).push(self_ty).push(arg_ty).build(), |
735 | }; | 737 | }; |
736 | 738 | ||
737 | let output_ty_id = fn_once_trait.associated_type_by_name(db, &crate::name::OUTPUT_TYPE)?; | 739 | let output_ty_id = fn_once_trait.associated_type_by_name(db, &name::OUTPUT_TYPE)?; |
738 | 740 | ||
739 | let output_ty_value = chalk_rust_ir::AssociatedTyValue { | 741 | let output_ty_value = chalk_rust_ir::AssociatedTyValue { |
740 | associated_ty_id: output_ty_id.to_chalk(db), | 742 | associated_ty_id: output_ty_id.to_chalk(db), |