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
* Update glossary.md
- Added additional information to some of the definitions.
- Made term capitalization consistent so that only terms which refer to acronyms or concrete types are capitalized. Please let me know if that isn't desirable for some reason.
* Update src/appendix/glossary.md
Co-authored-by: Joshua Nelson <[email protected]>
* Update src/appendix/glossary.md
Co-authored-by: Léo Lanteri Thauvin <[email protected]>
* Update src/appendix/glossary.md
Co-authored-by: Joshua Nelson <[email protected]>
Co-authored-by: Léo Lanteri Thauvin <[email protected]>
Copy file name to clipboardExpand all lines: src/appendix/glossary.md
+16-16Lines changed: 16 additions & 16 deletions
Original file line number
Diff line number
Diff line change
@@ -18,21 +18,21 @@ Term | Meaning
18
18
<spanid="data-flow">data-flow analysis</span> | 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.md#dataflow).
19
19
<spanid="debruijn">DeBruijn Index</span> | A technique for describing which binder a variable is bound by using only integers. It has the benefit that it is invariant under variable renaming. ([see more](./background.md#what-is-a-debruijn-index))
20
20
<spanid="def-id">DefId</span> | An index identifying a definition (see `rustc_middle/src/hir/def_id.rs`). Uniquely identifies a `DefPath`. See [the HIR chapter for more](../hir.md#identifiers-in-the-hir).
21
-
<spanid="discriminant">Discriminant</span> | The underlying value associated with an enum variant or generator state to indicate it as "active" (but not to be confused with its ["variant index"](#variant-idx)). At runtime, the discriminant of the active variant is encoded in the [tag](#tag).
22
-
<spanid="double-ptr">Double pointer</span> | A pointer with additional metadata. See "fat pointer" for more.
21
+
<spanid="discriminant">discriminant</span> | The underlying value associated with an enum variant or generator state to indicate it as "active" (but not to be confused with its ["variant index"](#variant-idx)). At runtime, the discriminant of the active variant is encoded in the [tag](#tag).
22
+
<spanid="double-ptr">double pointer</span> | A pointer with additional metadata. See "fat pointer" for more.
23
23
<spanid="drop-glue">drop glue</span> | (internal) compiler-generated instructions that handle calling the destructors (`Drop`) for data types.
24
24
<spanid="dst">DST</span> | Short for Dynamically-Sized Type, this is 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]`).
25
25
<spanid="ebl">early-bound lifetime</span> | A lifetime region that is substituted at its definition site. Bound in an item's `Generics` and substituted using a `Substs`. Contrast with **late-bound lifetime**. ([see more](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/enum.RegionKind.html#bound-regions))
26
26
<spanid="empty-type">empty type</span> | see "uninhabited type".
27
-
<spanid="fat-ptr">Fat pointer</span> | 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".
27
+
<spanid="fat-ptr">fat pointer</span> | 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".
28
28
<spanid="free-var">free variable</span> | A "free variable" is one that is not bound within an expression or term; see [the background chapter for more](./background.md#free-vs-bound)
29
29
<spanid="generics">generics</span> | The set of generic type parameters defined on a type or item.
30
30
<spanid="hir">HIR</span> | The High-level IR, created by lowering and desugaring the AST. ([see more](../hir.md))
31
31
<spanid="hir-id">HirId</span> | Identifies a particular node in the HIR by combining a def-id with an "intra-definition offset". See [the HIR chapter for more](../hir.md#identifiers-in-the-hir).
32
-
<spanid="hir-map">HIR Map</span> | The HIR map, accessible via tcx.hir, allows you to quickly navigate the HIR and convert between various forms of identifiers.
32
+
<spanid="hir-map">HIR map</span> | The HIR map, accessible via `tcx.hir()`, allows you to quickly navigate the HIR and convert between various forms of identifiers.
33
33
<spanid="ice">ICE</span> | Short for internal compiler error, this is when the compiler crashes.
34
34
<spanid="ich">ICH</span> | Short for incremental compilation hash, these 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.
35
-
<spanid="infcx">infcx</span> | The inference context (see `rustc_middle::infer`)
35
+
<spanid="infcx">infcx</span> | The type inference context (`InferCtxt`). (see `rustc_middle::infer`)
36
36
<spanid="inf-var">inference variable</span> | 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.
37
37
<spanid="intern">intern</span> | Interning refers to storing certain frequently-used constant data, such as strings, and then referring to the data by an identifier (e.g. a `Symbol`) rather than the data itself, to reduce memory usage and number of allocations. See [this chapter](../memory.md) for more info.
38
38
<spanid="intrinsic">intrinsic</span> | Intrinsics are special functions that are implemented in the compiler itself but exposed (often unstably) to users. They do magical and dangerous things. (See [`std::intrinsics`](https://doc.rust-lang.org/std/intrinsics/index.html))
@@ -41,7 +41,7 @@ Term | Meaning
41
41
<spanid="item">item</span> | A kind of "definition" in the language, such as a static, const, use statement, module, struct, etc. Concretely, this corresponds to the `Item` type.
42
42
<spanid="lang-item">lang item</span> | Items that represent concepts intrinsic to the language itself, such as special built-in traits like `Sync` and `Send`; or traits representing operations such as `Add`; or functions that are called by the compiler. ([see more](https://doc.rust-lang.org/1.9.0/book/lang-items.html))
43
43
<spanid="lbl">late-bound lifetime</span> | A lifetime region that is substituted at its call site. Bound in a HRTB and substituted by specific functions in the compiler, such as `liberate_late_bound_regions`. Contrast with **early-bound lifetime**. ([see more](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/enum.RegionKind.html#bound-regions))
44
-
<spanid="local-crate">local crate</span> | The crate currently being compiled.
44
+
<spanid="local-crate">local crate</span> | The crate currently being compiled. This is in contrast to "upstream crates" which refer to dependencies of the local crate.
45
45
<spanid="lto">LTO</span> | Short for Link-Time Optimizations, this is a set of optimizations offered by LLVM that occur just before the final binary is linked. These include optimizations like removing functions that are never used in the final program, for example. _ThinLTO_ is a variant of LTO that aims to be a bit more scalable and efficient, but possibly sacrifices some optimizations. You may also read issues in the Rust repo about "FatLTO", which is the loving nickname given to non-Thin LTO. LLVM documentation: [here][lto] and [here][thinlto].
46
46
<spanid="llvm">[LLVM]</span> | (actually not an acronym :P) an open-source compiler backend. It accepts LLVM IR and outputs native binaries. Various languages (e.g. Rust) can then implement a compiler front-end that outputs LLVM IR and use LLVM to compile to all the platforms LLVM supports.
47
47
<spanid="memoization">memoization</span> | The process of storing the results of (pure) computations (such as pure function calls) to avoid having to repeat them in the future. This is typically a trade-off between execution speed and memory usage.
@@ -50,7 +50,7 @@ Term | Meaning
50
50
<spanid="mono">monomorphization</span> | The process of taking generic implementations of types and functions and instantiating them with concrete types. For example, in the code we might have `Vec<T>`, but in the final executable, we will have a copy of the `Vec` code for every concrete type used in the program (e.g. a copy for `Vec<usize>`, a copy for `Vec<MyStruct>`, etc).
51
51
<spanid="normalize">normalize</span> | A general term for converting to a more canonical form, but in the case of rustc typically refers to [associated type normalization](../traits/goals-and-clauses.md#normalizeprojection---type).
52
52
<spanid="newtype">newtype</span> | A wrapper around some other type (e.g., `struct Foo(T)` is a "newtype" for `T`). This is commonly used in Rust to give a stronger type for indices.
53
-
<spanid="niche">Niche</span> | Invalid bit patterns for a type *that can be used* for layout optimizations. Some types cannot have certain bit patterns. For example, the `NonZero*` integers or the reference `&T` cannot be represented by a 0 bitstring. This means the compiler can perform layout optimizations by taking advantage of the invalid "niche value". An example application for this is the [*Discriminant elision on `Option`-like enums*](https://rust-lang.github.io/unsafe-code-guidelines/layout/enums.html#discriminant-elision-on-option-like-enums), which allows using a type's niche as the ["tag"](#tag) for an `enum` without requiring a separate field.
53
+
<spanid="niche">niche</span> | Invalid bit patterns for a type *that can be used* for layout optimizations. Some types cannot have certain bit patterns. For example, the `NonZero*` integers or the reference `&T` cannot be represented by a 0 bitstring. This means the compiler can perform layout optimizations by taking advantage of the invalid "niche value". An example application for this is the [*Discriminant elision on `Option`-like enums*](https://rust-lang.github.io/unsafe-code-guidelines/layout/enums.html#discriminant-elision-on-option-like-enums), which allows using a type's niche as the ["tag"](#tag) for an `enum` without requiring a separate field.
54
54
<spanid="nll">NLL</span> | Short for [non-lexical lifetimes](../borrow_check/region_inference.md), this is an extension to Rust's borrowing system to make it be based on the control-flow graph.
55
55
<spanid="node-id">node-id or NodeId</span> | An index identifying a particular node in the AST or HIR; gradually being phased out and replaced with `HirId`. See [the HIR chapter for more](../hir.md#identifiers-in-the-hir).
56
56
<spanid="obligation">obligation</span> | Something that must be proven by the trait system. ([see more](../traits/resolution.md))
@@ -61,7 +61,7 @@ Term | Meaning
61
61
<spanid="pc">promoted constants</span> | Constants extracted from a function and lifted to static scope; see [this section](../mir/index.md#promoted) for more details.
62
62
<spanid="provider">provider</span> | The function that executes a query. ([see more](../query.md))
63
63
<spanid="quantified">quantified</span> | 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.md#quantified).
64
-
<spanid="query">query</span> | Perhaps some sub-computation during compilation. ([see more](../query.md))
64
+
<spanid="query">query</span> | A sub-computation during compilation. Query results can be cached in the current session or to disk for incremental compilation. ([see more](../query.md))
65
65
<spanid="recovery">recovery</span> | Recovery refers to handling invalid syntax during parsing (e.g. a missing comma) and continuing to parse the AST. This avoid showing spurious errors to the user (e.g. showing 'missing field' errors when the struct definition contains errors).
66
66
<spanid="region">region</span> | Another term for "lifetime" often used in the literature and in the borrow checker.
67
67
<spanid="rib">rib</span> | A data structure in the name resolver that keeps track of a single scope for names. ([see more](../name-resolution.md))
@@ -73,21 +73,21 @@ Term | Meaning
73
73
<spanid="span">span</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.
74
74
<spanid="substs">substs</span> | The substitutions for a given generic type or item (e.g. the `i32`, `u32` in `HashMap<i32, u32>`).
75
75
<spanid="sysroot">sysroot</span> | The directory for build artifacts that are loaded by the compiler at runtime. ([see more](../building/bootstrapping.html#what-is-a-sysroot))
76
-
<spanid="tag">Tag</span> | The "tag" of an enum/generator encodes the [discriminant](#discriminant) of the active variant/state. Tags can either be "direct" (simply storing the discriminant in a field) or use a ["niche"](#niche).
77
-
<spanid="tcx">tcx</span> | The "typing context", main data structure of the compiler. ([see more](../ty.md))
78
-
<spanid="lifetime-tcx">`'tcx`</span> | The lifetime of the allocation arena. ([see more](../ty.md))
76
+
<spanid="tag">tag</span> | The "tag" of an enum/generator encodes the [discriminant](#discriminant) of the active variant/state. Tags can either be "direct" (simply storing the discriminant in a field) or use a ["niche"](#niche).
77
+
<spanid="tcx">tcx</span> | The "typing context" (`TyCtxt`), main data structure of the compiler. ([see more](../ty.md))
78
+
<spanid="lifetime-tcx">`'tcx`</span> | The lifetime of the allocation arenas used by `TyCtxt`. Most data interned during a compilation session will use this lifetime with the exception of HIR data which uses the `'hir` lifetime. ([see more](../ty.md))
79
79
<spanid="token">token</span> | The smallest unit of parsing. Tokens are produced after lexing ([see more](../the-parser.md)).
80
80
<spanid="tls">[TLS]</span> | Thread-Local Storage. Variables may be defined so that each thread has its own copy (rather than all threads sharing the variable). This has some interactions with LLVM. Not all platforms support TLS.
81
81
<spanid="trait-ref">trait reference</span> | The name of a trait along with a suitable set of input type/lifetimes. ([see more](../traits/goals-and-clauses.md#trait-ref))
82
-
<spanid="trans">trans</span> | The code to translate MIR into LLVM IR. Renamed to codegen.
83
-
<spanid="ty">ty</span> | The internal representation of a type. ([see more](../ty.md))
84
-
<spanid="tyctxt">TyCtxt</span> | The data structure often referred to as [tcx](#tcx) in code
82
+
<spanid="trans">trans</span> | Short for "translation", the code to translate MIR into LLVM IR. Renamed to codegen.
83
+
<spanid="ty">`Ty`</span> | The internal representation of a type. ([see more](../ty.md))
84
+
<spanid="tyctxt">TyCtxt</span> | The data structure often referred to as [tcx](#tcx) in code which provides access to session data and the query system.
85
85
<spanid="ufcs">UFCS</span> | Short for Universal Function Call Syntax, this is an unambiguous syntax for calling a method. ([see more](../type-checking.md))
86
86
<spanid="ut">uninhabited type</span> | 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".
87
87
<spanid="upvar">upvar</span> | A variable captured by a closure from outside the closure.
88
88
<spanid="variance">variance</span> | 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](./background.md#variance) for a more general explanation. See the [variance chapter](../variance.md) for an explanation of how type checking handles variance.
89
-
<spanid="variant-idx">Variant index</span> | In an enum, identifies a variant by assigning them indices starting at 0. This is purely internal and not to be confused with the ["discrimiant"](#discriminant) which can be overwritten by the user (e.g. `enum Bool { True = 42, False = 0 }`).
90
-
<spanid="wide-ptr">Wide pointer</span> | A pointer with additional metadata. See "fat pointer" for more.
89
+
<spanid="variant-idx">variant index</span> | In an enum, identifies a variant by assigning them indices starting at 0. This is purely internal and not to be confused with the ["discrimiant"](#discriminant) which can be overwritten by the user (e.g. `enum Bool { True = 42, False = 0 }`).
90
+
<spanid="wide-ptr">wide pointer</span> | A pointer with additional metadata. See "fat pointer" for more.
91
91
<spanid="zst">ZST</span> | 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.
0 commit comments