diff options
| author | Corey Farwell <coreyf@rwell.org> | 2017-02-20 23:11:01 -0500 |
|---|---|---|
| committer | Steve Klabnik <steve@steveklabnik.com> | 2017-02-21 14:01:37 -0500 |
| commit | 49cea270d1dc79f6e08b0649d2ed8a2c87410c06 (patch) | |
| tree | 845b1fa238f1eb1333b71bc56e7e526f7da8a150 /src/doc/reference | |
| parent | c6275c4b7601ba7c9db770a0bba33b3b0e264aca (diff) | |
| download | rust-49cea270d1dc79f6e08b0649d2ed8a2c87410c06.tar.gz rust-49cea270d1dc79f6e08b0649d2ed8a2c87410c06.zip | |
Paths
Diffstat (limited to 'src/doc/reference')
| -rw-r--r-- | src/doc/reference/src/paths.md | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/doc/reference/src/paths.md b/src/doc/reference/src/paths.md index 3fa1b7d1431..e9fd07e5664 100644 --- a/src/doc/reference/src/paths.md +++ b/src/doc/reference/src/paths.md @@ -2,9 +2,12 @@ A _path_ is a sequence of one or more path components _logically_ separated by a namespace qualifier (`::`). If a path consists of only one component, it may -refer to either an [item](#items) or a [variable](#variables) in a local control +refer to either an [item] or a [variable] in a local control scope. If a path has multiple components, it refers to an item. +[item]: items.html +[variable]: variables.html + Every item has a _canonical path_ within its crate, but the path naming an item is only meaningful within a given crate. There is no global namespace across crates; an item's canonical path merely identifies it within the crate. @@ -16,16 +19,19 @@ x; x::y::z; ``` -Path components are usually [identifiers](#identifiers), but they may +Path components are usually [identifiers], but they may also include angle-bracket-enclosed lists of type arguments. In -[expression](#expressions) context, the type argument list is given +[expression] context, the type argument list is given after a `::` namespace qualifier in order to disambiguate it from a relational expression involving the less-than symbol (`<`). In type expression context, the final namespace qualifier is omitted. +[identifiers]: identifiers.html +[expression]: expressions.html + Two examples of paths with type arguments: -``` +```rust # struct HashMap<K, V>(K,V); # fn f() { # fn id<T>(t: T) -> T { t } |
