Skip to content

Commit 8f598e2

Browse files
Merge pull request #1016 from ehuss/glossary-crate
Add crate and module to glossary.
2 parents 7453463 + e9862d8 commit 8f598e2

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/glossary.md

+22
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,16 @@ Combinators are higher-order functions that apply only functions and
5050
earlier defined combinators to provide a result from its arguments.
5151
They can be used to manage control flow in a modular fashion.
5252

53+
### Crate
54+
55+
A crate is the unit of compilation and linking. There are different [types of
56+
crates], such as libraries or executables. Crates may link and refer to other
57+
library crates, called external crates. A crate has a self-contained tree of
58+
[modules], starting from an unnamed root module called the crate root. [Items]
59+
may be made visible to other crates by marking them as public in the crate
60+
root, including through [paths] of public modules.
61+
[More][crate].
62+
5363
### Dispatch
5464

5565
Dispatch is the mechanism to determine which specific version of code is actually
@@ -130,6 +140,14 @@ This is not affected by applied type arguments. `struct Foo` is considered local
130140
`Vec<Foo>` is not. `LocalType<ForeignType>` is local. Type aliases do not
131141
affect locality.
132142

143+
### Module
144+
145+
A module is a container for zero or more [items]. Modules are organized in a
146+
tree, starting from an unnamed module at the root called the crate root or the
147+
root module. [Paths] may be used to refer to items from other modules, which
148+
may be restricted by [visibility rules].
149+
[More][modules]
150+
133151
### Name
134152

135153
A [*name*] is an [identifier] or [lifetime or loop label] that refers to an
@@ -274,6 +292,7 @@ example of an uninhabited type is the [never type] `!`, or an enum with no varia
274292
[associated item]: #associated-item
275293
[attributes]: attributes.md
276294
[*entity*]: names.md
295+
[crate]: crates-and-source-files.md
277296
[enums]: items/enumerations.md
278297
[fields]: expressions/field-expr.md
279298
[free item]: #free-item
@@ -291,6 +310,7 @@ example of an uninhabited type is the [never type] `!`, or an enum with no varia
291310
[lints]: attributes/diagnostics.md#lint-check-attributes
292311
[loop labels]: tokens.md#lifetimes-and-loop-labels
293312
[method]: items/associated-items.md#methods
313+
[modules]: items/modules.md
294314
[*Name resolution*]: names/name-resolution.md
295315
[*name*]: names.md
296316
[*namespace*]: names/namespaces.md
@@ -303,7 +323,9 @@ example of an uninhabited type is the [never type] `!`, or an enum with no varia
303323
[trait objects]: types/trait-object.md
304324
[traits]: items/traits.md
305325
[turbofish test]: https://github.com/rust-lang/rust/blob/master/src/test/ui/bastion-of-the-turbofish.rs
326+
[types of crates]: linkage.md
306327
[types]: types.md
307328
[undefined-behavior]: behavior-considered-undefined.md
308329
[unions]: items/unions.md
309330
[variable bindings]: patterns.md
331+
[visibility rules]: visibility-and-privacy.md

0 commit comments

Comments
 (0)