From fa7f9d696f5863dbf28b3d0ef14c1bc9143b2d21 Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Sun, 13 Jan 2019 11:58:41 +0100 Subject: Make Module impl methods crate-private, update some comments --- crates/ra_hir/src/ids.rs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'crates/ra_hir/src/ids.rs') 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 { Type, Item, + /// The constructor of a struct. E.g. if we have `struct Foo(usize)`, the + /// name `Foo` needs to resolve to different types depending on whether we + /// are in the types or values namespace: As a type, `Foo` of course refers + /// to the struct `Foo`; as a value, `Foo` is a callable type with signature + /// `(usize) -> Foo`. The cleanest approach to handle this seems to be to + /// have different defs in the two namespaces. + /// + /// rustc does the same; note that it even creates a struct constructor if + /// the struct isn't a tuple struct (see `CtorKind::Fictive` in rustc). StructCtor, } -- cgit v1.2.3