Skip to content

Commit 43f7be6

Browse files
authored
Merge pull request #152 from mark-i-m/glossary_more
add a bunch of type-related terms to glossary (and few others)
2 parents b43d988 + 4a8412f commit 43f7be6

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/appendix/glossary.md

+7
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,14 @@ bound variable | a "bound variable" is one that is declared within an
1212
codegen unit | when we produce LLVM IR, we group the Rust code into a number of codegen units. Each of these units is processed by LLVM independently from one another, enabling parallelism. They are also the unit of incremental re-use.
1313
completeness | completeness is a technical term in type theory. Completeness means that every type-safe program also type-checks. Having both soundness and completeness is very hard, and usually soundness is more important. (see "soundness").
1414
control-flow graph | a representation of the control-flow of a program; see [the background chapter for more](./appendix/background.html#cfg)
15+
CTFE | Compile-Time Function Evaluation. This is the ability of the compiler to evaluate `const fn`s at compile time. This is part of the compiler's constant evaluation system. ([see more](./const-eval.html))
1516
cx | we tend to use "cx" as an abbrevation for context. See also `tcx`, `infcx`, etc.
1617
DAG | a directed acyclic graph is used during compilation to keep track of dependencies between queries. ([see more](incremental-compilation.html))
1718
data-flow analysis | a static analysis that figures out what properties are true at each point in the control-flow of a program; see [the background chapter for more](./appendix/background.html#dataflow)
1819
DefId | an index identifying a definition (see `librustc/hir/def_id.rs`). Uniquely identifies a `DefPath`.
1920
Double pointer | a pointer with additional metadata. See "fat pointer" for more.
21+
DST | Dynamically-Sized Type. A type for which the compiler cannot statically know the size in memory (e.g. `str` or `[u8]`). Such types don't implement `Sized` and cannot be allocated on the stack. They can only occur as the last field in a struct. They can only be used behind a pointer (e.g. `&str` or `&[u8]`).
22+
empty type | see "uninhabited type".
2023
Fat pointer | a two word value carrying the address of some value, along with some further information necessary to put the value to use. Rust includes two kinds of "fat pointers": references to slices, and trait objects. A reference to a slice carries the starting address of the slice and its length. A trait object carries a value's address and a pointer to the trait's implementation appropriate to that value. "Fat pointers" are also known as "wide pointers", and "double pointers".
2124
free variable | a "free variable" is one that is not bound within an expression or term; see [the background chapter for more](./appendix/background.html#free-vs-bound)
2225
'gcx | the lifetime of the global arena ([see more](ty.html))
@@ -45,6 +48,7 @@ provider | the function that executes a query ([see more](query.
4548
quantified | in math or logic, existential and universal quantification are used to ask questions like "is there any type T for which is true?" or "is this true for all types T?"; see [the background chapter for more](./appendix/background.html#quantified)
4649
query | perhaps some sub-computation during compilation ([see more](query.html))
4750
region | another term for "lifetime" often used in the literature and in the borrow checker.
51+
rib | a data structure in the name resolver that keeps track of a single scope for names. ([see more](./name-resolution.html))
4852
sess | the compiler session, which stores global data used throughout compilation
4953
side tables | because the AST and HIR are immutable once created, we often carry extra information about them in the form of hashtables, indexed by the id of a particular node.
5054
sigil | like a keyword but composed entirely of non-alphanumeric tokens. For example, `&` is a sigil for references.
@@ -61,8 +65,11 @@ trans | the code to translate MIR into LLVM IR.
6165
trait reference | a trait and values for its type parameters ([see more](ty.html)).
6266
ty | the internal representation of a type ([see more](ty.html)).
6367
UFCS | Universal Function Call Syntax. An unambiguous syntax for calling a method ([see more](type-checking.html)).
68+
uninhabited type | a type which has _no_ values. This is not the same as a ZST, which has exactly 1 value. An example of an uninhabited type is `enum Foo {}`, which has no variants, and so, can never be created. The compiler can treat code that deals with uninhabited types as dead code, since there is no such value to be manipulated. `!` (the never type) is an uninhabited type. Uninhabited types are also called "empty types".
69+
upvar | a variable captured by a closure from outside the closure.
6470
variance | variance determines how changes to a generic type/lifetime parameter affect subtyping; for example, if `T` is a subtype of `U`, then `Vec<T>` is a subtype `Vec<U>` because `Vec` is *covariant* in its generic parameter. See [the background chapter](./appendix/background.html#variance) for a more general explanation. See the [variance chapter](./variance.html) for an explanation of how type checking handles variance.
6571
Wide pointer | a pointer with additional metadata. See "fat pointer" for more.
72+
ZST | Zero-Sized Type. A type whose values have size 0 bytes. Since `2^0 = 1`, such types can have exactly one value. For example, `()` (unit) is a ZST. `struct Foo;` is also a ZST. The compiler can do some nice optimizations around ZSTs.
6673

6774
[LLVM]: https://llvm.org/
6875
[lto]: https://llvm.org/docs/LinkTimeOptimization.html

0 commit comments

Comments
 (0)