11# Names
22
3- r[ name ]
3+ r[ names ]
44
5- r[ name .intro]
5+ r[ names .intro]
66An * entity* is a language construct that can be referred to in some way within
77the source program, usually via a [ path] . Entities include [ types] , [ items] ,
88[ generic parameters] , [ variable bindings] , [ loop labels] , [ lifetimes] ,
99[ fields] , [ attributes] , and [ lints] .
1010
11- r[ name .decl]
11+ r[ names .decl]
1212A * declaration* is a syntactical construct that can introduce a * name* to
1313refer to an entity. Entity names are valid within a [ * scope* ] --- a region of
1414source text where that name may be referenced.
1515
16- r[ name .explicit-decl]
16+ r[ names .explicit-decl]
1717Some entities are [ explicitly declared] ( #explicitly-declared-entities ) in the
1818source code, and some are [ implicitly declared] ( #implicitly-declared-entities )
1919as part of the language or compiler extensions.
2020
21- r[ name .path]
21+ r[ names .path]
2222[ * Paths* ] are used to refer to an entity, possibly in another module or type.
2323
24- r[ name .lifetime]
24+ r[ names .lifetime]
2525Lifetimes and loop labels use a [ dedicated syntax] [ lifetimes-and-loop-labels ] using a
2626leading quote.
2727
28- r[ name .namespace]
28+ r[ names .namespace]
2929Names are segregated into different [ * namespaces* ] , allowing entities in
3030different namespaces to share the same name without conflict.
3131
32- r[ name .resolution]
32+ r[ names .resolution]
3333[ * Name resolution* ] is the compile-time process of tying paths, identifiers,
3434and labels to entity declarations.
3535
36- r[ name .visibility]
36+ r[ names .visibility]
3737Access to certain names may be restricted based on their [ * visibility* ] .
3838
3939## Explicitly declared entities
4040
41- r[ name .explicit]
41+ r[ names .explicit]
4242
43- r[ name .explicit.list]
43+ r[ names .explicit.list]
4444Entities that explicitly introduce a name in the source code are:
4545
46- r[ name .explicit.item-decl]
46+ r[ names .explicit.item-decl]
4747* [ Items] :
4848 * [ Module declarations]
4949 * [ External crate declarations]
@@ -59,7 +59,7 @@ r[name.explicit.item-decl]
5959 * [ ` macro_rules ` declarations] and [ matcher metavariables]
6060 * [ Implementation] associated items
6161
62- r[ name .explicit.expr]
62+ r[ names .explicit.expr]
6363* [ Expressions] :
6464 * [ Closure] parameters
6565 * [ ` while let ` ] pattern bindings
@@ -68,66 +68,66 @@ r[name.explicit.expr]
6868 * [ ` match ` ] pattern bindings
6969 * [ Loop labels]
7070
71- r[ name .explicit.generics]
71+ r[ names .explicit.generics]
7272* [ Generic parameters]
7373
74- r[ name .explicit.higher-ranked-bounds]
74+ r[ names .explicit.higher-ranked-bounds]
7575* [ Higher ranked trait bounds]
7676
77- r[ name .explicit.binding]
77+ r[ names .explicit.binding]
7878* [ ` let ` statement] pattern bindings
7979
80- r[ name .explicit.macro_use]
80+ r[ names .explicit.macro_use]
8181* The [ ` macro_use ` attribute] can introduce macro names from another crate
8282
83- r[ name .explicit.macro_export]
83+ r[ names .explicit.macro_export]
8484* The [ ` macro_export ` attribute] can introduce an alias for the macro into the crate root
8585
86- r[ name .explicit.macro-invocation]
86+ r[ names .explicit.macro-invocation]
8787Additionally, [ macro invocations] and [ attributes] can introduce names by
8888expanding to one of the above items.
8989
9090## Implicitly declared entities
9191
92- r[ name .implicit]
92+ r[ names .implicit]
9393
94- r[ name .implicit.list]
94+ r[ names .implicit.list]
9595The following entities are implicitly defined by the language, or are
9696introduced by compiler options and extensions:
9797
98- r[ name .implicit.primitive-types]
98+ r[ names .implicit.primitive-types]
9999* [ Language prelude] :
100100 * [ Boolean type] --- ` bool `
101101 * [ Textual types] --- ` char ` and ` str `
102102 * [ Integer types] --- ` i8 ` , ` i16 ` , ` i32 ` , ` i64 ` , ` i128 ` , ` u8 ` , ` u16 ` , ` u32 ` , ` u64 ` , ` u128 `
103103 * [ Machine-dependent integer types] --- ` usize ` and ` isize `
104104 * [ floating-point types] --- ` f32 ` and ` f64 `
105105
106- r[ name .implicit.builtin-attributes]
106+ r[ names .implicit.builtin-attributes]
107107* [ Built-in attributes]
108108
109- r[ name .implicit.prelude]
109+ r[ names .implicit.prelude]
110110* [ Standard library prelude] items, attributes, and macros
111111
112- r[ name .implicit.stdlib]
112+ r[ names .implicit.stdlib]
113113* [ Standard library] [ extern-prelude ] crates in the root module
114114
115- r[ name .implicit.extern-prelude]
115+ r[ names .implicit.extern-prelude]
116116* [ External crates] [ extern-prelude ] linked by the compiler
117117
118- r[ name .implicit.tool-attributes]
118+ r[ names .implicit.tool-attributes]
119119* [ Tool attributes]
120120
121- r[ name .implicit.lints]
121+ r[ names .implicit.lints]
122122* [ Lints] and [ tool lint attributes]
123123
124- r[ name .implicit.derive-helpers]
124+ r[ names .implicit.derive-helpers]
125125* [ Derive helper attributes] are valid within an item without being explicitly imported
126126
127- r[ name .implicit.lifetime-static]
127+ r[ names .implicit.lifetime-static]
128128* The [ ` 'static ` ] lifetime
129129
130- r[ name .implicit.root]
130+ r[ names .implicit.root]
131131Additionally, the crate root module does not have a name, but can be referred
132132to with certain [ path qualifiers] or aliases.
133133
0 commit comments