1
1
# Names
2
2
3
- Entities declare a * name * to refer to that entity. Some entities are
4
- [ explicitly declared ] ( #explicit-entities ) in the source code, and some are
5
- [ implicitly declared ] ( #implicit-entities ) as part of the language or compiler
6
- extensions .
3
+ An * entity * is a language construct that can be referred to in some way within
4
+ the source program, usually via a [ * path * ] . Entities include [ types ] , [ items ] ,
5
+ [ generic parameters ] , [ variable bindings ] , [ loop labels ] , [ lifetimes ] ,
6
+ [ fields ] , [ attributes ] , and [ lints ] .
7
7
8
- Entity names are valid within a [ * scope* ] — a region of source text where that
9
- name may be referenced.
8
+ A * declaration* is a syntactical construct that can introduce a * name* to
9
+ refer to an entity. Entity names are valid within a [ * scope* ] — a region of
10
+ source text where that name may be referenced.
11
+
12
+ Some entities are [ explicitly declared] ( #explicit-entities ) in the source
13
+ code, and some are [ implicitly declared] ( #implicit-entities ) as part of the
14
+ language or compiler extensions.
10
15
11
16
[ * Paths* ] are used to refer to an entity, possibly in another scope. Lifetimes
12
17
and loop labels use a [ dedicated syntax] [ lifetimes-and-loop-labels ] using a
@@ -75,16 +80,16 @@ introduced by compiler options and extensions:
75
80
* The [ ` 'static ` ] lifetime
76
81
77
82
Additionally, the crate root module does not have a name, but can be referred
78
- to with certain [ path qualifiers] .
83
+ to with certain [ path qualifiers] or aliases .
79
84
80
85
81
86
[ *Name resolution* ] : names/name-resolution.md
82
87
[ *namespaces* ] : names/namespaces.md
88
+ [ *path* ] : paths.md
83
89
[ *paths* ] : paths.md
84
90
[ *scope* ] : names/scopes.md
85
91
[ *visibility* ] : visibility-and-privacy.md
86
92
[ `'static` ] : keywords.md#weak-keywords
87
- [ path qualifiers ] : paths.md#path-qualifiers
88
93
[ `for` ] : expressions/loop-expr.md#iterator-loops
89
94
[ `if let` ] : expressions/if-expr.md#if-let-expressions
90
95
[ `let` statement ] : statements.md#let-statements
@@ -105,6 +110,7 @@ to with certain [path qualifiers].
105
110
[ extern-prelude ] : names/preludes.md#extern-prelude
106
111
[ External block items ] : items/external-blocks.md
107
112
[ External crate declarations ] : items/extern-crates.md
113
+ [ fields ] : expressions/field-expr.md
108
114
[ floating-point types ] : types/numeric.md#floating-point-types
109
115
[ Function declarations ] : items/functions.md
110
116
[ function parameters ] : items/functions.md#function-parameters
@@ -115,12 +121,14 @@ to with certain [path qualifiers].
115
121
[ Items ] : items.md
116
122
[ Language prelude ] : names/preludes.md#language-prelude
117
123
[ lifetimes-and-loop-labels ] : tokens.md#lifetimes-and-loop-labels
124
+ [ lifetimes ] : tokens.md#lifetimes-and-loop-labels
118
125
[ Lints ] : attributes/diagnostics.md#lint-check-attributes
119
126
[ Loop labels ] : expressions/loop-expr.md#loop-labels
120
127
[ Machine-dependent integer types ] : types/numeric.md#machine-dependent-integer-types
121
128
[ macro invocations ] : macros.md#macro-invocation
122
129
[ matcher metavariables ] : macros-by-example.md#metavariables
123
130
[ Module declarations ] : items/modules.md
131
+ [ path qualifiers ] : paths.md#path-qualifiers
124
132
[ Standard library prelude ] : names/preludes.md#standard-library-prelude
125
133
[ Static item declarations ] : items/static-items.md
126
134
[ struct ] : items/structs.md
@@ -129,5 +137,7 @@ to with certain [path qualifiers].
129
137
[ tool lint attributes ] : attributes/diagnostics.md#tool-lint-attributes
130
138
[ Trait item declarations ] : items/traits.md
131
139
[ Type aliases ] : items/type-aliases.md
140
+ [ types ] : types.md
132
141
[ union ] : items/unions.md
133
142
[ Use declarations ] : items/use-declarations.md
143
+ [ variable bindings ] : patterns.md
0 commit comments