aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/ty
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir/src/ty')
-rw-r--r--crates/ra_hir/src/ty/infer.rs13
1 files changed, 7 insertions, 6 deletions
diff --git a/crates/ra_hir/src/ty/infer.rs b/crates/ra_hir/src/ty/infer.rs
index 973de70df..41980a325 100644
--- a/crates/ra_hir/src/ty/infer.rs
+++ b/crates/ra_hir/src/ty/infer.rs
@@ -40,6 +40,7 @@ use crate::{
40 PatId, Statement, UnaryOp, 40 PatId, Statement, UnaryOp,
41 }, 41 },
42 generics::{GenericParams, HasGenericParams}, 42 generics::{GenericParams, HasGenericParams},
43 name::{SELF_TYPE, INTO_ITERATOR, ITEM, ITER, STD},
43 nameres::{Namespace, PerNs}, 44 nameres::{Namespace, PerNs},
44 path::{GenericArg, GenericArgs, PathKind, PathSegment}, 45 path::{GenericArg, GenericArgs, PathKind, PathSegment},
45 resolve::{ 46 resolve::{
@@ -48,7 +49,7 @@ use crate::{
48 }, 49 },
49 ty::infer::diagnostics::InferenceDiagnostic, 50 ty::infer::diagnostics::InferenceDiagnostic,
50 type_ref::{Mutability, TypeRef}, 51 type_ref::{Mutability, TypeRef},
51 AdtDef, AsName, ConstData, DefWithBody, FnData, Function, HirDatabase, ImplItem, KnownName, 52 AdtDef, ConstData, DefWithBody, FnData, Function, HirDatabase, ImplItem,
52 ModuleDef, Name, Path, StructField, 53 ModuleDef, Name, Path, StructField,
53}; 54};
54 55
@@ -842,7 +843,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> {
842 // Parent arguments are unknown, except for the receiver type 843 // Parent arguments are unknown, except for the receiver type
843 if let Some(parent_generics) = def_generics.and_then(|p| p.parent_params.clone()) { 844 if let Some(parent_generics) = def_generics.and_then(|p| p.parent_params.clone()) {
844 for param in &parent_generics.params { 845 for param in &parent_generics.params {
845 if param.name.as_known_name() == Some(crate::KnownName::SelfType) { 846 if param.name == SELF_TYPE {
846 substs.push(receiver_ty.clone()); 847 substs.push(receiver_ty.clone());
847 } else { 848 } else {
848 substs.push(Ty::Unknown); 849 substs.push(Ty::Unknown);
@@ -1346,15 +1347,15 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> {
1346 let into_iter_path = Path { 1347 let into_iter_path = Path {
1347 kind: PathKind::Abs, 1348 kind: PathKind::Abs,
1348 segments: vec![ 1349 segments: vec![
1349 PathSegment { name: KnownName::Std.as_name(), args_and_bindings: None }, 1350 PathSegment { name: STD, args_and_bindings: None },
1350 PathSegment { name: KnownName::Iter.as_name(), args_and_bindings: None }, 1351 PathSegment { name: ITER, args_and_bindings: None },
1351 PathSegment { name: KnownName::IntoIterator.as_name(), args_and_bindings: None }, 1352 PathSegment { name: INTO_ITERATOR, args_and_bindings: None },
1352 ], 1353 ],
1353 }; 1354 };
1354 1355
1355 match self.resolver.resolve_path_segments(self.db, &into_iter_path).into_fully_resolved() { 1356 match self.resolver.resolve_path_segments(self.db, &into_iter_path).into_fully_resolved() {
1356 PerNs { types: Some(Def(Trait(trait_))), .. } => { 1357 PerNs { types: Some(Def(Trait(trait_))), .. } => {
1357 Some(trait_.associated_type_by_name(self.db, KnownName::Item.as_name())?) 1358 Some(trait_.associated_type_by_name(self.db, ITEM)?)
1358 } 1359 }
1359 _ => None, 1360 _ => None,
1360 } 1361 }