|
2 | 2 |
|
3 | 3 | A _path_ is a sequence of one or more path components _logically_ separated by
|
4 | 4 | a namespace qualifier (`::`). If a path consists of only one component, it may
|
5 |
| -refer to either an [item](#items) or a [variable](#variables) in a local control |
| 5 | +refer to either an [item] or a [variable] in a local control |
6 | 6 | scope. If a path has multiple components, it refers to an item.
|
7 | 7 |
|
| 8 | +[item]: items.html |
| 9 | +[variable]: variables.html |
| 10 | + |
8 | 11 | Every item has a _canonical path_ within its crate, but the path naming an item
|
9 | 12 | is only meaningful within a given crate. There is no global namespace across
|
10 | 13 | crates; an item's canonical path merely identifies it within the crate.
|
|
16 | 19 | x::y::z;
|
17 | 20 | ```
|
18 | 21 |
|
19 |
| -Path components are usually [identifiers](#identifiers), but they may |
| 22 | +Path components are usually [identifiers], but they may |
20 | 23 | also include angle-bracket-enclosed lists of type arguments. In
|
21 |
| -[expression](#expressions) context, the type argument list is given |
| 24 | +[expression] context, the type argument list is given |
22 | 25 | after a `::` namespace qualifier in order to disambiguate it from a
|
23 | 26 | relational expression involving the less-than symbol (`<`). In type
|
24 | 27 | expression context, the final namespace qualifier is omitted.
|
25 | 28 |
|
| 29 | +[identifiers]: identifiers.html |
| 30 | +[expression]: expressions.html |
| 31 | + |
26 | 32 | Two examples of paths with type arguments:
|
27 | 33 |
|
28 |
| -``` |
| 34 | +```rust |
29 | 35 | # struct HashMap<K, V>(K,V);
|
30 | 36 | # fn f() {
|
31 | 37 | # fn id<T>(t: T) -> T { t }
|
|
0 commit comments