aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_def/src/resolver.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir_def/src/resolver.rs')
-rw-r--r--crates/ra_hir_def/src/resolver.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/crates/ra_hir_def/src/resolver.rs b/crates/ra_hir_def/src/resolver.rs
index 17b2169d2..b6d595a20 100644
--- a/crates/ra_hir_def/src/resolver.rs
+++ b/crates/ra_hir_def/src/resolver.rs
@@ -2,7 +2,7 @@
2use std::sync::Arc; 2use std::sync::Arc;
3 3
4use hir_expand::{ 4use hir_expand::{
5 name::{self, Name}, 5 name::{name, Name},
6 MacroDefId, 6 MacroDefId,
7}; 7};
8use ra_db::CrateId; 8use ra_db::CrateId;
@@ -163,13 +163,13 @@ impl Resolver {
163 } 163 }
164 } 164 }
165 Scope::ImplBlockScope(impl_) => { 165 Scope::ImplBlockScope(impl_) => {
166 if first_name == &name::SELF_TYPE { 166 if first_name == &name![Self] {
167 let idx = if path.segments.len() == 1 { None } else { Some(1) }; 167 let idx = if path.segments.len() == 1 { None } else { Some(1) };
168 return Some((TypeNs::SelfType(*impl_), idx)); 168 return Some((TypeNs::SelfType(*impl_), idx));
169 } 169 }
170 } 170 }
171 Scope::AdtScope(adt) => { 171 Scope::AdtScope(adt) => {
172 if first_name == &name::SELF_TYPE { 172 if first_name == &name![Self] {
173 let idx = if path.segments.len() == 1 { None } else { Some(1) }; 173 let idx = if path.segments.len() == 1 { None } else { Some(1) };
174 return Some((TypeNs::AdtSelfType(*adt), idx)); 174 return Some((TypeNs::AdtSelfType(*adt), idx));
175 } 175 }
@@ -223,7 +223,7 @@ impl Resolver {
223 return None; 223 return None;
224 } 224 }
225 let n_segments = path.segments.len(); 225 let n_segments = path.segments.len();
226 let tmp = name::SELF_PARAM; 226 let tmp = name![self];
227 let first_name = if path.is_self() { &tmp } else { &path.segments.first()?.name }; 227 let first_name = if path.is_self() { &tmp } else { &path.segments.first()?.name };
228 let skip_to_mod = path.kind != PathKind::Plain && !path.is_self(); 228 let skip_to_mod = path.kind != PathKind::Plain && !path.is_self();
229 for scope in self.scopes.iter().rev() { 229 for scope in self.scopes.iter().rev() {
@@ -259,13 +259,13 @@ impl Resolver {
259 Scope::GenericParams { .. } => continue, 259 Scope::GenericParams { .. } => continue,
260 260
261 Scope::ImplBlockScope(impl_) if n_segments > 1 => { 261 Scope::ImplBlockScope(impl_) if n_segments > 1 => {
262 if first_name == &name::SELF_TYPE { 262 if first_name == &name![Self] {
263 let ty = TypeNs::SelfType(*impl_); 263 let ty = TypeNs::SelfType(*impl_);
264 return Some(ResolveValueResult::Partial(ty, 1)); 264 return Some(ResolveValueResult::Partial(ty, 1));
265 } 265 }
266 } 266 }
267 Scope::AdtScope(adt) if n_segments > 1 => { 267 Scope::AdtScope(adt) if n_segments > 1 => {
268 if first_name == &name::SELF_TYPE { 268 if first_name == &name![Self] {
269 let ty = TypeNs::AdtSelfType(*adt); 269 let ty = TypeNs::AdtSelfType(*adt);
270 return Some(ResolveValueResult::Partial(ty, 1)); 270 return Some(ResolveValueResult::Partial(ty, 1));
271 } 271 }
@@ -439,10 +439,10 @@ impl Scope {
439 } 439 }
440 } 440 }
441 Scope::ImplBlockScope(i) => { 441 Scope::ImplBlockScope(i) => {
442 f(name::SELF_TYPE, ScopeDef::ImplSelfType((*i).into())); 442 f(name![Self], ScopeDef::ImplSelfType((*i).into()));
443 } 443 }
444 Scope::AdtScope(i) => { 444 Scope::AdtScope(i) => {
445 f(name::SELF_TYPE, ScopeDef::AdtSelfType((*i).into())); 445 f(name![Self], ScopeDef::AdtSelfType((*i).into()));
446 } 446 }
447 Scope::ExprScope(scope) => { 447 Scope::ExprScope(scope) => {
448 scope.expr_scopes.entries(scope.scope_id).iter().for_each(|e| { 448 scope.expr_scopes.entries(scope.scope_id).iter().for_each(|e| {