diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-01-19 18:03:36 +0000 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-01-19 18:03:36 +0000 |
commit | 1c296d54e3dcc36c1a778873f26035000a352ba2 (patch) | |
tree | 0a6ce660ee32080287284c93bffaaaada91f3584 /crates/ra_hir/src/ids.rs | |
parent | bade91db081a3465dea3547ab8ab669f78fde9dc (diff) | |
parent | 5f3509e140d19b989db418a00ac6778c622cde5d (diff) |
Merge #576
576: Beginnings of generics r=matklad a=flodiebold
This implements the beginnings of the generics infrastructure; generic parameters for structs work and are correctly substituted in fields. Functions and methods aren't handled at all yet (as the tests show).
The name resolution in `ty` really needs refactoring now, I hope to do that next ;)
Co-authored-by: Florian Diebold <[email protected]>
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 | ||