3 A _path_ is a sequence of one or more path components _logically_ separated by
4 a namespace qualifier (`::`). If a path consists of only one component, it may
5 refer to either an [item] or a [variable] in a local control
6 scope. If a path has multiple components, it refers to an item.
9 [variable]: variables.html
11 Every item has a _canonical path_ within its crate, but the path naming an item
12 is only meaningful within a given crate. There is no global namespace across
13 crates; an item's canonical path merely identifies it within the crate.
15 Two examples of simple paths consisting of only identifier components:
22 Path components are usually [identifiers], but they may
23 also include angle-bracket-enclosed lists of type arguments. In
24 [expression] context, the type argument list is given
25 after a `::` namespace qualifier in order to disambiguate it from a
26 relational expression involving the less-than symbol (`<`). In type
27 expression context, the final namespace qualifier is omitted.
29 [identifiers]: identifiers.html
30 [expression]: expressions.html
32 Two examples of paths with type arguments:
35 # struct HashMap<K, V>(K,V);
37 # fn id<T>(t: T) -> T { t }
38 type T = HashMap<i32,String>; // Type arguments used in a type expression
39 let x = id::<i32>(10); // Type arguments used in a call expression
43 Paths can be denoted with various leading qualifiers to change the meaning of
46 * Paths starting with `::` are considered to be global paths where the
47 components of the path start being resolved from the crate root. Each
48 identifier in the path must resolve to an item.
56 ::a::foo(); // call a's foo function
62 * Paths starting with the keyword `super` begin resolution relative to the
63 parent module. Each further identifier must resolve to an item.
71 super::a::foo(); // call a's foo function
77 * Paths starting with the keyword `self` begin resolution relative to the
78 current module. Each further identifier must resolve to an item.
88 Additionally keyword `super` may be repeated several times after the first
89 `super` or `self` to refer to ancestor modules.
98 super::super::foo(); // call a's foo function
99 self::super::super::foo(); // call a's foo function