extern mod => extern crate

This was previously implemented, and it just needed a snapshot to go through
This commit is contained in:
Alex Crichton 2014-02-14 10:10:06 -08:00
parent 359ac360a4
commit a41b0c2529
438 changed files with 682 additions and 685 deletions

View file

@ -1 +1 @@
<link rel="shortcut icon" href="http://www.rust-lang.org/favicon.ico" />
<link rel="shortcut icon" href="http://www.rust-lang.org/favicon.ico" />

View file

@ -232,7 +232,7 @@ fn main() {}
Whereas this program explicitly opts into using a particular runtime
~~~{.rust}
extern mod green;
extern crate green;
#[start]
fn start(argc: int, argv: **u8) -> int {

View file

@ -285,7 +285,7 @@ later.
The basic example below illustrates this.
~~~
# extern mod sync;
# extern crate sync;
# fn main() {
# fn make_a_sandwich() {};
@ -310,7 +310,7 @@ Here is another example showing how futures allow you to background computations
be distributed on the available cores.
~~~
# extern mod sync;
# extern crate sync;
# use std::vec;
fn partial_sum(start: uint) -> f64 {
let mut local_sum = 0f64;
@ -346,7 +346,7 @@ Here is a small example showing how to use Arcs. We wish to run concurrently sev
a single large vector of floats. Each task needs the full vector to perform its duty.
~~~
# extern mod sync;
# extern crate sync;
# use std::vec;
# use std::rand;
use sync::Arc;
@ -379,7 +379,7 @@ at the power given as argument and takes the inverse power of this value). The A
created by the line
~~~
# extern mod sync;
# extern crate sync;
# use sync::Arc;
# use std::vec;
# use std::rand;
@ -392,7 +392,7 @@ let numbers_arc=Arc::new(numbers);
and a clone of it is sent to each task
~~~
# extern mod sync;
# extern crate sync;
# use sync::Arc;
# use std::vec;
# use std::rand;
@ -409,7 +409,7 @@ copying only the wrapper and not its contents.
Each task recovers the underlying data by
~~~
# extern mod sync;
# extern crate sync;
# use sync::Arc;
# use std::vec;
# use std::rand;
@ -499,7 +499,7 @@ the string in response. The child terminates when it receives `0`.
Here is the function that implements the child task:
~~~
# extern mod sync;
# extern crate sync;
# fn main() {
# use sync::DuplexStream;
fn stringifier(channel: &DuplexStream<~str, uint>) {
@ -524,7 +524,7 @@ response itself is simply the stringified version of the received value,
Here is the code for the parent task:
~~~
# extern mod sync;
# extern crate sync;
# use std::task::spawn;
# use sync::DuplexStream;
# fn stringifier(channel: &DuplexStream<~str, uint>) {

View file

@ -185,7 +185,7 @@ amount.
For example:
~~~
extern mod extra;
extern crate extra;
use std::vec;
use extra::test::BenchHarness;
@ -243,7 +243,7 @@ recognize that some calculation has no external effects and remove
it entirely.
~~~
extern mod extra;
extern crate extra;
use extra::test::BenchHarness;
#[bench]

View file

@ -273,7 +273,7 @@ msgstr "## タプル"
#. type: Plain text
#: src/doc/complement-cheatsheet.md:122
#, fuzzy, no-wrap
#| msgid "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
msgid ""
"~~~\n"
"struct Foo {\n"
@ -282,7 +282,7 @@ msgid ""
msgstr ""
"~~~~ {.ignore}\n"
"// main.rs\n"
"extern mod world;\n"
"extern crate world;\n"
"fn main() { println(~\"hello \" + world::explore()); }\n"
"~~~~"

View file

@ -79,13 +79,13 @@ msgstr "# 関数"
#: src/doc/guide-conditions.md:262
#, fuzzy
#| msgid ""
#| "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello "
#| "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello "
#| "\" + world::explore()); } ~~~~"
msgid "fn main() {"
msgstr ""
"~~~~ {.ignore}\n"
"// main.rs\n"
"extern mod world;\n"
"extern crate world;\n"
"fn main() { println(~\"hello \" + world::explore()); }\n"
"~~~~"

View file

@ -74,7 +74,7 @@ msgstr "# イントロダクション"
#. type: Plain text
#: src/doc/guide-container.md:85
#, fuzzy, no-wrap
#| msgid "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
msgid ""
"impl Iterator<int> for ZeroStream {\n"
" fn next(&mut self) -> Option<int> {\n"
@ -85,7 +85,7 @@ msgid ""
msgstr ""
"~~~~ {.ignore}\n"
"// main.rs\n"
"extern mod world;\n"
"extern crate world;\n"
"fn main() { println(~\"hello \" + world::explore()); }\n"
"~~~~"

View file

@ -70,7 +70,7 @@ msgstr "## 最小限の例"
#. type: Plain text
#: src/doc/guide-ffi.md:323
#, fuzzy, no-wrap
#| msgid "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
msgid ""
"struct RustObject {\n"
" a: i32,\n"
@ -79,7 +79,7 @@ msgid ""
msgstr ""
"~~~~ {.ignore}\n"
"// main.rs\n"
"extern mod world;\n"
"extern crate world;\n"
"fn main() { println(~\"hello \" + world::explore()); }\n"
"~~~~"

View file

@ -154,7 +154,7 @@ msgstr ""
#: src/doc/guide-pointers.md:141 src/doc/guide-pointers.md:221
#: src/doc/guide-pointers.md:238 src/doc/guide-pointers.md:300
#, fuzzy, no-wrap
#| msgid "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
msgid ""
"~~~rust\n"
"struct Point {\n"
@ -164,7 +164,7 @@ msgid ""
msgstr ""
"~~~~ {.ignore}\n"
"// main.rs\n"
"extern mod world;\n"
"extern crate world;\n"
"fn main() { println(~\"hello \" + world::explore()); }\n"
"~~~~"
@ -222,7 +222,7 @@ msgstr "# データ構造"
#. type: Plain text
#: src/doc/guide-pointers.md:189
#, fuzzy, no-wrap
#| msgid "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
msgid ""
"~~~rust\n"
"enum List<T> {\n"
@ -232,7 +232,7 @@ msgid ""
msgstr ""
"~~~~ {.ignore}\n"
"// main.rs\n"
"extern mod world;\n"
"extern crate world;\n"
"fn main() { println(~\"hello \" + world::explore()); }\n"
"~~~~"
@ -304,7 +304,7 @@ msgstr "## マネージドボックス"
#. type: Plain text
#: src/doc/guide-pointers.md:269
#, fuzzy, no-wrap
#| msgid "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
msgid ""
"~~~rust{.ignore}\n"
"struct Point {\n"
@ -314,7 +314,7 @@ msgid ""
msgstr ""
"~~~~ {.ignore}\n"
"// main.rs\n"
"extern mod world;\n"
"extern crate world;\n"
"fn main() { println(~\"hello \" + world::explore()); }\n"
"~~~~"
@ -372,7 +372,7 @@ msgstr ""
#. type: Plain text
#: src/doc/guide-pointers.md:341
#, fuzzy, no-wrap
#| msgid "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
msgid ""
"struct Point {\n"
" x: f32,\n"
@ -381,7 +381,7 @@ msgid ""
msgstr ""
"~~~~ {.ignore}\n"
"// main.rs\n"
"extern mod world;\n"
"extern crate world;\n"
"fn main() { println(~\"hello \" + world::explore()); }\n"
"~~~~"
@ -402,7 +402,7 @@ msgstr ""
#. type: Plain text
#: src/doc/guide-pointers.md:378
#, fuzzy, no-wrap
#| msgid "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
msgid ""
"~~~rust{.ignore}\n"
"fn main() {\n"
@ -413,7 +413,7 @@ msgid ""
msgstr ""
"~~~~ {.ignore}\n"
"// main.rs\n"
"extern mod world;\n"
"extern crate world;\n"
"fn main() { println(~\"hello \" + world::explore()); }\n"
"~~~~"
@ -499,7 +499,7 @@ msgstr ""
#. type: Plain text
#: src/doc/guide-pointers.md:450
#, fuzzy, no-wrap
#| msgid "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
msgid ""
"fn main() {\n"
" let x = ~5;\n"
@ -509,7 +509,7 @@ msgid ""
msgstr ""
"~~~~ {.ignore}\n"
"// main.rs\n"
"extern mod world;\n"
"extern crate world;\n"
"fn main() { println(~\"hello \" + world::explore()); }\n"
"~~~~"
@ -530,7 +530,7 @@ msgstr ""
#. type: Plain text
#: src/doc/guide-pointers.md:463
#, fuzzy, no-wrap
#| msgid "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
msgid ""
"fn main() {\n"
" let x = ~5;\n"
@ -540,14 +540,14 @@ msgid ""
msgstr ""
"~~~~ {.ignore}\n"
"// main.rs\n"
"extern mod world;\n"
"extern crate world;\n"
"fn main() { println(~\"hello \" + world::explore()); }\n"
"~~~~"
#. type: Plain text
#: src/doc/guide-pointers.md:477
#, fuzzy, no-wrap
#| msgid "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
msgid ""
"fn main() {\n"
" let x = ~5;\n"
@ -557,7 +557,7 @@ msgid ""
msgstr ""
"~~~~ {.ignore}\n"
"// main.rs\n"
"extern mod world;\n"
"extern crate world;\n"
"fn main() { println(~\"hello \" + world::explore()); }\n"
"~~~~"

View file

@ -83,13 +83,13 @@ msgstr "## 他のクレートの利用"
#: src/doc/guide-runtime.md:231
#, fuzzy
#| msgid ""
#| "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello "
#| "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello "
#| "\" + world::explore()); } ~~~~"
msgid "~~~{.rust} fn main() {} ~~~"
msgstr ""
"~~~~ {.ignore}\n"
"// main.rs\n"
"extern mod world;\n"
"extern crate world;\n"
"fn main() { println(~\"hello \" + world::explore()); }\n"
"~~~~"
@ -97,7 +97,7 @@ msgstr ""
#: src/doc/guide-runtime.md:236
#, fuzzy
#| msgid "~~~~ {.ignore} let foo = 10;"
msgid "~~~{.rust} extern mod green;"
msgid "~~~{.rust} extern crate green;"
msgstr ""
"~~~~ {.ignore}\n"
"let foo = 10;"
@ -106,13 +106,13 @@ msgstr ""
#: src/doc/guide-runtime.md:246
#, fuzzy
#| msgid ""
#| "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello "
#| "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello "
#| "\" + world::explore()); } ~~~~"
msgid "fn main() {} ~~~"
msgstr ""
"~~~~ {.ignore}\n"
"// main.rs\n"
"extern mod world;\n"
"extern crate world;\n"
"fn main() { println(~\"hello \" + world::explore()); }\n"
"~~~~"

View file

@ -61,7 +61,7 @@ msgstr "## 最小限の例"
#: src/doc/guide-testing.md:131
#, fuzzy
#| msgid "~~~~ use std::task::spawn;"
msgid "~~~ extern mod extra; use std::vec;"
msgid "~~~ extern crate extra; use std::vec;"
msgstr ""
"~~~~\n"
"use std::task::spawn;"

View file

@ -310,14 +310,14 @@ msgstr "## 他のクレートの利用"
#: src/doc/rust.md:786
#, fuzzy
#| msgid "## Using other crates"
msgid "Four examples of `extern mod` declarations:"
msgid "Four examples of `extern crate` declarations:"
msgstr "## 他のクレートの利用"
#. type: Plain text
#: src/doc/rust.md:789
#, fuzzy
#| msgid "~~~~ {.ignore} let foo = 10;"
msgid "~~~~ {.ignore} extern mod pcre;"
msgid "~~~~ {.ignore} extern crate pcre;"
msgstr ""
"~~~~ {.ignore}\n"
"let foo = 10;"
@ -365,7 +365,7 @@ msgstr "## 最小限の例"
#| msgid "~~~~ {.ignore} let foo = 10;"
msgid ""
"mod foo {\n"
" extern mod extra;\n"
" extern crate extra;\n"
msgstr ""
"~~~~ {.ignore}\n"
"let foo = 10;"
@ -374,13 +374,13 @@ msgstr ""
#: src/doc/rust.md:901
#, fuzzy
#| msgid ""
#| "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello "
#| "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello "
#| "\" + world::explore()); } ~~~~"
msgid "fn main() {} ~~~~"
msgstr ""
"~~~~ {.ignore}\n"
"// main.rs\n"
"extern mod world;\n"
"extern crate world;\n"
"fn main() { println(~\"hello \" + world::explore()); }\n"
"~~~~"
@ -751,7 +751,7 @@ msgstr "# イントロダクション"
#. type: Plain text
#: src/doc/rust.md:1420
#, fuzzy, no-wrap
#| msgid "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
msgid ""
"struct Circle {\n"
" radius: f64,\n"
@ -760,7 +760,7 @@ msgid ""
msgstr ""
"~~~~ {.ignore}\n"
"// main.rs\n"
"extern mod world;\n"
"extern crate world;\n"
"fn main() { println(~\"hello \" + world::explore()); }\n"
"~~~~"
@ -775,13 +775,13 @@ msgstr "## 本書の表記について"
#: src/doc/rust.md:1644 src/doc/rust.md:1665
#, fuzzy
#| msgid ""
#| "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello "
#| "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello "
#| "\" + world::explore()); } ~~~~"
msgid "# fn main() {} ~~~~"
msgstr ""
"~~~~ {.ignore}\n"
"// main.rs\n"
"extern mod world;\n"
"extern crate world;\n"
"fn main() { println(~\"hello \" + world::explore()); }\n"
"~~~~"
@ -866,7 +866,7 @@ msgstr "## 凍結"
#. type: Plain text
#: src/doc/rust.md:1953
#, fuzzy, no-wrap
#| msgid "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
msgid ""
"~~~~\n"
"#[deriving(Eq, Clone)]\n"
@ -878,7 +878,7 @@ msgid ""
msgstr ""
"~~~~ {.ignore}\n"
"// main.rs\n"
"extern mod world;\n"
"extern crate world;\n"
"fn main() { println(~\"hello \" + world::explore()); }\n"
"~~~~"
@ -1254,7 +1254,7 @@ msgstr ""
#. type: Plain text
#: src/doc/rust.md:2702
#, fuzzy, no-wrap
#| msgid "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
msgid ""
"while i < 10 {\n"
" println!(\"hello\");\n"
@ -1264,7 +1264,7 @@ msgid ""
msgstr ""
"~~~~ {.ignore}\n"
"// main.rs\n"
"extern mod world;\n"
"extern crate world;\n"
"fn main() { println(~\"hello \" + world::explore()); }\n"
"~~~~"
@ -1306,7 +1306,7 @@ msgstr "## 最小限の例"
#. type: Plain text
#: src/doc/rust.md:2774
#, fuzzy, no-wrap
#| msgid "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
msgid ""
"for e in v.iter() {\n"
" bar(*e);\n"
@ -1315,7 +1315,7 @@ msgid ""
msgstr ""
"~~~~ {.ignore}\n"
"// main.rs\n"
"extern mod world;\n"
"extern crate world;\n"
"fn main() { println(~\"hello \" + world::explore()); }\n"
"~~~~"
@ -1637,7 +1637,7 @@ msgstr "## 最小限の例"
#. type: Plain text
#: src/doc/rust.md:3314
#, fuzzy, no-wrap
#| msgid "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
msgid ""
"~~~~\n"
"trait Printable {\n"
@ -1646,14 +1646,14 @@ msgid ""
msgstr ""
"~~~~ {.ignore}\n"
"// main.rs\n"
"extern mod world;\n"
"extern crate world;\n"
"fn main() { println(~\"hello \" + world::explore()); }\n"
"~~~~"
#. type: Plain text
#: src/doc/rust.md:3318
#, fuzzy, no-wrap
#| msgid "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
msgid ""
"impl Printable for int {\n"
" fn to_string(&self) -> ~str { self.to_str() }\n"
@ -1661,14 +1661,14 @@ msgid ""
msgstr ""
"~~~~ {.ignore}\n"
"// main.rs\n"
"extern mod world;\n"
"extern crate world;\n"
"fn main() { println(~\"hello \" + world::explore()); }\n"
"~~~~"
#. type: Plain text
#: src/doc/rust.md:3327
#, fuzzy, no-wrap
#| msgid "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
msgid ""
"fn main() {\n"
" print(@10 as @Printable);\n"
@ -1677,7 +1677,7 @@ msgid ""
msgstr ""
"~~~~ {.ignore}\n"
"// main.rs\n"
"extern mod world;\n"
"extern crate world;\n"
"fn main() { println(~\"hello \" + world::explore()); }\n"
"~~~~"
@ -1698,7 +1698,7 @@ msgstr "# クロージャ"
#. type: Plain text
#: src/doc/rust.md:3359
#, fuzzy, no-wrap
#| msgid "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
msgid ""
"~~~~\n"
"trait Printable {\n"
@ -1707,14 +1707,14 @@ msgid ""
msgstr ""
"~~~~ {.ignore}\n"
"// main.rs\n"
"extern mod world;\n"
"extern crate world;\n"
"fn main() { println(~\"hello \" + world::explore()); }\n"
"~~~~"
#. type: Plain text
#: src/doc/rust.md:3366
#, fuzzy, no-wrap
#| msgid "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
msgid ""
"impl Printable for ~str {\n"
" fn make_string(&self) -> ~str {\n"
@ -1725,7 +1725,7 @@ msgid ""
msgstr ""
"~~~~ {.ignore}\n"
"// main.rs\n"
"extern mod world;\n"
"extern crate world;\n"
"fn main() { println(~\"hello \" + world::explore()); }\n"
"~~~~"

View file

@ -431,7 +431,7 @@ msgstr ""
#. type: Plain text
#: src/doc/tutorial.md:136
#, fuzzy, no-wrap
#| msgid "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
msgid ""
"~~~~\n"
"fn main() {\n"
@ -441,7 +441,7 @@ msgid ""
msgstr ""
"~~~~ {.ignore}\n"
"// main.rs\n"
"extern mod world;\n"
"extern crate world;\n"
"fn main() { println(~\"hello \" + world::explore()); }\n"
"~~~~"
@ -634,7 +634,7 @@ msgstr ""
#. type: Plain text
#: src/doc/tutorial.md:222
#, fuzzy, no-wrap
#| msgid "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
msgid ""
"while count < 10 {\n"
" println!(\"count is {}\", count);\n"
@ -644,7 +644,7 @@ msgid ""
msgstr ""
"~~~~ {.ignore}\n"
"// main.rs\n"
"extern mod world;\n"
"extern crate world;\n"
"fn main() { println(~\"hello \" + world::explore()); }\n"
"~~~~"
@ -1413,7 +1413,7 @@ msgstr ""
#. type: Plain text
#: src/doc/tutorial.md:602
#, fuzzy, no-wrap
#| msgid "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
msgid ""
"~~~~\n"
"struct Point {\n"
@ -1424,7 +1424,7 @@ msgid ""
msgstr ""
"~~~~ {.ignore}\n"
"// main.rs\n"
"extern mod world;\n"
"extern crate world;\n"
"fn main() { println(~\"hello \" + world::explore()); }\n"
"~~~~"
@ -2187,7 +2187,7 @@ msgstr "# ボックス"
#. type: Plain text
#: src/doc/tutorial.md:986
#, fuzzy, no-wrap
#| msgid "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
msgid ""
"struct Foo {\n"
" a: u32,\n"
@ -2198,7 +2198,7 @@ msgid ""
msgstr ""
"~~~~ {.ignore}\n"
"// main.rs\n"
"extern mod world;\n"
"extern crate world;\n"
"fn main() { println(~\"hello \" + world::explore()); }\n"
"~~~~"
@ -2312,7 +2312,7 @@ msgstr "例として、シンプルな構造体型の `Point` について考え
#. type: Plain text
#: src/doc/tutorial.md:1376
#, fuzzy, no-wrap
#| msgid "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
msgid ""
"~~~\n"
"struct Point {\n"
@ -2323,7 +2323,7 @@ msgid ""
msgstr ""
"~~~~ {.ignore}\n"
"// main.rs\n"
"extern mod world;\n"
"extern crate world;\n"
"fn main() { println(~\"hello \" + world::explore()); }\n"
"~~~~"
@ -3688,7 +3688,7 @@ msgstr ""
#. type: Plain text
#: src/doc/tutorial.md:2110
#, fuzzy, no-wrap
#| msgid "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
msgid ""
"~~~\n"
"struct TimeBomb {\n"
@ -3697,7 +3697,7 @@ msgid ""
msgstr ""
"~~~~ {.ignore}\n"
"// main.rs\n"
"extern mod world;\n"
"extern crate world;\n"
"fn main() { println(~\"hello \" + world::explore()); }\n"
"~~~~"
@ -3735,7 +3735,7 @@ msgstr ""
#. type: Plain text
#: src/doc/tutorial.md:2135
#, fuzzy, no-wrap
#| msgid "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
msgid ""
"~~~~\n"
"trait Printable {\n"
@ -3745,7 +3745,7 @@ msgid ""
msgstr ""
"~~~~ {.ignore}\n"
"// main.rs\n"
"extern mod world;\n"
"extern crate world;\n"
"fn main() { println(~\"hello \" + world::explore()); }\n"
"~~~~"
@ -3774,7 +3774,7 @@ msgstr "[impls]: #メソッド"
#. type: Plain text
#: src/doc/tutorial.md:2160 src/doc/tutorial.md:2206
#, fuzzy, no-wrap
#| msgid "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
msgid ""
"impl Printable for ~str {\n"
" fn print(&self) { println!(\"{}\", *self) }\n"
@ -3782,7 +3782,7 @@ msgid ""
msgstr ""
"~~~~ {.ignore}\n"
"// main.rs\n"
"extern mod world;\n"
"extern crate world;\n"
"fn main() { println(~\"hello \" + world::explore()); }\n"
"~~~~"
@ -3821,7 +3821,7 @@ msgstr "## トレイトの実装の導出"
#. type: Plain text
#: src/doc/tutorial.md:2185
#, fuzzy, no-wrap
#| msgid "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
msgid ""
"impl Printable for bool {\n"
" fn print(&self) { println!(\"{:?}\", *self) }\n"
@ -3829,7 +3829,7 @@ msgid ""
msgstr ""
"~~~~ {.ignore}\n"
"// main.rs\n"
"extern mod world;\n"
"extern crate world;\n"
"fn main() { println(~\"hello \" + world::explore()); }\n"
"~~~~"
@ -3864,7 +3864,7 @@ msgstr "## タプル"
#. type: Plain text
#: src/doc/tutorial.md:2235
#, fuzzy, no-wrap
#| msgid "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
msgid ""
"~~~~\n"
"trait Seq<T> {\n"
@ -3873,14 +3873,14 @@ msgid ""
msgstr ""
"~~~~ {.ignore}\n"
"// main.rs\n"
"extern mod world;\n"
"extern crate world;\n"
"fn main() { println(~\"hello \" + world::explore()); }\n"
"~~~~"
#. type: Plain text
#: src/doc/tutorial.md:2240
#, fuzzy, no-wrap
#| msgid "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
msgid ""
"impl<T> Seq<T> for ~[T] {\n"
" fn length(&self) -> uint { self.len() }\n"
@ -3889,7 +3889,7 @@ msgid ""
msgstr ""
"~~~~ {.ignore}\n"
"// main.rs\n"
"extern mod world;\n"
"extern crate world;\n"
"fn main() { println(~\"hello \" + world::explore()); }\n"
"~~~~"
@ -4447,7 +4447,7 @@ msgstr "## クレート"
#. type: Plain text
#: src/doc/tutorial.md:2554
#, fuzzy, no-wrap
#| msgid "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
msgid ""
"~~~~\n"
"// `main.rs`\n"
@ -4458,7 +4458,7 @@ msgid ""
msgstr ""
"~~~~ {.ignore}\n"
"// main.rs\n"
"extern mod world;\n"
"extern crate world;\n"
"fn main() { println(~\"hello \" + world::explore()); }\n"
"~~~~"
@ -4487,7 +4487,7 @@ msgstr "## 標準ライブラリ"
#. type: Plain text
#: src/doc/tutorial.md:2587
#, fuzzy, no-wrap
#| msgid "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
msgid ""
"fn main() {\n"
" println!(\"Hello farm!\");\n"
@ -4496,7 +4496,7 @@ msgid ""
msgstr ""
"~~~~ {.ignore}\n"
"// main.rs\n"
"extern mod world;\n"
"extern crate world;\n"
"fn main() { println(~\"hello \" + world::explore()); }\n"
"~~~~"
@ -4510,21 +4510,21 @@ msgstr "## マネージドクロージャ"
#. type: Plain text
#: src/doc/tutorial.md:2607
#, fuzzy, no-wrap
#| msgid "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
msgid ""
"fn main() {\n"
" println!(\"Hello chicken!\");\n"
msgstr ""
"~~~~ {.ignore}\n"
"// main.rs\n"
"extern mod world;\n"
"extern crate world;\n"
"fn main() { println(~\"hello \" + world::explore()); }\n"
"~~~~"
#. type: Plain text
#: src/doc/tutorial.md:2639
#, fuzzy, no-wrap
#| msgid "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
msgid ""
"fn main() {\n"
" println!(\"Hello chicken!\");\n"
@ -4534,7 +4534,7 @@ msgid ""
msgstr ""
"~~~~ {.ignore}\n"
"// main.rs\n"
"extern mod world;\n"
"extern crate world;\n"
"fn main() { println(~\"hello \" + world::explore()); }\n"
"~~~~"
@ -4573,7 +4573,7 @@ msgstr "# モジュールとクレート"
#. type: Plain text
#: src/doc/tutorial.md:2719
#, fuzzy, no-wrap
#| msgid "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
msgid ""
"fn main() {\n"
" println!(\"Hello farm!\");\n"
@ -4583,7 +4583,7 @@ msgid ""
msgstr ""
"~~~~ {.ignore}\n"
"// main.rs\n"
"extern mod world;\n"
"extern crate world;\n"
"fn main() { println(~\"hello \" + world::explore()); }\n"
"~~~~"
@ -4653,34 +4653,34 @@ msgstr ""
#: src/doc/tutorial.md:2897
#, fuzzy
#| msgid ""
#| "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello "
#| "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello "
#| "\" + world::explore()); } ~~~~"
msgid "fn main() { cow() } ~~~"
msgstr ""
"~~~~ {.ignore}\n"
"// main.rs\n"
"extern mod world;\n"
"extern crate world;\n"
"fn main() { println(~\"hello \" + world::explore()); }\n"
"~~~~"
#. type: Plain text
#: src/doc/tutorial.md:2916
#, fuzzy, no-wrap
#| msgid "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
msgid ""
"fn main() {\n"
" println!(\"Hello farm!\");\n"
msgstr ""
"~~~~ {.ignore}\n"
"// main.rs\n"
"extern mod world;\n"
"extern crate world;\n"
"fn main() { println(~\"hello \" + world::explore()); }\n"
"~~~~"
#. type: Plain text
#: src/doc/tutorial.md:2923
#, fuzzy, no-wrap
#| msgid "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
msgid ""
" // Can now refer to those names directly:\n"
" chicken();\n"
@ -4691,7 +4691,7 @@ msgid ""
msgstr ""
"~~~~ {.ignore}\n"
"// main.rs\n"
"extern mod world;\n"
"extern crate world;\n"
"fn main() { println(~\"hello \" + world::explore()); }\n"
"~~~~"
@ -4699,7 +4699,7 @@ msgstr ""
#: src/doc/tutorial.md:2932
#, fuzzy
#| msgid ""
#| "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello "
#| "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello "
#| "\" + world::explore()); } ~~~~"
msgid ""
"~~~{.ignore} // `a.rs` - crate root use b::foo; mod b; fn main() { foo(); } "
@ -4707,7 +4707,7 @@ msgid ""
msgstr ""
"~~~~ {.ignore}\n"
"// main.rs\n"
"extern mod world;\n"
"extern crate world;\n"
"fn main() { println(~\"hello \" + world::explore()); }\n"
"~~~~"
@ -4715,21 +4715,21 @@ msgstr ""
#: src/doc/tutorial.md:2939
#, fuzzy
#| msgid ""
#| "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello "
#| "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello "
#| "\" + world::explore()); } ~~~~"
msgid ""
"~~~{.ignore} // `b.rs` use b::c::bar; pub mod c; pub fn foo() { bar(); } ~~~"
msgstr ""
"~~~~ {.ignore}\n"
"// main.rs\n"
"extern mod world;\n"
"extern crate world;\n"
"fn main() { println(~\"hello \" + world::explore()); }\n"
"~~~~"
#. type: Plain text
#: src/doc/tutorial.md:2985
#, fuzzy, no-wrap
#| msgid "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
msgid ""
"fn main() {\n"
" egg_layer();\n"
@ -4738,7 +4738,7 @@ msgid ""
msgstr ""
"~~~~ {.ignore}\n"
"// main.rs\n"
"extern mod world;\n"
"extern crate world;\n"
"fn main() { println(~\"hello \" + world::explore()); }\n"
"~~~~"
@ -4752,7 +4752,7 @@ msgstr "# ポインタのデリファレンス"
#. type: Plain text
#: src/doc/tutorial.md:3014
#, fuzzy, no-wrap
#| msgid "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
msgid ""
"fn main() {\n"
" farm::chicken();\n"
@ -4763,7 +4763,7 @@ msgid ""
msgstr ""
"~~~~ {.ignore}\n"
"// main.rs\n"
"extern mod world;\n"
"extern crate world;\n"
"fn main() { println(~\"hello \" + world::explore()); }\n"
"~~~~"
@ -4778,13 +4778,13 @@ msgstr "## 他のクレートの利用"
#: src/doc/tutorial.md:3035
#, fuzzy
#| msgid "## Using other crates"
msgid "For that, Rust offers you the `extern mod` declaration:"
msgid "For that, Rust offers you the `extern crate` declaration:"
msgstr "## 他のクレートの利用"
#. type: Plain text
#: src/doc/tutorial.md:3045
#, fuzzy, no-wrap
#| msgid "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
msgid ""
"fn main() {\n"
" // The rational number '1/2':\n"
@ -4794,7 +4794,7 @@ msgid ""
msgstr ""
"~~~~ {.ignore}\n"
"// main.rs\n"
"extern mod world;\n"
"extern crate world;\n"
"fn main() { println(~\"hello \" + world::explore()); }\n"
"~~~~"
@ -4802,7 +4802,7 @@ msgstr ""
#: src/doc/tutorial.md:3068
#, fuzzy
#| msgid "~~~~ {.ignore} let foo = 10;"
msgid "~~~ extern mod extra;"
msgid "~~~ extern crate extra;"
msgstr ""
"~~~~ {.ignore}\n"
"let foo = 10;"
@ -4810,7 +4810,7 @@ msgstr ""
#. type: Plain text
#: src/doc/tutorial.md:3081
#, fuzzy, no-wrap
#| msgid "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
msgid ""
"fn main() {\n"
" farm::dog();\n"
@ -4820,7 +4820,7 @@ msgid ""
msgstr ""
"~~~~ {.ignore}\n"
"// main.rs\n"
"extern mod world;\n"
"extern crate world;\n"
"fn main() { println(~\"hello \" + world::explore()); }\n"
"~~~~"
@ -4835,17 +4835,17 @@ msgstr "## 構造体"
#: src/doc/tutorial.md:3123
#, fuzzy
#| msgid ""
#| "~~~~ {.ignore} extern mod farm; extern mod my_farm (name = \"farm\", vers "
#| "= \"2.5\"); extern mod my_auxiliary_farm (name = \"farm\", author = \"mjh"
#| "~~~~ {.ignore} extern crate farm; extern crate my_farm (name = \"farm\", vers "
#| "= \"2.5\"); extern crate my_auxiliary_farm (name = \"farm\", author = \"mjh"
#| "\"); ~~~~"
msgid ""
"~~~~ {.ignore} extern mod farm; extern mod farm = \"farm#2.5\"; extern mod "
"~~~~ {.ignore} extern crate farm; extern crate farm = \"farm#2.5\"; extern crate "
"my_farm = \"farm\"; ~~~~"
msgstr ""
"~~~~ {.ignore}\n"
"extern mod farm;\n"
"extern mod my_farm (name = \"farm\", vers = \"2.5\");\n"
"extern mod my_auxiliary_farm (name = \"farm\", author = \"mjh\");\n"
"extern crate farm;\n"
"extern crate my_farm (name = \"farm\", vers = \"2.5\");\n"
"extern crate my_auxiliary_farm (name = \"farm\", author = \"mjh\");\n"
"~~~~"
#. type: Plain text
@ -4891,7 +4891,7 @@ msgstr ""
#| "~~~~ // world.rs #[link(name = \"world\", vers = \"1.0\")]; pub fn "
#| "explore() -> &str { \"world\" } ~~~~"
msgid ""
"~~~~ // `world.rs` #[crate_id = \"world#0.42\"]; # extern mod extra; pub fn "
"~~~~ // `world.rs` #[crate_id = \"world#0.42\"]; # extern crate extra; pub fn "
"explore() -> &'static str { \"world\" } # fn main() {} ~~~~"
msgstr ""
"~~~~\n"
@ -4904,15 +4904,15 @@ msgstr ""
#: src/doc/tutorial.md:3159
#, fuzzy
#| msgid ""
#| "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello "
#| "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello "
#| "\" + world::explore()); } ~~~~"
msgid ""
"~~~~ {.ignore} // `main.rs` extern mod world; fn main() { println!(\"hello "
"~~~~ {.ignore} // `main.rs` extern crate world; fn main() { println!(\"hello "
"{}\", world::explore()); } ~~~~"
msgstr ""
"~~~~ {.ignore}\n"
"// main.rs\n"
"extern mod world;\n"
"extern crate world;\n"
"fn main() { println(~\"hello \" + world::explore()); }\n"
"~~~~"
@ -4977,7 +4977,7 @@ msgstr "## 標準ライブラリ"
#: src/doc/tutorial.md:3187
#, fuzzy
#| msgid "~~~~ {.ignore} let foo = 10;"
msgid "~~~ {.ignore} extern mod std; ~~~"
msgid "~~~ {.ignore} extern crate std; ~~~"
msgstr ""
"~~~~ {.ignore}\n"
"let foo = 10;"

View file

@ -759,7 +759,7 @@ 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 mod` declarations](#extern-mod-declarations)
* [`extern crate` declarations](#extern-mod-declarations)
* [`use` declarations](#use-declarations)
##### Extern mod declarations
@ -770,7 +770,7 @@ link_attrs : link_attr [ ',' link_attrs ] + ;
link_attr : ident '=' literal ;
~~~~
An _`extern mod` declaration_ specifies a dependency on an external crate.
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`.
@ -782,16 +782,16 @@ 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`.
Four examples of `extern mod` declarations:
Four examples of `extern crate` declarations:
~~~~ {.ignore}
extern mod pcre;
extern crate pcre;
extern mod extra; // equivalent to: extern mod extra = "extra";
extern crate extra; // equivalent to: extern crate extra = "extra";
extern mod rustextra = "extra"; // linking to 'extra' under another name
extern crate rustextra = "extra"; // linking to 'extra' under another name
extern mod foo = "some/where/rust-foo#foo:1.0"; // a full package ID for external tools
extern crate foo = "some/where/rust-foo#foo:1.0"; // a full package ID for external tools
~~~~
##### Use 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 mod` declarations](#extern-mod-declarations) declare linkage dependencies.
Rather, [`extern crate` declarations](#extern-mod-declarations) declare linkage dependencies.
Use declarations support a number of convenient shortcuts:
@ -869,7 +869,7 @@ This also means that top-level module declarations should be at the crate root i
of the declared modules within `use` items is desired. It is also possible to use `self` and `super`
at the beginning of a `use` item to refer to the current and direct parent modules respectively.
All rules regarding accessing declared modules in `use` declarations applies to both module declarations
and `extern mod` declarations.
and `extern crate` declarations.
An example of what will and will not work for `use` items:
@ -879,7 +879,7 @@ use foo::extra; // good: foo is at the root of the crate
use foo::baz::foobaz; // good: foo is at the root of the crate
mod foo {
extern mod extra;
extern crate extra;
use foo::extra::time; // good: foo is at crate root
// use extra::*; // bad: extra is not at the crate root

View file

@ -53,7 +53,7 @@ struct Whizbang;
To generate the docs, run `rustdoc universe.rs`. By default, it generates a
directory called `doc`, with the documentation for `universe` being in
`doc/universe/index.html`. If you are using other crates with `extern mod`,
`doc/universe/index.html`. If you are using other crates with `extern crate`,
rustdoc will even link to them when you use their types, as long as their
documentation has already been generated by a previous run of rustdoc, or the
crate advertises that its documentation is hosted at a given URL.
@ -176,7 +176,7 @@ rustdoc --test lib.rs --test-args '--ignored'
When testing a library, code examples will often show how functions are used,
and this code often requires `use`-ing paths from the crate. To accomodate this,
rustdoc will implicitly add `extern mod <crate>;` where `<crate>` is the name of
rustdoc will implicitly add `extern crate <crate>;` where `<crate>` is the name of
the crate being tested to the top of each code example. This means that rustdoc
must be able to find a compiled version of the library crate being tested. Extra
search paths may be added via the `-L` flag to `rustdoc`.

View file

@ -2581,7 +2581,7 @@ As you can see, your module hierarchy is now three modules deep: There is the cr
function, and the module `farm`. The module `farm` also contains two functions and a third module `barn`,
which contains a function `hay`.
(In case you already stumbled over `extern mod`: It isn't directly related to a bare `mod`, we'll get to it later. )
(In case you already stumbled over `extern crate`: It isn't directly related to a bare `mod`, we'll get to it later. )
## Paths and visibility
@ -3018,10 +3018,10 @@ as there really is no reason to start from scratch each time you start a new pro
In Rust terminology, we need a way to refer to other crates.
For that, Rust offers you the `extern mod` declaration:
For that, Rust offers you the `extern crate` declaration:
~~~
extern mod num;
extern crate num;
// `num` ships with Rust (much like `extra`; more details further down).
fn main() {
@ -3030,8 +3030,8 @@ fn main() {
}
~~~
Despite its name, `extern mod` is a distinct construct from regular `mod` declarations:
A statement of the form `extern mod foo;` will cause `rustc` to search for the crate `foo`,
Despite its name, `extern crate` is a distinct construct from regular `mod` declarations:
A statement of the form `extern crate foo;` will cause `rustc` to search for the crate `foo`,
and if it finds a matching binary it lets you use it from inside your crate.
The effect it has on your module hierarchy mirrors aspects of both `mod` and `use`:
@ -3039,19 +3039,19 @@ The effect it has on your module hierarchy mirrors aspects of both `mod` and `us
- Like `mod`, it causes `rustc` to actually emit code:
The linkage information the binary needs to use the library `foo`.
- But like `use`, all `extern mod` statements that refer to the same library are interchangeable,
- But like `use`, all `extern crate` statements that refer to the same library are interchangeable,
as each one really just presents an alias to an external module (the crate root of the library
you're linking against).
Remember how `use`-statements have to go before local declarations because the latter shadows the former?
Well, `extern mod` statements also have their own rules in that regard:
Both `use` and local declarations can shadow them, so the rule is that `extern mod` has to go in front
Well, `extern crate` statements also have their own rules in that regard:
Both `use` and local declarations can shadow them, so the rule is that `extern crate` has to go in front
of both `use` and local declarations.
Which can result in something like this:
~~~
extern mod num;
extern crate num;
use farm::dog;
use num::rational::Ratio;
@ -3071,7 +3071,7 @@ they model most closely what people expect to shadow.
## Package ids
If you use `extern mod`, per default `rustc` will look for libraries in the library search path (which you can
If you use `extern crate`, per default `rustc` will look for libraries in the library search path (which you can
extend with the `-L` switch).
## Crate metadata and settings
@ -3098,14 +3098,14 @@ Therefore, if you plan to compile your crate as a library, you should annotate i
# fn farm() {}
~~~~
You can also specify package ID information in a `extern mod` statement. For
example, these `extern mod` statements would both accept and select the
You can also specify package ID information in a `extern crate` statement. For
example, these `extern crate` statements would both accept and select the
crate define above:
~~~~ {.ignore}
extern mod farm;
extern mod farm = "farm#2.5";
extern mod my_farm = "farm";
extern crate farm;
extern crate farm = "farm#2.5";
extern crate my_farm = "farm";
~~~~
Other crate settings and metadata include things like enabling/disabling certain errors or warnings,
@ -3133,14 +3133,14 @@ We define two crates, and use one of them as a library in the other.
~~~~
// `world.rs`
#[crate_id = "world#0.42"];
# extern mod extra;
# extern crate extra;
pub fn explore() -> &'static str { "world" }
# fn main() {}
~~~~
~~~~ {.ignore}
// `main.rs`
extern mod world;
extern crate world;
fn main() { println!("hello {}", world::explore()); }
~~~~
@ -3169,7 +3169,7 @@ in the `std` library, which is a crate that ships with Rust.
The only magical thing that happens is that `rustc` automatically inserts this line into your crate root:
~~~ {.ignore}
extern mod std;
extern crate std;
~~~
As well as this line into every module body:
@ -3221,7 +3221,7 @@ See the [API documentation][stddoc] for details.
Rust ships with crates such as the [extra library], an accumulation of useful things,
that are however not important enough to deserve a place in the standard
library. You can link to a library such as `extra` with an `extern mod extra;`.
library. You can link to a library such as `extra` with an `extern crate extra;`.
[extra library]: extra/index.html

View file

@ -3,4 +3,4 @@
<span class="white-sticker"><a href="http://rust-lang.org">Rust</a> VERSION</span><br>
<a href="http://github.com/mozilla/rust/commit/STAMP"
class="hash white-sticker">SHORT_HASH</a>
</div>
</div>