diff options
Diffstat (limited to 'crates/hir_def')
-rw-r--r-- | crates/hir_def/src/path.rs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/crates/hir_def/src/path.rs b/crates/hir_def/src/path.rs index 0e60dc2b6..8c923bb7b 100644 --- a/crates/hir_def/src/path.rs +++ b/crates/hir_def/src/path.rs | |||
@@ -9,7 +9,10 @@ use std::{ | |||
9 | 9 | ||
10 | use crate::{body::LowerCtx, type_ref::LifetimeRef}; | 10 | use crate::{body::LowerCtx, type_ref::LifetimeRef}; |
11 | use base_db::CrateId; | 11 | use base_db::CrateId; |
12 | use hir_expand::{hygiene::Hygiene, name::Name}; | 12 | use hir_expand::{ |
13 | hygiene::Hygiene, | ||
14 | name::{name, Name}, | ||
15 | }; | ||
13 | use syntax::ast; | 16 | use syntax::ast; |
14 | 17 | ||
15 | use crate::{ | 18 | use crate::{ |
@@ -209,6 +212,12 @@ impl Path { | |||
209 | }; | 212 | }; |
210 | Some(res) | 213 | Some(res) |
211 | } | 214 | } |
215 | |||
216 | pub fn is_self_type(&self) -> bool { | ||
217 | self.type_anchor.is_none() | ||
218 | && self.generic_args == &[None] | ||
219 | && self.mod_path.as_ident() == Some(&name!(Self)) | ||
220 | } | ||
212 | } | 221 | } |
213 | 222 | ||
214 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 223 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |