You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/glossary.md
+11-1
Original file line number
Diff line number
Diff line change
@@ -6,22 +6,30 @@ The compiler uses a number of...idiosyncratic abbreviations and things. This glo
6
6
Term | Meaning
7
7
------------------------|--------
8
8
AST | the abstract syntax tree produced by the syntax crate; reflects user syntax very closely.
9
+
binder | a "binder" is a place where a variable or type is declared; for example, the `<T>` is a binder for the generic type parameter `T` in `fn foo<T>(..)`, and `|a| ...` is a binder for the parameter `a`. See [the background chapter for more](./background.html#free-vs-bound)
10
+
bound variable | a "bound variable" is one that is declared within an expression/term. For example, the variable `a` is bound within the closure expession `|a| a * 2`. See [the background chapter for more](./background.html#free-vs-bound)
9
11
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.
12
+
control-flow graph | a representation of the control-flow of a program; see [the background chapter for more](./background.html#cfg)
10
13
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").
11
14
cx | we tend to use "cx" as an abbrevation for context. See also `tcx`, `infcx`, etc.
12
15
DAG | a directed acyclic graph is used during compilation to keep track of dependencies between queries. ([see more](incremental-compilation.html))
16
+
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](./background.html#dataflow)
13
17
DefId | an index identifying a definition (see `librustc/hir/def_id.rs`). Uniquely identifies a `DefPath`.
14
18
HIR | the High-level IR, created by lowering and desugaring the AST ([see more](hir.html))
15
19
HirId | identifies a particular node in the HIR by combining a def-id with an "intra-definition offset".
16
20
HIR Map | The HIR map, accessible via tcx.hir, allows you to quickly navigate the HIR and convert between various forms of identifiers.
21
+
free variable | a "free variable" is one that is not bound within an expression or term; see [the background chapter for more](./background.html#free-vs-bound)
17
22
'gcx | the lifetime of the global arena ([see more](ty.html))
18
23
generics | the set of generic type parameters defined on a type or item
19
24
ICE | internal compiler error. When the compiler crashes.
20
25
ICH | incremental compilation hash. ICHs are used as fingerprints for things such as HIR and crate metadata, to check if changes have been made. This is useful in incremental compilation to see if part of a crate has changed and should be recompiled.
21
-
inference variable | when doing type or region inference, an "inference variable" is a kind of special type/region that represents value you are trying to find. Think of `X` in algebra.
26
+
inference variable | when doing type or region inference, an "inference variable" is a kind of special type/region that represents what you are trying to infer. Think of X in algebra. For example, if we are trying to infer the type of a variable in a program, we create an inference variable to represent that unknown type.
22
27
infcx | the inference context (see `librustc/infer`)
23
28
MIR | the Mid-level IR that is created after type-checking for use by borrowck and trans ([see more](./mir.html))
24
29
miri | an interpreter for MIR used for constant evaluation ([see more](./miri.html))
30
+
NLL | [non-lexical lifetimes](./mir-regionck.html), an extension to Rust's borrowing system to make it be based on the control-flow graph.
31
+
promoted constants | constants extracted from a function and lifted to static scope; see [this section](./mir.html#promoted) for more details.
32
+
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](./background.html#quantified)
25
33
obligation | something that must be proven by the trait system ([see more](trait-resolution.html))
26
34
local crate | the crate currently being compiled.
27
35
MIR | the Mid-level IR that is created after type-checking for use by borrowck and trans ([see more](./mir.html))
@@ -33,6 +41,7 @@ query | perhaps some sub-computation during compilation ([see
33
41
region | another term for "lifetime" often used in the literature and in the borrow checker.
34
42
sess | the compiler session, which stores global data used throughout compilation
35
43
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.
44
+
skolemization | a way of handling subtyping around "for-all" types (e.g., `for<'a> fn(&'a u32)` as well as solving higher-ranked trait bounds (e.g., `for<'a> T: Trait<'a>`). See [the chapter on skolemization and universes](./mir-regionck.html#skol) for more details.
36
45
sigil | like a keyword but composed entirely of non-alphanumeric tokens. For example, `&` is a sigil for references.
37
46
soundness | soundness is a technical term in type theory. Roughly, if a type system is sound, then if a program type-checks, it is type-safe; i.e. I can never (in safe rust) force a value into a variable of the wrong type. (see "completeness").
38
47
span | a location in the user's source code, used for error reporting primarily. These are like a file-name/line-number/column tuple on steroids: they carry a start/end point, and also track macro expansions and compiler desugaring. All while being packed into a few bytes (really, it's an index into a table). See the Span datatype for more.
@@ -43,3 +52,4 @@ token | the smallest unit of parsing. Tokens are produced aft
43
52
trans | the code to translate MIR into LLVM IR.
44
53
trait reference | a trait and values for its type parameters ([see more](ty.html)).
45
54
ty | the internal representation of a type ([see more](ty.html)).
55
+
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 for more](./background.html#variance).
0 commit comments