Skip to content

Latest commit

 

History

History
188 lines (157 loc) · 6.67 KB

names.md

File metadata and controls

188 lines (157 loc) · 6.67 KB

r[names]

Names

r[names.intro] An entity is a language construct that can be referred to in some way within the source program, usually via a path. Entities include types, items, generic parameters, variable bindings, loop labels, lifetimes, fields, attributes, and lints.

r[names.decl] A declaration is a syntactical construct that can introduce a name to refer to an entity. Entity names are valid within a scope --- a region of source text where that name may be referenced.

r[names.explicit-decl] Some entities are explicitly declared in the source code, and some are implicitly declared as part of the language or compiler extensions.

r[names.path] Paths are used to refer to an entity, possibly in another module or type.

r[names.lifetime] Lifetimes and loop labels use a dedicated syntax using a leading quote.

r[names.namespace] Names are segregated into different namespaces, allowing entities in different namespaces to share the same name without conflict.

r[names.resolution] Name resolution is the compile-time process of tying paths, identifiers, and labels to entity declarations.

r[names.visibility] Access to certain names may be restricted based on their visibility.

r[names.explicit]

Explicitly declared entities

r[names.explicit.list] Entities that explicitly introduce a name in the source code are:

r[names.explicit.item-decl]

r[names.explicit.expr]

r[names.explicit.generics]

r[names.explicit.higher-ranked-bounds]

r[names.explicit.binding]

r[names.explicit.macro_use]

r[names.explicit.macro_export]

r[names.explicit.macro-invocation] Additionally, macro invocations and attributes can introduce names by expanding to one of the above items.

r[names.implicit]

Implicitly declared entities

r[names.implicit.list] The following entities are implicitly defined by the language, or are introduced by compiler options and extensions:

r[names.implicit.primitive-types]

r[names.implicit.builtin-attributes]

r[names.implicit.prelude]

r[names.implicit.stdlib]

r[names.implicit.extern-prelude]

r[names.implicit.tool-attributes]

r[names.implicit.lints]

r[names.implicit.derive-helpers]

r[names.implicit.lifetime-static]

r[names.implicit.root] Additionally, the crate root module does not have a name, but can be referred to with certain path qualifiers or aliases.