diff options
Diffstat (limited to 'crates/ra_hir/src/ids.rs')
-rw-r--r-- | crates/ra_hir/src/ids.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/crates/ra_hir/src/ids.rs b/crates/ra_hir/src/ids.rs index 0d8e67547..c5408e277 100644 --- a/crates/ra_hir/src/ids.rs +++ b/crates/ra_hir/src/ids.rs | |||
@@ -151,6 +151,15 @@ pub(crate) enum DefKind { | |||
151 | Type, | 151 | Type, |
152 | Item, | 152 | Item, |
153 | 153 | ||
154 | /// The constructor of a struct. E.g. if we have `struct Foo(usize)`, the | ||
155 | /// name `Foo` needs to resolve to different types depending on whether we | ||
156 | /// are in the types or values namespace: As a type, `Foo` of course refers | ||
157 | /// to the struct `Foo`; as a value, `Foo` is a callable type with signature | ||
158 | /// `(usize) -> Foo`. The cleanest approach to handle this seems to be to | ||
159 | /// have different defs in the two namespaces. | ||
160 | /// | ||
161 | /// rustc does the same; note that it even creates a struct constructor if | ||
162 | /// the struct isn't a tuple struct (see `CtorKind::Fictive` in rustc). | ||
154 | StructCtor, | 163 | StructCtor, |
155 | } | 164 | } |
156 | 165 | ||