insignificant fix to rust manual and tutorial
This commit is contained in:
parent
ca41bbb2e3
commit
4e9df9a656
2 changed files with 14 additions and 21 deletions
|
|
@ -752,27 +752,27 @@ mod task {
|
|||
#### View items
|
||||
|
||||
~~~~ {.ebnf .gram}
|
||||
view_item : extern_mod_decl | use_decl ;
|
||||
view_item : extern_crate_decl | use_decl ;
|
||||
~~~~
|
||||
|
||||
A view item manages the namespace of a module.
|
||||
View items do not define new items, but rather, simply change other items' visibility.
|
||||
There are several kinds of view item:
|
||||
|
||||
* [`extern crate` declarations](#extern-mod-declarations)
|
||||
* [`extern crate` declarations](#extern-crate-declarations)
|
||||
* [`use` declarations](#use-declarations)
|
||||
|
||||
##### Extern mod declarations
|
||||
##### Extern crate declarations
|
||||
|
||||
~~~~ {.ebnf .gram}
|
||||
extern_mod_decl : "extern" "mod" ident [ '(' link_attrs ')' ] ? [ '=' string_lit ] ? ;
|
||||
extern_crate_decl : "extern" "crate" ident [ '(' link_attrs ')' ] ? [ '=' string_lit ] ? ;
|
||||
link_attrs : link_attr [ ',' link_attrs ] + ;
|
||||
link_attr : ident '=' literal ;
|
||||
~~~~
|
||||
|
||||
An _`extern crate` declaration_ specifies a dependency on an external crate.
|
||||
The external crate is then bound into the declaring scope
|
||||
as the `ident` provided in the `extern_mod_decl`.
|
||||
The external crate is then bound into the declaring scope as the `ident` provided
|
||||
in the `extern_crate_decl`.
|
||||
|
||||
The external crate is resolved to a specific `soname` at compile time, and a
|
||||
runtime linkage requirement to that `soname` is passed to the linker for
|
||||
|
|
@ -780,7 +780,7 @@ loading at runtime. The `soname` is resolved at compile time by scanning the
|
|||
compiler's library path and matching the optional `crateid` provided as a string literal
|
||||
against the `crateid` attributes that were declared on the external crate when
|
||||
it was compiled. If no `crateid` is provided, a default `name` attribute is
|
||||
assumed, equal to the `ident` given in the `extern_mod_decl`.
|
||||
assumed, equal to the `ident` given in the `extern_crate_decl`.
|
||||
|
||||
Four examples of `extern crate` declarations:
|
||||
|
||||
|
|
@ -813,7 +813,7 @@ module item. These declarations may appear at the top of [modules](#modules) and
|
|||
|
||||
*Note*: Unlike in many languages,
|
||||
`use` declarations in Rust do *not* declare linkage dependency with external crates.
|
||||
Rather, [`extern crate` declarations](#extern-mod-declarations) declare linkage dependencies.
|
||||
Rather, [`extern crate` declarations](#extern-crate-declarations) declare linkage dependencies.
|
||||
|
||||
Use declarations support a number of convenient shortcuts:
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue