Skip to content

Commit 909b4d1

Browse files
committed
Define inhabited/uninhabited in glossary.
Signed-off-by: David Wood <[email protected]>
1 parent 363a64a commit 909b4d1

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/glossary.md

+14
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,12 @@ For example, `2 + (3 * 4)` is an expression that returns the value 14.
6565
An [item] that is not a member of an [implementation], such as a *free
6666
function* or a *free const*. Contrast to an [associated item].
6767

68+
### Inhabited
69+
70+
A type is inhabited if it has constructors and therefore can be instantiated. An inhabited type is
71+
not "empty" in the sense that there can be values of the type. Opposite of
72+
[Uninhabited](#uninhabited).
73+
6874
### Inherent implementation
6975

7076
An [implementation] that applies to a nominal type, not to a trait-type pair.
@@ -159,6 +165,13 @@ but is not limited to: process termination or corruption; improper, incorrect,
159165
or unintended computation; or platform-specific results.
160166
[More][undefined-behavior].
161167

168+
### Uninhabited
169+
170+
A type is uninhabited if it has no constructors and therefore can never be instantiated. An
171+
uninhabited type is "empty" in the sense that there are no values of the type. The canonical
172+
example of an uninhabited type is the [never type] `!`, or an enum with no variants
173+
`enum Never { }`. Opposite of [Inhabited](#inhabited).
174+
162175
[alignment]: type-layout.md#size-and-alignment
163176
[associated item]: #associated-item
164177
[enums]: items/enumerations.md
@@ -168,6 +181,7 @@ or unintended computation; or platform-specific results.
168181
[inherent implementation]: items/implementations.md#inherent-implementations
169182
[item]: items.md
170183
[method]: items/associated-items.md#methods
184+
[never type]: types/never.md
171185
[object safety]: items/traits.md#object-safety
172186
[structs]: items/structs.md
173187
[trait objects]: types/trait-object.md

0 commit comments

Comments
 (0)