File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change 22
33> ** <sup >Syntax:<sup >** \
44> _ ExternCrate_ :\
5- >   ;  ; ` extern ` ` crate ` [ IDENTIFIER] & nbsp ; (` as ` ( [ IDENTIFIER] | ` _ ` ) )<sup >?</sup > ` ; `
5+ >   ;  ; ` extern ` ` crate ` ( [ IDENTIFIER] | ` self ` ) (` as ` ( [ IDENTIFIER] | ` _ ` ) )<sup >?</sup > ` ; `
66
77An _ ` extern crate ` declaration_ specifies a dependency on an external crate.
88The external crate is then bound into the declaring scope as the [ identifier]
9- provided in the ` extern crate ` declaration.
9+ provided in the ` extern crate ` declaration. The ` as ` clause can be used to
10+ bind the imported crate to a different name.
1011
1112The external crate is resolved to a specific ` soname ` at compile time, and a
1213runtime linkage requirement to that ` soname ` is passed to the linker for
@@ -16,6 +17,9 @@ the `crateid` attributes that were declared on the external crate when it was
1617compiled. If no ` crateid ` is provided, a default ` name ` attribute is assumed,
1718equal to the [ identifier] given in the ` extern crate ` declaration.
1819
20+ The ` self ` crate may be imported which creates a binding to the current crate.
21+ In this case the ` as ` clause must be used to specify the name to bind it to.
22+
1923Three examples of ` extern crate ` declarations:
2024
2125``` rust,ignore
You can’t perform that action at this time.
0 commit comments