diff options
Diffstat (limited to 'crates/ra_hir/src/ids.rs')
-rw-r--r-- | crates/ra_hir/src/ids.rs | 24 |
1 files changed, 2 insertions, 22 deletions
diff --git a/crates/ra_hir/src/ids.rs b/crates/ra_hir/src/ids.rs index 311c0b98a..cbe31f830 100644 --- a/crates/ra_hir/src/ids.rs +++ b/crates/ra_hir/src/ids.rs | |||
@@ -313,19 +313,7 @@ pub struct DefLoc { | |||
313 | } | 313 | } |
314 | 314 | ||
315 | #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] | 315 | #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] |
316 | pub(crate) enum DefKind { | 316 | pub(crate) enum DefKind {} |
317 | Item, | ||
318 | // /// The constructor of a struct. E.g. if we have `struct Foo(usize)`, the | ||
319 | // /// name `Foo` needs to resolve to different types depending on whether we | ||
320 | // /// are in the types or values namespace: As a type, `Foo` of course refers | ||
321 | // /// to the struct `Foo`; as a value, `Foo` is a callable type with signature | ||
322 | // /// `(usize) -> Foo`. The cleanest approach to handle this seems to be to | ||
323 | // /// have different defs in the two namespaces. | ||
324 | // /// | ||
325 | // /// rustc does the same; note that it even creates a struct constructor if | ||
326 | // /// the struct isn't a tuple struct (see `CtorKind::Fictive` in rustc). | ||
327 | // StructCtor, | ||
328 | } | ||
329 | 317 | ||
330 | impl DefId { | 318 | impl DefId { |
331 | pub(crate) fn loc(self, db: &impl AsRef<HirInterner>) -> DefLoc { | 319 | pub(crate) fn loc(self, db: &impl AsRef<HirInterner>) -> DefLoc { |
@@ -334,15 +322,7 @@ impl DefId { | |||
334 | 322 | ||
335 | pub fn resolve(self, db: &impl HirDatabase) -> Def { | 323 | pub fn resolve(self, db: &impl HirDatabase) -> Def { |
336 | let loc = self.loc(db); | 324 | let loc = self.loc(db); |
337 | match loc.kind { | 325 | match loc.kind {} |
338 | DefKind::Item => Def::Item, | ||
339 | } | ||
340 | } | ||
341 | } | ||
342 | |||
343 | impl DefLoc { | ||
344 | pub(crate) fn id(&self, db: &impl AsRef<HirInterner>) -> DefId { | ||
345 | db.as_ref().defs.loc2id(&self) | ||
346 | } | 326 | } |
347 | } | 327 | } |
348 | 328 | ||